@@ -80,6 +80,7 @@ spec = do
80 context "Player (unary record)" $ checkToSchema (Proxy :: Proxy Player) playerSchemaJSON
80 context "Player (unary record)" $ checkToSchema (Proxy :: Proxy Player) playerSchemaJSON
81 context "Players (inlining schema)" $ checkToSchema (Proxy :: Proxy Players) playersSchemaJSON
81 context "Players (inlining schema)" $ checkToSchema (Proxy :: Proxy Players) playersSchemaJSON
82 context "MyRoseTree (datatypeNameModifier)" $ checkToSchema (Proxy :: Proxy MyRoseTree) myRoseTreeSchemaJSON
82 context "MyRoseTree (datatypeNameModifier)" $ checkToSchema (Proxy :: Proxy MyRoseTree) myRoseTreeSchemaJSON
83+ context "MyRoseTree' (datatypeNameModifier)" $ checkToSchema (Proxy :: Proxy MyRoseTree') myRoseTreeSchemaJSON'
83 context "Sum types" $ do
84 context "Sum types" $ do
84 context "Status (sum of unary constructors)" $ checkToSchema (Proxy :: Proxy Status) statusSchemaJSON
85 context "Status (sum of unary constructors)" $ checkToSchema (Proxy :: Proxy Status) statusSchemaJSON
85 context "Character (ref and record sum)" $ checkToSchema (Proxy :: Proxy Character) characterSchemaJSON
86 context "Character (ref and record sum)" $ checkToSchema (Proxy :: Proxy Character) characterSchemaJSON
@@ -95,6 +96,7 @@ spec = do
95 context "Light" $ checkDefs (Proxy :: Proxy Light) ["Color"]
96 context "Light" $ checkDefs (Proxy :: Proxy Light) ["Color"]
96 context "Character" $ checkDefs (Proxy :: Proxy Character) ["Player", "Point"]
97 context "Character" $ checkDefs (Proxy :: Proxy Character) ["Player", "Point"]
97 context "MyRoseTree" $ checkDefs (Proxy :: Proxy MyRoseTree) ["RoseTree"]
98 context "MyRoseTree" $ checkDefs (Proxy :: Proxy MyRoseTree) ["RoseTree"]
99+ context "MyRoseTree'" $ checkDefs (Proxy :: Proxy MyRoseTree') ["myrosetree'"]
98 context "[Set (Unit, Maybe Color)]" $ checkDefs (Proxy :: Proxy [Set (Unit, Maybe Color)]) ["Unit", "Color"]
100 context "[Set (Unit, Maybe Color)]" $ checkDefs (Proxy :: Proxy [Set (Unit, Maybe Color)]) ["Unit", "Color"]
99 context "ResourceId" $ checkDefs (Proxy :: Proxy ResourceId) []
101 context "ResourceId" $ checkDefs (Proxy :: Proxy ResourceId) []
100 describe "Inlining Schemas" $ do
102 describe "Inlining Schemas" $ do
@@ -103,6 +105,7 @@ spec = do
103 context "Character (inlining only Player)" $ checkInlinedSchemas ["Player"] (Proxy :: Proxy Character) characterInlinedPlayerSchemaJSON
105 context "Character (inlining only Player)" $ checkInlinedSchemas ["Player"] (Proxy :: Proxy Character) characterInlinedPlayerSchemaJSON
104 context "Light" $ checkInlinedSchema (Proxy :: Proxy Light) lightInlinedSchemaJSON
106 context "Light" $ checkInlinedSchema (Proxy :: Proxy Light) lightInlinedSchemaJSON
105 context "MyRoseTree (inlineNonRecursiveSchemas)" $ checkInlinedRecSchema (Proxy :: Proxy MyRoseTree) myRoseTreeSchemaJSON
107 context "MyRoseTree (inlineNonRecursiveSchemas)" $ checkInlinedRecSchema (Proxy :: Proxy MyRoseTree) myRoseTreeSchemaJSON
108+ context "MyRoseTree' (inlineNonRecursiveSchemas)" $ checkInlinedRecSchema (Proxy :: Proxy MyRoseTree') myRoseTreeSchemaJSON'
106 describe "Bounded Enum key mapping" $ do
109 describe "Bounded Enum key mapping" $ do
107 context "ButtonImages" $ checkToSchema (Proxy :: Proxy ButtonImages) buttonImagesSchemaJSON
110 context "ButtonImages" $ checkToSchema (Proxy :: Proxy ButtonImages) buttonImagesSchemaJSON
@@ -398,6 +401,35 @@ myRoseTreeSchemaJSON = [aesonQQ|
404+data MyRoseTree' = MyRoseTree'
406+ , trees' :: [MyRoseTree']
407+ } deriving (Generic)
409+instance ToSchema MyRoseTree' where
410+ declareNamedSchema = genericDeclareNamedSchema defaultSchemaOptions
411+ { datatypeNameModifier = map toLower }
413+myRoseTreeSchemaJSON' :: Value
414+myRoseTreeSchemaJSON' = [aesonQQ|
419+ "root'": { "type": "string" },
425+ "$ref": "#/definitions/myrosetree'"
429+ "required": ["root'", "trees'"]
401-- ========================================================================
433-- ========================================================================
402-- Inlined (newtype for inlining schemas)
434-- Inlined (newtype for inlining schemas)
403-- ========================================================================
435-- ========================================================================