@@ -41,6 +41,8 @@ spec = do
41 context "Player (unary record)" $ checkToSchema (Proxy :: Proxy Player) playerSchemaJSON
41 context "Player (unary record)" $ checkToSchema (Proxy :: Proxy Player) playerSchemaJSON
42 context "Players (inlining schema)" $ checkToSchema (Proxy :: Proxy Players) playersSchemaJSON
42 context "Players (inlining schema)" $ checkToSchema (Proxy :: Proxy Players) playersSchemaJSON
43 context "MyRoseTree (datatypeNameModifier)" $ checkToSchema (Proxy :: Proxy MyRoseTree) myRoseTreeSchemaJSON
43 context "MyRoseTree (datatypeNameModifier)" $ checkToSchema (Proxy :: Proxy MyRoseTree) myRoseTreeSchemaJSON
44+ context "Sum types" $ do
45+ context "Status (sum of unary constructors)" $ checkToSchema (Proxy :: Proxy Status) statusSchemaJSON
44 context "Schema name" $ do
46 context "Schema name" $ do
45 context "String" $ checkSchemaName Nothing (Proxy :: Proxy String)
47 context "String" $ checkSchemaName Nothing (Proxy :: Proxy String)
46 context "(Int, Float)" $ checkSchemaName Nothing (Proxy :: Proxy (Int, Float))
48 context "(Int, Float)" $ checkSchemaName Nothing (Proxy :: Proxy (Int, Float))
@@ -295,3 +297,26 @@ playersSchemaJSON = [aesonQQ|
300+-- ========================================================================
301+-- Status (sum type with unary constructors)
302+-- ========================================================================
306+ | StatusError String
307+ deriving (Generic, ToSchema)
309+statusSchemaJSON :: Value
310+statusSchemaJSON = [aesonQQ|
315+ "StatusOk": { "type": "string" },
316+ "StatusError": { "type": "string" }