@@ -32,7 +32,7 @@ import Data.Data.Lens (template)
3232
3333import Control.Monad
3434import Control.Monad.Writer
35−import Data.Aeson (ToJSON (..), ToJSONKey (..), ToJSONKeyFunction (..), Value (..), Object(..))
35+import Data.Aeson (ToJSON (..), ToJSONKey (..), ToJSONKeyFunction (..), Value (..))
3636import Data.Char
3737import Data.Data (Data)
3838import Data.Foldable (traverse_)
@@ -111,7 +111,7 @@ rename name (NamedSchema _ schema) = NamedSchema name schema
111111-- declareNamedSchema _ = do
112112-- doubleSchema <- declareSchemaRef (Proxy :: Proxy Double)
113113-- return $ NamedSchema (Just \"Coord\") $ mempty
114−-- & type_ ?~ SwaggerObject
114+-- & type_ .~ SwaggerObject
115115-- & properties .~
116116-- [ (\"x\", doubleSchema)
117117-- , (\"y\", doubleSchema)
@@ -142,17 +142,13 @@ class ToSchema a where
142142 -- together with all used definitions.
143143 -- Note that the schema itself is included in definitions
144144 -- only if it is recursive (and thus needs its definition in scope).
145− declareNamedSchema :: Proxy a -> Declare (Definitions Schema) NamedSchema
145+ declareNamedSchema :: proxy a -> Declare (Definitions Schema) NamedSchema
146146 default declareNamedSchema :: (Generic a, GToSchema (Rep a), TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
147− Proxy a -> Declare (Definitions Schema) NamedSchema
147+ proxy a -> Declare (Definitions Schema) NamedSchema
148148 declareNamedSchema = genericDeclareNamedSchema defaultSchemaOptions
149149
150−instance ToSchema TimeOfDay where
151− declareNamedSchema _ = pure $ named "TimeOfDay" $ timeSchema "hh:MM:ss"
152− & example ?~ toJSON (TimeOfDay 12 33 15)
153−
154150-- | Convert a type into a schema and declare all used schema definitions.
155−declareSchema :: ToSchema a => Proxy a -> Declare (Definitions Schema) Schema
151+declareSchema :: ToSchema a => proxy a -> Declare (Definitions Schema) Schema
156152declareSchema = fmap _namedSchemaSchema . declareNamedSchema
157153
158154-- | Convert a type into an optionally named schema.
@@ -166,7 +162,7 @@ declareSchema = fmap _namedSchemaSchema . declareNamedSchema
166162-- Just "Day"
167163-- >>> encode (toNamedSchema (Proxy :: Proxy Day) ^. schema)
168164-- "{\"example\":\"2016-07-22\",\"format\":\"date\",\"type\":\"string\"}"
169−toNamedSchema :: ToSchema a => Proxy a -> NamedSchema
165+toNamedSchema :: ToSchema a => proxy a -> NamedSchema
170166toNamedSchema = undeclare . declareNamedSchema
171167
172168-- | Get type's schema name according to its @'ToSchema'@ instance.
@@ -176,7 +172,7 @@ toNamedSchema = undeclare . declareNamedSchema
176172--
177173-- >>> schemaName (Proxy :: Proxy UTCTime)
178174-- Just "UTCTime"
179−schemaName :: ToSchema a => Proxy a -> Maybe T.Text
175+schemaName :: ToSchema a => proxy a -> Maybe T.Text
180176schemaName = _namedSchemaName . toNamedSchema
181177
182178-- | Convert a type into a schema.
@@ -186,7 +182,7 @@ schemaName = _namedSchemaName . toNamedSchema
186182--
187183-- >>> encode $ toSchema (Proxy :: Proxy [Day])
188184-- "{\"items\":{\"$ref\":\"#/definitions/Day\"},\"type\":\"array\"}"
189−toSchema :: ToSchema a => Proxy a -> Schema
185+toSchema :: ToSchema a => proxy a -> Schema
190186toSchema = _namedSchemaSchema . toNamedSchema
191187
192188-- | Convert a type into a referenced schema if possible.
@@ -197,7 +193,7 @@ toSchema = _namedSchemaSchema . toNamedSchema
197193--
198194-- >>> encode $ toSchemaRef (Proxy :: Proxy Day)
199195-- "{\"$ref\":\"#/definitions/Day\"}"
200−toSchemaRef :: ToSchema a => Proxy a -> Referenced Schema
196+toSchemaRef :: ToSchema a => proxy a -> Referenced Schema
201197toSchemaRef = undeclare . declareSchemaRef
202198
203199-- | Convert a type into a referenced schema if possible
@@ -207,7 +203,7 @@ toSchemaRef = undeclare . declareSchemaRef
207203-- Schema definitions are typically declared for every referenced schema.
208204-- If @'declareSchemaRef'@ returns a reference, a corresponding schema
209205-- will be declared (regardless of whether it is recusive or not).
210−declareSchemaRef :: ToSchema a => Proxy a -> Declare (Definitions Schema) (Referenced Schema)
206+declareSchemaRef :: ToSchema a => proxy a -> Declare (Definitions Schema) (Referenced Schema)
211207declareSchemaRef proxy = do
212208 case toNamedSchema proxy of
213209 NamedSchema (Just name) schema -> do
@@ -269,7 +265,7 @@ inlineAllSchemas = inlineSchemasWhen (const True)
269265--
270266-- __WARNING:__ @'toInlinedSchema'@ will produce infinite schema
271267-- when inlining recursive schemas.
272−toInlinedSchema :: ToSchema a => Proxy a -> Schema
268+toInlinedSchema :: ToSchema a => proxy a -> Schema
273269toInlinedSchema proxy = inlineAllSchemas defs schema
274270 where
275271 (defs, schema) = runDeclare (declareSchema proxy) mempty
@@ -298,20 +294,20 @@ inlineNonRecursiveSchemas defs = inlineSchemasWhen nonRecursive defs
298294-- | Default schema for binary data (any sequence of octets).
299295binarySchema :: Schema
300296binarySchema = mempty
301− & type_ ?~ SwaggerString
297+ & type_ .~ SwaggerString
302298 & format ?~ "binary"
303299
304300-- | Default schema for binary data (base64 encoded).
305301byteSchema :: Schema
306302byteSchema = mempty
307− & type_ ?~ SwaggerString
303+ & type_ .~ SwaggerString
308304 & format ?~ "byte"
309305
310306-- | Default schema for password string.
311307-- @"password"@ format is used to hint UIs the input needs to be obscured.
312308passwordSchema :: Schema
313309passwordSchema = mempty
314− & type_ ?~ SwaggerString
310+ & type_ .~ SwaggerString
315311 & format ?~ "password"
316312
317313-- | Make an unrestrictive sketch of a @'Schema'@ based on a @'ToJSON'@ instance.
@@ -337,12 +333,12 @@ sketchSchema = sketch . toJSON
337333 sketch js@(Bool _) = go js
338334 sketch js = go js & example ?~ js
339335
340− go Null = mempty & type_ ?~ SwaggerNull
341− go (Bool _) = mempty & type_ ?~ SwaggerBoolean
342− go (String _) = mempty & type_ ?~ SwaggerString
343− go (Number _) = mempty & type_ ?~ SwaggerNumber
336+ go Null = mempty & type_ .~ SwaggerNull
337+ go (Bool _) = mempty & type_ .~ SwaggerBoolean
338+ go (String _) = mempty & type_ .~ SwaggerString
339+ go (Number _) = mempty & type_ .~ SwaggerNumber
344340 go (Array xs) = mempty
345− & type_ ?~ SwaggerArray
341+ & type_ .~ SwaggerArray
346342 & items ?~ case ischema of
347343 Just s -> SwaggerItemsObject (Inline s)
348344 _ -> SwaggerItemsArray (map Inline ys)
@@ -354,7 +350,7 @@ sketchSchema = sketch . toJSON
354350 (z:_) | allSame -> Just z
355351 _ -> Nothing
356352 go (Object o) = mempty
357− & type_ ?~ SwaggerObject
353+ & type_ .~ SwaggerObject
358354 & required .~ HashMap.keys o
359355 & properties .~ fmap (Inline . go) (InsOrdHashMap.fromHashMap o)
360356
@@ -377,24 +373,24 @@ sketchSchema = sketch . toJSON
377373sketchStrictSchema :: ToJSON a => a -> Schema
378374sketchStrictSchema = go . toJSON
379375 where
380− go Null = mempty & type_ ?~ SwaggerNull
376+ go Null = mempty & type_ .~ SwaggerNull
381377 go js@(Bool _) = mempty
382− & type_ ?~ SwaggerBoolean
378+ & type_ .~ SwaggerBoolean
383379 & enum_ ?~ [js]
384380 go js@(String s) = mempty
385− & type_ ?~ SwaggerString
381+ & type_ .~ SwaggerString
386382 & maxLength ?~ fromIntegral (T.length s)
387383 & minLength ?~ fromIntegral (T.length s)
388384 & pattern ?~ s
389385 & enum_ ?~ [js]
390386 go js@(Number n) = mempty
391− & type_ ?~ SwaggerNumber
387+ & type_ .~ SwaggerNumber
392388 & maximum_ ?~ n
393389 & minimum_ ?~ n
394390 & multipleOf ?~ n
395391 & enum_ ?~ [js]
396392 go js@(Array xs) = mempty
397− & type_ ?~ SwaggerArray
393+ & type_ .~ SwaggerArray
398394 & maxItems ?~ fromIntegral sz
399395 & minItems ?~ fromIntegral sz
400396 & items ?~ SwaggerItemsArray (map (Inline . go) (V.toList xs))
@@ -404,7 +400,7 @@ sketchStrictSchema = go . toJSON
404400 sz = length xs
405401 allUnique = sz == HashSet.size (HashSet.fromList (V.toList xs))
406402 go js@(Object o) = mempty
407− & type_ ?~ SwaggerObject
403+ & type_ .~ SwaggerObject
408404 & required .~ names
409405 & properties .~ fmap (Inline . go) (InsOrdHashMap.fromHashMap o)
410406 & maxProperties ?~ fromIntegral (length names)
@@ -414,13 +410,13 @@ sketchStrictSchema = go . toJSON
414410 names = HashMap.keys o
415411
416412class GToSchema (f :: * -> *) where
417− gdeclareNamedSchema :: SchemaOptions -> Proxy f -> Schema -> Declare (Definitions Schema) NamedSchema
413+ gdeclareNamedSchema :: SchemaOptions -> proxy f -> Schema -> Declare (Definitions Schema) NamedSchema
418414
419415instance OVERLAPPABLE_ ToSchema a => ToSchema [a] where
420416 declareNamedSchema _ = do
421417 ref <- declareSchemaRef (Proxy :: Proxy a)
422418 return $ unnamed $ mempty
423− & type_ ?~ SwaggerArray
419+ & type_ .~ SwaggerArray
424420 & items ?~ SwaggerItemsObject ref
425421
426422instance OVERLAPPING_ ToSchema String where declareNamedSchema = plain . paramSchemaToSchema
@@ -470,7 +466,7 @@ instance (ToSchema a, ToSchema b, ToSchema c, ToSchema d, ToSchema e, ToSchema f
470466
471467timeSchema :: T.Text -> Schema
472468timeSchema fmt = mempty
473− & type_ ?~ SwaggerString
469+ & type_ .~ SwaggerString
474470 & format ?~ fmt
475471
476472-- | Format @"date"@ corresponds to @yyyy-mm-dd@ format.
@@ -532,8 +528,8 @@ instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (Map k v) where
532528 declareObjectMapSchema = do
533529 schema <- declareSchemaRef (Proxy :: Proxy v)
534530 return $ unnamed $ mempty
535− & type_ ?~ SwaggerObject
536− & additionalProperties ?~ AdditionalPropertiesSchema schema
531+ & type_ .~ SwaggerObject
532+ & additionalProperties ?~ schema
537533
538534instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (HashMap k v) where
539535 declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map k v))
@@ -544,7 +540,7 @@ instance ToSchema a => ToSchema (Map String a) where
544540 declareNamedSchema _ = do
545541 schema <- declareSchemaRef (Proxy :: Proxy a)
546542 return $ unnamed $ mempty
547− & type_ ?~ SwaggerObject
543+ & type_ .~ SwaggerObject
548544 & additionalProperties ?~ schema
549545
550546instance ToSchema a => ToSchema (Map T.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
@@ -556,12 +552,6 @@ instance ToSchema a => ToSchema (HashMap TL.Text a) where declareNamedSchema _ =
556552
557553#endif
558554
559−instance OVERLAPPING_ ToSchema Object where
560− declareNamedSchema _ = pure $ NamedSchema (Just "Object") $ mempty
561− & type_ ?~ SwaggerObject
562− & description ?~ "Arbitrary JSON object."
563− & additionalProperties ?~ AdditionalPropertiesAllowed True
564−
565555instance ToSchema a => ToSchema (V.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
566556instance ToSchema a => ToSchema (VU.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
567557instance ToSchema a => ToSchema (VS.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
@@ -597,26 +587,26 @@ instance ToSchema a => ToSchema (Identity a) where declareNamedSchema _ = declar
597587--
598588-- >>> encode $ toSchemaBoundedIntegral (Proxy :: Proxy Int16)
599589-- "{\"maximum\":32767,\"minimum\":-32768,\"type\":\"integer\"}"
600−toSchemaBoundedIntegral :: forall a. (Bounded a, Integral a) => Proxy a -> Schema
590+toSchemaBoundedIntegral :: forall a proxy. (Bounded a, Integral a) => proxy a -> Schema
601591toSchemaBoundedIntegral _ = mempty
602− & type_ ?~ SwaggerInteger
592+ & type_ .~ SwaggerInteger
603593 & minimum_ ?~ fromInteger (toInteger (minBound :: a))
604594 & maximum_ ?~ fromInteger (toInteger (maxBound :: a))
605595
606596-- | Default generic named schema for @'Bounded'@, @'Integral'@ types.
607−genericToNamedSchemaBoundedIntegral :: forall a d f.
597+genericToNamedSchemaBoundedIntegral :: forall a d f proxy.
608598 ( Bounded a, Integral a
609599 , Generic a, Rep a ~ D1 d f, Datatype d)
610− => SchemaOptions -> Proxy a -> NamedSchema
600+ => SchemaOptions -> proxy a -> NamedSchema
611601genericToNamedSchemaBoundedIntegral opts proxy
612602 = genericNameSchema opts proxy (toSchemaBoundedIntegral proxy)
613603
614604-- | Declare a named schema for a @newtype@ wrapper.
615−genericDeclareNamedSchemaNewtype :: forall a d c s i inner.
605+genericDeclareNamedSchemaNewtype :: forall proxy a d c s i inner.
616606 (Generic a, Datatype d, Rep a ~ D1 d (C1 c (S1 s (K1 i inner))))
617607 => SchemaOptions -- ^ How to derive the name.
618608 -> (Proxy inner -> Declare (Definitions Schema) Schema) -- ^ How to create a schema for the wrapped type.
619− -> Proxy a
609+ -> proxy a
620610 -> Declare (Definitions Schema) NamedSchema
621611genericDeclareNamedSchemaNewtype opts f proxy = genericNameSchema opts proxy <$> f (Proxy :: Proxy inner)
622612
@@ -633,9 +623,9 @@ genericDeclareNamedSchemaNewtype opts f proxy = genericNameSchema opts proxy <$>
633623--
634624-- Note: this is only useful when @key@ is encoded with 'ToJSONKeyText'.
635625-- If it is encoded with 'ToJSONKeyValue' then a regular schema for @[(key, value)]@ is used.
636−declareSchemaBoundedEnumKeyMapping :: forall map key value.
626+declareSchemaBoundedEnumKeyMapping :: forall map key value proxy.
637627 (Bounded key, Enum key, ToJSONKey key, ToSchema key, ToSchema value)
638− => Proxy (map key value) -> Declare (Definitions Schema) Schema
628+ => proxy (map key value) -> Declare (Definitions Schema) Schema
639629declareSchemaBoundedEnumKeyMapping _ = case toJSONKey :: ToJSONKeyFunction key of
640630 ToJSONKeyText keyToText _ -> objectSchema keyToText
641631 ToJSONKeyValue _ _ -> declareSchema (Proxy :: Proxy [(key, value)])
@@ -645,7 +635,7 @@ declareSchemaBoundedEnumKeyMapping _ = case toJSONKey :: ToJSONKeyFunction key o
645635 let allKeys = [minBound..maxBound :: key]
646636 mkPair k = (keyToText k, valueRef)
647637 return $ mempty
648− & type_ ?~ SwaggerObject
638+ & type_ .~ SwaggerObject
649639 & properties .~ InsOrdHashMap.fromList (map mkPair allKeys)
650640
651641-- | A 'Schema' for a mapping with 'Bounded' 'Enum' keys.
@@ -661,46 +651,46 @@ declareSchemaBoundedEnumKeyMapping _ = case toJSONKey :: ToJSONKeyFunction key o
661651--
662652-- Note: this is only useful when @key@ is encoded with 'ToJSONKeyText'.
663653-- If it is encoded with 'ToJSONKeyValue' then a regular schema for @[(key, value)]@ is used.
664−toSchemaBoundedEnumKeyMapping :: forall map key value.
654+toSchemaBoundedEnumKeyMapping :: forall map key value proxy.
665655 (Bounded key, Enum key, ToJSONKey key, ToSchema key, ToSchema value)
666− => Proxy (map key value) -> Schema
656+ => proxy (map key value) -> Schema
667657toSchemaBoundedEnumKeyMapping = flip evalDeclare mempty . declareSchemaBoundedEnumKeyMapping
668658
669659-- | A configurable generic @'Schema'@ creator.
670660genericDeclareSchema :: (Generic a, GToSchema (Rep a), TypeHasSimpleShape a "genericDeclareSchemaUnrestricted") =>
671− SchemaOptions -> Proxy a -> Declare (Definitions Schema) Schema
661+ SchemaOptions -> proxy a -> Declare (Definitions Schema) Schema
672662genericDeclareSchema = genericDeclareSchemaUnrestricted
673663
674664-- | A configurable generic @'NamedSchema'@ creator.
675665-- This function applied to @'defaultSchemaOptions'@
676666-- is used as the default for @'declareNamedSchema'@
677667-- when the type is an instance of @'Generic'@.
678−genericDeclareNamedSchema :: (Generic a, GToSchema (Rep a), TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
679− SchemaOptions -> Proxy a -> Declare (Definitions Schema) NamedSchema
668+genericDeclareNamedSchema :: forall a proxy. (Generic a, GToSchema (Rep a), TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
669+ SchemaOptions -> proxy a -> Declare (Definitions Schema) NamedSchema
680670genericDeclareNamedSchema = genericDeclareNamedSchemaUnrestricted
681671
682672-- | A configurable generic @'Schema'@ creator.
683673--
684674-- Unlike 'genericDeclareSchema' also works for mixed sum types.
685675-- Use with care since some Swagger tools do not support well schemas for mixed sum types.
686−genericDeclareSchemaUnrestricted :: (Generic a, GToSchema (Rep a)) => SchemaOptions -> Proxy a -> Declare (Definitions Schema) Schema
676+genericDeclareSchemaUnrestricted :: (Generic a, GToSchema (Rep a)) => SchemaOptions -> proxy a -> Declare (Definitions Schema) Schema
687677genericDeclareSchemaUnrestricted opts proxy = _namedSchemaSchema <$> genericDeclareNamedSchemaUnrestricted opts proxy
688678
689679-- | A configurable generic @'NamedSchema'@ creator.
690680--
691681-- Unlike 'genericDeclareNamedSchema' also works for mixed sum types.
692682-- Use with care since some Swagger tools do not support well schemas for mixed sum types.
693−genericDeclareNamedSchemaUnrestricted :: forall a. (Generic a, GToSchema (Rep a)) =>
694− SchemaOptions -> Proxy a -> Declare (Definitions Schema) NamedSchema
683+genericDeclareNamedSchemaUnrestricted :: forall a proxy. (Generic a, GToSchema (Rep a)) =>
684+ SchemaOptions -> proxy a -> Declare (Definitions Schema) NamedSchema
695685genericDeclareNamedSchemaUnrestricted opts _ = gdeclareNamedSchema opts (Proxy :: Proxy (Rep a)) mempty
696686
697687-- | Derive a 'Generic'-based name for a datatype and assign it to a given 'Schema'.
698−genericNameSchema :: forall a d f.
688+genericNameSchema :: forall a d f proxy.
699689 (Generic a, Rep a ~ D1 d f, Datatype d)
700− => SchemaOptions -> Proxy a -> Schema -> NamedSchema
690+ => SchemaOptions -> proxy a -> Schema -> NamedSchema
701691genericNameSchema opts _ = NamedSchema (gdatatypeSchemaName opts (Proxy :: Proxy d))
702692
703−gdatatypeSchemaName :: forall d. Datatype d => SchemaOptions -> Proxy d -> Maybe T.Text
693+gdatatypeSchemaName :: forall proxy d. Datatype d => SchemaOptions -> proxy d -> Maybe T.Text
704694gdatatypeSchemaName opts _ = case orig of
705695 (c:_) | isAlpha c && isUpper c -> Just (T.pack name)
706696 _ -> Nothing
@@ -709,23 +699,24 @@ gdatatypeSchemaName opts _ = case orig of
709699 name = datatypeNameModifier opts orig
710700
711701-- | Lift a plain @'ParamSchema'@ into a model @'NamedSchema'@.
712−paramSchemaToNamedSchema :: (ToParamSchema a, Generic a, Rep a ~ D1 d f, Datatype d) =>
713− SchemaOptions -> Proxy a -> NamedSchema
702+paramSchemaToNamedSchema :: forall a d f proxy.
703+ (ToParamSchema a, Generic a, Rep a ~ D1 d f, Datatype d)
704+ => SchemaOptions -> proxy a -> NamedSchema
714705paramSchemaToNamedSchema opts proxy = genericNameSchema opts proxy (paramSchemaToSchema proxy)
715706
716707-- | Lift a plain @'ParamSchema'@ into a model @'Schema'@.
717−paramSchemaToSchema :: ToParamSchema a => Proxy a -> Schema
718−paramSchemaToSchema proxy = mempty & paramSchema .~ toParamSchema proxy
708+paramSchemaToSchema :: forall a proxy. ToParamSchema a => proxy a -> Schema
709+paramSchemaToSchema _ = mempty & paramSchema .~ toParamSchema (Proxy :: Proxy a)
719710
720711nullarySchema :: Schema
721712nullarySchema = mempty
722− & type_ ?~ SwaggerArray
713+ & type_ .~ SwaggerArray
723714 & items ?~ SwaggerItemsArray []
724715
725−gtoNamedSchema :: GToSchema f => SchemaOptions -> Proxy f -> NamedSchema
716+gtoNamedSchema :: GToSchema f => SchemaOptions -> proxy f -> NamedSchema
726717gtoNamedSchema opts proxy = undeclare $ gdeclareNamedSchema opts proxy mempty
727718
728−gdeclareSchema :: GToSchema f => SchemaOptions -> Proxy f -> Declare (Definitions Schema) Schema
719+gdeclareSchema :: GToSchema f => SchemaOptions -> proxy f -> Declare (Definitions Schema) Schema
729720gdeclareSchema opts proxy = _namedSchemaSchema <$> gdeclareNamedSchema opts proxy mempty
730721
731722instance (GToSchema f, GToSchema g) => GToSchema (f :*: g) where
@@ -759,7 +750,7 @@ instance (Selector s, GToSchema f, GToSchema (S1 s f)) => GToSchema (C1 c (S1 s
759750 recordSchema = gdeclareNamedSchema opts (Proxy :: Proxy (S1 s f)) s
760751 fieldSchema = gdeclareNamedSchema opts (Proxy :: Proxy f) s
761752
762−gdeclareSchemaRef :: GToSchema a => SchemaOptions -> Proxy a -> Declare (Definitions Schema) (Referenced Schema)
753+gdeclareSchemaRef :: GToSchema a => SchemaOptions -> proxy a -> Declare (Definitions Schema) (Referenced Schema)
763754gdeclareSchemaRef opts proxy = do
764755 case gtoNamedSchema opts proxy of
765756 NamedSchema (Just name) schema -> do
@@ -790,12 +781,12 @@ withFieldSchema opts _ isRequiredField schema = do
790781 return $
791782 if T.null fname
792783 then schema
793− & type_ ?~ SwaggerArray
784+ & type_ .~ SwaggerArray
794785 & items %~ appendItem ref
795786 & maxItems %~ Just . maybe 1 (+1) -- increment maxItems
796787 & minItems %~ Just . maybe 1 (+1) -- increment minItems
797788 else schema
798− & type_ ?~ SwaggerObject
789+ & type_ .~ SwaggerObject
799790 & properties . at fname ?~ ref
800791 & if isRequiredField
801792 then required %~ (++ [fname])
@@ -823,7 +814,7 @@ instance ( GSumToSchema f
823814 where
824815 gdeclareNamedSchema = gdeclareNamedSumSchema
825816
826−gdeclareNamedSumSchema :: GSumToSchema f => SchemaOptions -> Proxy f -> Schema -> Declare (Definitions Schema) NamedSchema
817+gdeclareNamedSumSchema :: GSumToSchema f => SchemaOptions -> proxy f -> Schema -> Declare (Definitions Schema) NamedSchema
827818gdeclareNamedSumSchema opts proxy s
828819 | allNullaryToStringTag opts && allNullary = pure $ unnamed (toStringTag sumSchema)
829820 | otherwise = (unnamed . fst) <$> runWriterT declareSumSchema
@@ -832,29 +823,29 @@ gdeclareNamedSumSchema opts proxy s
832823 (sumSchema, All allNullary) = undeclare (runWriterT declareSumSchema)
833824
834825 toStringTag schema = mempty
835− & type_ ?~ SwaggerString
826+ & type_ .~ SwaggerString
836827 & enum_ ?~ map toJSON (schema ^.. properties.ifolded.asIndex)
837828
838829type AllNullary = All
839830
840831class GSumToSchema (f :: * -> *) where
841− gsumToSchema :: SchemaOptions -> Proxy f -> Schema -> WriterT AllNullary (Declare (Definitions Schema)) Schema
832+ gsumToSchema :: SchemaOptions -> proxy f -> Schema -> WriterT AllNullary (Declare (Definitions Schema)) Schema
842833
843834instance (GSumToSchema f, GSumToSchema g) => GSumToSchema (f :+: g) where
844835 gsumToSchema opts _ = gsumToSchema opts (Proxy :: Proxy f) >=> gsumToSchema opts (Proxy :: Proxy g)
845836
846−gsumConToSchemaWith :: forall c f. (GToSchema (C1 c f), Constructor c) =>
847− Referenced Schema -> SchemaOptions -> Proxy (C1 c f) -> Schema -> Schema
837+gsumConToSchemaWith :: forall c f proxy. (GToSchema (C1 c f), Constructor c) =>
838+ Referenced Schema -> SchemaOptions -> proxy (C1 c f) -> Schema -> Schema
848839gsumConToSchemaWith ref opts _ schema = schema
849− & type_ ?~ SwaggerObject
840+ & type_ .~ SwaggerObject
850841 & properties . at tag ?~ ref
851842 & maxProperties ?~ 1
852843 & minProperties ?~ 1
853844 where
854845 tag = T.pack (constructorTagModifier opts (conName (Proxy3 :: Proxy3 c f p)))
855846
856−gsumConToSchema :: (GToSchema (C1 c f), Constructor c) =>
857− SchemaOptions -> Proxy (C1 c f) -> Schema -> Declare (Definitions Schema) Schema
847+gsumConToSchema :: forall c f proxy. (GToSchema (C1 c f), Constructor c) =>
848+ SchemaOptions -> proxy (C1 c f) -> Schema -> Declare (Definitions Schema) Schema
858849gsumConToSchema opts proxy schema = do
859850 ref <- gdeclareSchemaRef opts proxy
860851 return $ gsumConToSchemaWith ref opts proxy schema