@@ -135,6 +135,7 @@ instance ToSchema a => ToSchema (Dual a) where toNamedSchema _ = unnamed $ to
135data SchemaOptions = SchemaOptions
135data SchemaOptions = SchemaOptions
136 { fieldLabelModifier :: String -> String
136 { fieldLabelModifier :: String -> String
137 , datatypeNameModifier :: String -> String
137 , datatypeNameModifier :: String -> String
138+ , useReferences :: Bool
138 , unwrapUnaryRecords :: Bool
139 , unwrapUnaryRecords :: Bool
@@ -142,6 +143,7 @@ defaultSchemaOptions :: SchemaOptions
142defaultSchemaOptions = SchemaOptions
143defaultSchemaOptions = SchemaOptions
143 { fieldLabelModifier = id
144 { fieldLabelModifier = id
144 , datatypeNameModifier = id
145 , datatypeNameModifier = id
146+ , useReferences = True
145 , unwrapUnaryRecords = False
147 , unwrapUnaryRecords = False
@@ -196,7 +198,8 @@ instance (Datatype d, Selector s, GToSchema f) => GToSchema (D1 d (C1 c (S1 s f)
197gtoSchemaRef :: GToSchema f => SchemaOptions -> proxy f -> Referenced Schema
199gtoSchemaRef :: GToSchema f => SchemaOptions -> proxy f -> Referenced Schema
198gtoSchemaRef opts proxy = case gtoNamedSchema opts proxy mempty of
200gtoSchemaRef opts proxy = case gtoNamedSchema opts proxy mempty of
199− (Just name, _) -> Ref (Reference ("#/definitions/" <> T.pack name))
202+ | useReferences opts -> Ref (Reference ("#/definitions/" <> T.pack name))
200 (_, schema) -> Inline schema
203 (_, schema) -> Inline schema
202appendItem :: Referenced Schema -> Maybe SchemaItems -> Maybe SchemaItems
205appendItem :: Referenced Schema -> Maybe SchemaItems -> Maybe SchemaItems