@@ -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_)
@@ -44,7 +44,7 @@ import qualified Data.HashMap.Strict.InsOrd as InsOrdHashMap
4444import Data.Int
4545import Data.IntSet (IntSet)
4646import Data.IntMap (IntMap)
47−import Data.List.NonEmpty.Compat (NonEmpty)
47+import Data.List.NonEmpty (NonEmpty)
4848import Data.Map (Map)
4949import Data.Proxy
5050import Data.Scientific (Scientific)
@@ -57,8 +57,7 @@ import qualified Data.Vector as V
5757import qualified Data.Vector.Primitive as VP
5858import qualified Data.Vector.Storable as VS
5959import qualified Data.Vector.Unboxed as VU
60−import Data.Version (Version)
61−import Numeric.Natural.Compat (Natural)
60+import Numeric.Natural
6261import Data.Word
6362import GHC.Generics
6463import qualified Data.UUID.Types as UUID
@@ -111,7 +110,7 @@ rename name (NamedSchema _ schema) = NamedSchema name schema
111110-- declareNamedSchema _ = do
112111-- doubleSchema <- declareSchemaRef (Proxy :: Proxy Double)
113112-- return $ NamedSchema (Just \"Coord\") $ mempty
114−-- & type_ ?~ SwaggerObject
113+-- & type_ .~ SwaggerObject
115114-- & properties .~
116115-- [ (\"x\", doubleSchema)
117116-- , (\"y\", doubleSchema)
@@ -142,17 +141,13 @@ class ToSchema a where
142141 -- together with all used definitions.
143142 -- Note that the schema itself is included in definitions
144143 -- only if it is recursive (and thus needs its definition in scope).
145− declareNamedSchema :: Proxy a -> Declare (Definitions Schema) NamedSchema
144+ declareNamedSchema :: proxy a -> Declare (Definitions Schema) NamedSchema
146145 default declareNamedSchema :: (Generic a, GToSchema (Rep a), TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
147− Proxy a -> Declare (Definitions Schema) NamedSchema
146+ proxy a -> Declare (Definitions Schema) NamedSchema
148147 declareNamedSchema = genericDeclareNamedSchema defaultSchemaOptions
149148
150−instance ToSchema TimeOfDay where
151− declareNamedSchema _ = pure $ named "TimeOfDay" $ timeSchema "hh:MM:ss"
152− & example ?~ toJSON (TimeOfDay 12 33 15)
153−
154149-- | Convert a type into a schema and declare all used schema definitions.
155−declareSchema :: ToSchema a => Proxy a -> Declare (Definitions Schema) Schema
150+declareSchema :: ToSchema a => proxy a -> Declare (Definitions Schema) Schema
156151declareSchema = fmap _namedSchemaSchema . declareNamedSchema
157152
158153-- | Convert a type into an optionally named schema.
@@ -166,7 +161,7 @@ declareSchema = fmap _namedSchemaSchema . declareNamedSchema
166161-- Just "Day"
167162-- >>> encode (toNamedSchema (Proxy :: Proxy Day) ^. schema)
168163-- "{\"example\":\"2016-07-22\",\"format\":\"date\",\"type\":\"string\"}"
169−toNamedSchema :: ToSchema a => Proxy a -> NamedSchema
164+toNamedSchema :: ToSchema a => proxy a -> NamedSchema
170165toNamedSchema = undeclare . declareNamedSchema
171166
172167-- | Get type's schema name according to its @'ToSchema'@ instance.
@@ -176,7 +171,7 @@ toNamedSchema = undeclare . declareNamedSchema
176171--
177172-- >>> schemaName (Proxy :: Proxy UTCTime)
178173-- Just "UTCTime"
179−schemaName :: ToSchema a => Proxy a -> Maybe T.Text
174+schemaName :: ToSchema a => proxy a -> Maybe T.Text
180175schemaName = _namedSchemaName . toNamedSchema
181176
182177-- | Convert a type into a schema.
@@ -186,7 +181,7 @@ schemaName = _namedSchemaName . toNamedSchema
186181--
187182-- >>> encode $ toSchema (Proxy :: Proxy [Day])
188183-- "{\"items\":{\"$ref\":\"#/definitions/Day\"},\"type\":\"array\"}"
189−toSchema :: ToSchema a => Proxy a -> Schema
184+toSchema :: ToSchema a => proxy a -> Schema
190185toSchema = _namedSchemaSchema . toNamedSchema
191186
192187-- | Convert a type into a referenced schema if possible.
@@ -197,7 +192,7 @@ toSchema = _namedSchemaSchema . toNamedSchema
197192--
198193-- >>> encode $ toSchemaRef (Proxy :: Proxy Day)
199194-- "{\"$ref\":\"#/definitions/Day\"}"
200−toSchemaRef :: ToSchema a => Proxy a -> Referenced Schema
195+toSchemaRef :: ToSchema a => proxy a -> Referenced Schema
201196toSchemaRef = undeclare . declareSchemaRef
202197
203198-- | Convert a type into a referenced schema if possible
@@ -207,7 +202,7 @@ toSchemaRef = undeclare . declareSchemaRef
207202-- Schema definitions are typically declared for every referenced schema.
208203-- If @'declareSchemaRef'@ returns a reference, a corresponding schema
209204-- will be declared (regardless of whether it is recusive or not).
210−declareSchemaRef :: ToSchema a => Proxy a -> Declare (Definitions Schema) (Referenced Schema)
205+declareSchemaRef :: ToSchema a => proxy a -> Declare (Definitions Schema) (Referenced Schema)
211206declareSchemaRef proxy = do
212207 case toNamedSchema proxy of
213208 NamedSchema (Just name) schema -> do
@@ -269,7 +264,7 @@ inlineAllSchemas = inlineSchemasWhen (const True)
269264--
270265-- __WARNING:__ @'toInlinedSchema'@ will produce infinite schema
271266-- when inlining recursive schemas.
272−toInlinedSchema :: ToSchema a => Proxy a -> Schema
267+toInlinedSchema :: ToSchema a => proxy a -> Schema
273268toInlinedSchema proxy = inlineAllSchemas defs schema
274269 where
275270 (defs, schema) = runDeclare (declareSchema proxy) mempty
@@ -298,20 +293,20 @@ inlineNonRecursiveSchemas defs = inlineSchemasWhen nonRecursive defs
298293-- | Default schema for binary data (any sequence of octets).
299294binarySchema :: Schema
300295binarySchema = mempty
301− & type_ ?~ SwaggerString
296+ & type_ .~ SwaggerString
302297 & format ?~ "binary"
303298
304299-- | Default schema for binary data (base64 encoded).
305300byteSchema :: Schema
306301byteSchema = mempty
307− & type_ ?~ SwaggerString
302+ & type_ .~ SwaggerString
308303 & format ?~ "byte"
309304
310305-- | Default schema for password string.
311306-- @"password"@ format is used to hint UIs the input needs to be obscured.
312307passwordSchema :: Schema
313308passwordSchema = mempty
314− & type_ ?~ SwaggerString
309+ & type_ .~ SwaggerString
315310 & format ?~ "password"
316311
317312-- | Make an unrestrictive sketch of a @'Schema'@ based on a @'ToJSON'@ instance.
@@ -337,12 +332,12 @@ sketchSchema = sketch . toJSON
337332 sketch js@(Bool _) = go js
338333 sketch js = go js & example ?~ js
339334
340− go Null = mempty & type_ ?~ SwaggerNull
341− go (Bool _) = mempty & type_ ?~ SwaggerBoolean
342− go (String _) = mempty & type_ ?~ SwaggerString
343− go (Number _) = mempty & type_ ?~ SwaggerNumber
335+ go Null = mempty & type_ .~ SwaggerNull
336+ go (Bool _) = mempty & type_ .~ SwaggerBoolean
337+ go (String _) = mempty & type_ .~ SwaggerString
338+ go (Number _) = mempty & type_ .~ SwaggerNumber
344339 go (Array xs) = mempty
345− & type_ ?~ SwaggerArray
340+ & type_ .~ SwaggerArray
346341 & items ?~ case ischema of
347342 Just s -> SwaggerItemsObject (Inline s)
348343 _ -> SwaggerItemsArray (map Inline ys)
@@ -354,7 +349,7 @@ sketchSchema = sketch . toJSON
354349 (z:_) | allSame -> Just z
355350 _ -> Nothing
356351 go (Object o) = mempty
357− & type_ ?~ SwaggerObject
352+ & type_ .~ SwaggerObject
358353 & required .~ HashMap.keys o
359354 & properties .~ fmap (Inline . go) (InsOrdHashMap.fromHashMap o)
360355
@@ -377,24 +372,24 @@ sketchSchema = sketch . toJSON
377372sketchStrictSchema :: ToJSON a => a -> Schema
378373sketchStrictSchema = go . toJSON
379374 where
380− go Null = mempty & type_ ?~ SwaggerNull
375+ go Null = mempty & type_ .~ SwaggerNull
381376 go js@(Bool _) = mempty
382− & type_ ?~ SwaggerBoolean
377+ & type_ .~ SwaggerBoolean
383378 & enum_ ?~ [js]
384379 go js@(String s) = mempty
385− & type_ ?~ SwaggerString
380+ & type_ .~ SwaggerString
386381 & maxLength ?~ fromIntegral (T.length s)
387382 & minLength ?~ fromIntegral (T.length s)
388383 & pattern ?~ s
389384 & enum_ ?~ [js]
390385 go js@(Number n) = mempty
391− & type_ ?~ SwaggerNumber
386+ & type_ .~ SwaggerNumber
392387 & maximum_ ?~ n
393388 & minimum_ ?~ n
394389 & multipleOf ?~ n
395390 & enum_ ?~ [js]
396391 go js@(Array xs) = mempty
397− & type_ ?~ SwaggerArray
392+ & type_ .~ SwaggerArray
398393 & maxItems ?~ fromIntegral sz
399394 & minItems ?~ fromIntegral sz
400395 & items ?~ SwaggerItemsArray (map (Inline . go) (V.toList xs))
@@ -404,7 +399,7 @@ sketchStrictSchema = go . toJSON
404399 sz = length xs
405400 allUnique = sz == HashSet.size (HashSet.fromList (V.toList xs))
406401 go js@(Object o) = mempty
407− & type_ ?~ SwaggerObject
402+ & type_ .~ SwaggerObject
408403 & required .~ names
409404 & properties .~ fmap (Inline . go) (InsOrdHashMap.fromHashMap o)
410405 & maxProperties ?~ fromIntegral (length names)
@@ -414,13 +409,13 @@ sketchStrictSchema = go . toJSON
414409 names = HashMap.keys o
415410
416411class GToSchema (f :: * -> *) where
417− gdeclareNamedSchema :: SchemaOptions -> Proxy f -> Schema -> Declare (Definitions Schema) NamedSchema
412+ gdeclareNamedSchema :: SchemaOptions -> proxy f -> Schema -> Declare (Definitions Schema) NamedSchema
418413
419414instance OVERLAPPABLE_ ToSchema a => ToSchema [a] where
420415 declareNamedSchema _ = do
421416 ref <- declareSchemaRef (Proxy :: Proxy a)
422417 return $ unnamed $ mempty
423− & type_ ?~ SwaggerArray
418+ & type_ .~ SwaggerArray
424419 & items ?~ SwaggerItemsObject ref
425420
426421instance OVERLAPPING_ ToSchema String where declareNamedSchema = plain . paramSchemaToSchema
@@ -470,7 +465,7 @@ instance (ToSchema a, ToSchema b, ToSchema c, ToSchema d, ToSchema e, ToSchema f
470465
471466timeSchema :: T.Text -> Schema
472467timeSchema fmt = mempty
473− & type_ ?~ SwaggerString
468+ & type_ .~ SwaggerString
474469 & format ?~ fmt
475470
476471-- | Format @"date"@ corresponds to @yyyy-mm-dd@ format.
@@ -503,8 +498,6 @@ instance ToSchema UTCTime where
503498instance ToSchema T.Text where declareNamedSchema = plain . paramSchemaToSchema
504499instance ToSchema TL.Text where declareNamedSchema = plain . paramSchemaToSchema
505500
506−instance ToSchema Version where declareNamedSchema = plain . paramSchemaToSchema
507−
508501#if __GLASGOW_HASKELL__ < 800
509502#else
510503type family ToSchemaByteStringError bs where
@@ -532,8 +525,8 @@ instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (Map k v) where
532525 declareObjectMapSchema = do
533526 schema <- declareSchemaRef (Proxy :: Proxy v)
534527 return $ unnamed $ mempty
535− & type_ ?~ SwaggerObject
536− & additionalProperties ?~ AdditionalPropertiesSchema schema
528+ & type_ .~ SwaggerObject
529+ & additionalProperties ?~ schema
537530
538531instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (HashMap k v) where
539532 declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map k v))
@@ -544,7 +537,7 @@ instance ToSchema a => ToSchema (Map String a) where
544537 declareNamedSchema _ = do
545538 schema <- declareSchemaRef (Proxy :: Proxy a)
546539 return $ unnamed $ mempty
547− & type_ ?~ SwaggerObject
540+ & type_ .~ SwaggerObject
548541 & additionalProperties ?~ schema
549542
550543instance ToSchema a => ToSchema (Map T.Text a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy (Map String a))
@@ -556,12 +549,6 @@ instance ToSchema a => ToSchema (HashMap TL.Text a) where declareNamedSchema _ =
556549
557550#endif
558551
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−
565552instance ToSchema a => ToSchema (V.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
566553instance ToSchema a => ToSchema (VU.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
567554instance ToSchema a => ToSchema (VS.Vector a) where declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy [a])
@@ -597,26 +584,26 @@ instance ToSchema a => ToSchema (Identity a) where declareNamedSchema _ = declar
597584--
598585-- >>> encode $ toSchemaBoundedIntegral (Proxy :: Proxy Int16)
599586-- "{\"maximum\":32767,\"minimum\":-32768,\"type\":\"integer\"}"
600−toSchemaBoundedIntegral :: forall a. (Bounded a, Integral a) => Proxy a -> Schema
587+toSchemaBoundedIntegral :: forall a proxy. (Bounded a, Integral a) => proxy a -> Schema
601588toSchemaBoundedIntegral _ = mempty
602− & type_ ?~ SwaggerInteger
589+ & type_ .~ SwaggerInteger
603590 & minimum_ ?~ fromInteger (toInteger (minBound :: a))
604591 & maximum_ ?~ fromInteger (toInteger (maxBound :: a))
605592
606593-- | Default generic named schema for @'Bounded'@, @'Integral'@ types.
607−genericToNamedSchemaBoundedIntegral :: forall a d f.
594+genericToNamedSchemaBoundedIntegral :: forall a d f proxy.
608595 ( Bounded a, Integral a
609596 , Generic a, Rep a ~ D1 d f, Datatype d)
610− => SchemaOptions -> Proxy a -> NamedSchema
597+ => SchemaOptions -> proxy a -> NamedSchema
611598genericToNamedSchemaBoundedIntegral opts proxy
612599 = genericNameSchema opts proxy (toSchemaBoundedIntegral proxy)
613600
614601-- | Declare a named schema for a @newtype@ wrapper.
615−genericDeclareNamedSchemaNewtype :: forall a d c s i inner.
602+genericDeclareNamedSchemaNewtype :: forall proxy a d c s i inner.
616603 (Generic a, Datatype d, Rep a ~ D1 d (C1 c (S1 s (K1 i inner))))
617604 => SchemaOptions -- ^ How to derive the name.
618605 -> (Proxy inner -> Declare (Definitions Schema) Schema) -- ^ How to create a schema for the wrapped type.
619− -> Proxy a
606+ -> proxy a
620607 -> Declare (Definitions Schema) NamedSchema
621608genericDeclareNamedSchemaNewtype opts f proxy = genericNameSchema opts proxy <$> f (Proxy :: Proxy inner)
622609
@@ -633,9 +620,9 @@ genericDeclareNamedSchemaNewtype opts f proxy = genericNameSchema opts proxy <$>
633620--
634621-- Note: this is only useful when @key@ is encoded with 'ToJSONKeyText'.
635622-- If it is encoded with 'ToJSONKeyValue' then a regular schema for @[(key, value)]@ is used.
636−declareSchemaBoundedEnumKeyMapping :: forall map key value.
623+declareSchemaBoundedEnumKeyMapping :: forall map key value proxy.
637624 (Bounded key, Enum key, ToJSONKey key, ToSchema key, ToSchema value)
638− => Proxy (map key value) -> Declare (Definitions Schema) Schema
625+ => proxy (map key value) -> Declare (Definitions Schema) Schema
639626declareSchemaBoundedEnumKeyMapping _ = case toJSONKey :: ToJSONKeyFunction key of
640627 ToJSONKeyText keyToText _ -> objectSchema keyToText
641628 ToJSONKeyValue _ _ -> declareSchema (Proxy :: Proxy [(key, value)])
@@ -645,7 +632,7 @@ declareSchemaBoundedEnumKeyMapping _ = case toJSONKey :: ToJSONKeyFunction key o
645632 let allKeys = [minBound..maxBound :: key]
646633 mkPair k = (keyToText k, valueRef)
647634 return $ mempty
648− & type_ ?~ SwaggerObject
635+ & type_ .~ SwaggerObject
649636 & properties .~ InsOrdHashMap.fromList (map mkPair allKeys)
650637
651638-- | A 'Schema' for a mapping with 'Bounded' 'Enum' keys.
@@ -661,46 +648,46 @@ declareSchemaBoundedEnumKeyMapping _ = case toJSONKey :: ToJSONKeyFunction key o
661648--
662649-- Note: this is only useful when @key@ is encoded with 'ToJSONKeyText'.
663650-- If it is encoded with 'ToJSONKeyValue' then a regular schema for @[(key, value)]@ is used.
664−toSchemaBoundedEnumKeyMapping :: forall map key value.
651+toSchemaBoundedEnumKeyMapping :: forall map key value proxy.
665652 (Bounded key, Enum key, ToJSONKey key, ToSchema key, ToSchema value)
666− => Proxy (map key value) -> Schema
653+ => proxy (map key value) -> Schema
667654toSchemaBoundedEnumKeyMapping = flip evalDeclare mempty . declareSchemaBoundedEnumKeyMapping
668655
669656-- | A configurable generic @'Schema'@ creator.
670657genericDeclareSchema :: (Generic a, GToSchema (Rep a), TypeHasSimpleShape a "genericDeclareSchemaUnrestricted") =>
671− SchemaOptions -> Proxy a -> Declare (Definitions Schema) Schema
658+ SchemaOptions -> proxy a -> Declare (Definitions Schema) Schema
672659genericDeclareSchema = genericDeclareSchemaUnrestricted
673660
674661-- | A configurable generic @'NamedSchema'@ creator.
675662-- This function applied to @'defaultSchemaOptions'@
676663-- is used as the default for @'declareNamedSchema'@
677664-- 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
665+genericDeclareNamedSchema :: forall a proxy. (Generic a, GToSchema (Rep a), TypeHasSimpleShape a "genericDeclareNamedSchemaUnrestricted") =>
666+ SchemaOptions -> proxy a -> Declare (Definitions Schema) NamedSchema
680667genericDeclareNamedSchema = genericDeclareNamedSchemaUnrestricted
681668
682669-- | A configurable generic @'Schema'@ creator.
683670--
684671-- Unlike 'genericDeclareSchema' also works for mixed sum types.
685672-- 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
673+genericDeclareSchemaUnrestricted :: (Generic a, GToSchema (Rep a)) => SchemaOptions -> proxy a -> Declare (Definitions Schema) Schema
687674genericDeclareSchemaUnrestricted opts proxy = _namedSchemaSchema <$> genericDeclareNamedSchemaUnrestricted opts proxy
688675
689676-- | A configurable generic @'NamedSchema'@ creator.
690677--
691678-- Unlike 'genericDeclareNamedSchema' also works for mixed sum types.
692679-- 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
680+genericDeclareNamedSchemaUnrestricted :: forall a proxy. (Generic a, GToSchema (Rep a)) =>
681+ SchemaOptions -> proxy a -> Declare (Definitions Schema) NamedSchema
695682genericDeclareNamedSchemaUnrestricted opts _ = gdeclareNamedSchema opts (Proxy :: Proxy (Rep a)) mempty
696683
697684-- | Derive a 'Generic'-based name for a datatype and assign it to a given 'Schema'.
698−genericNameSchema :: forall a d f.
685+genericNameSchema :: forall a d f proxy.
699686 (Generic a, Rep a ~ D1 d f, Datatype d)
700− => SchemaOptions -> Proxy a -> Schema -> NamedSchema
687+ => SchemaOptions -> proxy a -> Schema -> NamedSchema
701688genericNameSchema opts _ = NamedSchema (gdatatypeSchemaName opts (Proxy :: Proxy d))
702689
703−gdatatypeSchemaName :: forall d. Datatype d => SchemaOptions -> Proxy d -> Maybe T.Text
690+gdatatypeSchemaName :: forall proxy d. Datatype d => SchemaOptions -> proxy d -> Maybe T.Text
704691gdatatypeSchemaName opts _ = case orig of
705692 (c:_) | isAlpha c && isUpper c -> Just (T.pack name)
706693 _ -> Nothing
@@ -709,23 +696,24 @@ gdatatypeSchemaName opts _ = case orig of
709696 name = datatypeNameModifier opts orig
710697
711698-- | 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
699+paramSchemaToNamedSchema :: forall a d f proxy.
700+ (ToParamSchema a, Generic a, Rep a ~ D1 d f, Datatype d)
701+ => SchemaOptions -> proxy a -> NamedSchema
714702paramSchemaToNamedSchema opts proxy = genericNameSchema opts proxy (paramSchemaToSchema proxy)
715703
716704-- | Lift a plain @'ParamSchema'@ into a model @'Schema'@.
717−paramSchemaToSchema :: ToParamSchema a => Proxy a -> Schema
718−paramSchemaToSchema proxy = mempty & paramSchema .~ toParamSchema proxy
705+paramSchemaToSchema :: forall a proxy. ToParamSchema a => proxy a -> Schema
706+paramSchemaToSchema _ = mempty & paramSchema .~ toParamSchema (Proxy :: Proxy a)
719707
720708nullarySchema :: Schema
721709nullarySchema = mempty
722− & type_ ?~ SwaggerArray
710+ & type_ .~ SwaggerArray
723711 & items ?~ SwaggerItemsArray []
724712
725−gtoNamedSchema :: GToSchema f => SchemaOptions -> Proxy f -> NamedSchema
713+gtoNamedSchema :: GToSchema f => SchemaOptions -> proxy f -> NamedSchema
726714gtoNamedSchema opts proxy = undeclare $ gdeclareNamedSchema opts proxy mempty
727715
728−gdeclareSchema :: GToSchema f => SchemaOptions -> Proxy f -> Declare (Definitions Schema) Schema
716+gdeclareSchema :: GToSchema f => SchemaOptions -> proxy f -> Declare (Definitions Schema) Schema
729717gdeclareSchema opts proxy = _namedSchemaSchema <$> gdeclareNamedSchema opts proxy mempty
730718
731719instance (GToSchema f, GToSchema g) => GToSchema (f :*: g) where
@@ -759,7 +747,7 @@ instance (Selector s, GToSchema f, GToSchema (S1 s f)) => GToSchema (C1 c (S1 s
759747 recordSchema = gdeclareNamedSchema opts (Proxy :: Proxy (S1 s f)) s
760748 fieldSchema = gdeclareNamedSchema opts (Proxy :: Proxy f) s
761749
762−gdeclareSchemaRef :: GToSchema a => SchemaOptions -> Proxy a -> Declare (Definitions Schema) (Referenced Schema)
750+gdeclareSchemaRef :: GToSchema a => SchemaOptions -> proxy a -> Declare (Definitions Schema) (Referenced Schema)
763751gdeclareSchemaRef opts proxy = do
764752 case gtoNamedSchema opts proxy of
765753 NamedSchema (Just name) schema -> do
@@ -790,12 +778,12 @@ withFieldSchema opts _ isRequiredField schema = do
790778 return $
791779 if T.null fname
792780 then schema
793− & type_ ?~ SwaggerArray
781+ & type_ .~ SwaggerArray
794782 & items %~ appendItem ref
795783 & maxItems %~ Just . maybe 1 (+1) -- increment maxItems
796784 & minItems %~ Just . maybe 1 (+1) -- increment minItems
797785 else schema
798− & type_ ?~ SwaggerObject
786+ & type_ .~ SwaggerObject
799787 & properties . at fname ?~ ref
800788 & if isRequiredField
801789 then required %~ (++ [fname])
@@ -823,7 +811,7 @@ instance ( GSumToSchema f
823811 where
824812 gdeclareNamedSchema = gdeclareNamedSumSchema
825813
826−gdeclareNamedSumSchema :: GSumToSchema f => SchemaOptions -> Proxy f -> Schema -> Declare (Definitions Schema) NamedSchema
814+gdeclareNamedSumSchema :: GSumToSchema f => SchemaOptions -> proxy f -> Schema -> Declare (Definitions Schema) NamedSchema
827815gdeclareNamedSumSchema opts proxy s
828816 | allNullaryToStringTag opts && allNullary = pure $ unnamed (toStringTag sumSchema)
829817 | otherwise = (unnamed . fst) <$> runWriterT declareSumSchema
@@ -832,29 +820,29 @@ gdeclareNamedSumSchema opts proxy s
832820 (sumSchema, All allNullary) = undeclare (runWriterT declareSumSchema)
833821
834822 toStringTag schema = mempty
835− & type_ ?~ SwaggerString
823+ & type_ .~ SwaggerString
836824 & enum_ ?~ map toJSON (schema ^.. properties.ifolded.asIndex)
837825
838826type AllNullary = All
839827
840828class GSumToSchema (f :: * -> *) where
841− gsumToSchema :: SchemaOptions -> Proxy f -> Schema -> WriterT AllNullary (Declare (Definitions Schema)) Schema
829+ gsumToSchema :: SchemaOptions -> proxy f -> Schema -> WriterT AllNullary (Declare (Definitions Schema)) Schema
842830
843831instance (GSumToSchema f, GSumToSchema g) => GSumToSchema (f :+: g) where
844832 gsumToSchema opts _ = gsumToSchema opts (Proxy :: Proxy f) >=> gsumToSchema opts (Proxy :: Proxy g)
845833
846−gsumConToSchemaWith :: forall c f. (GToSchema (C1 c f), Constructor c) =>
847− Referenced Schema -> SchemaOptions -> Proxy (C1 c f) -> Schema -> Schema
834+gsumConToSchemaWith :: forall c f proxy. (GToSchema (C1 c f), Constructor c) =>
835+ Referenced Schema -> SchemaOptions -> proxy (C1 c f) -> Schema -> Schema
848836gsumConToSchemaWith ref opts _ schema = schema
849− & type_ ?~ SwaggerObject
837+ & type_ .~ SwaggerObject
850838 & properties . at tag ?~ ref
851839 & maxProperties ?~ 1
852840 & minProperties ?~ 1
853841 where
854842 tag = T.pack (constructorTagModifier opts (conName (Proxy3 :: Proxy3 c f p)))
855843
856−gsumConToSchema :: (GToSchema (C1 c f), Constructor c) =>
857− SchemaOptions -> Proxy (C1 c f) -> Schema -> Declare (Definitions Schema) Schema
844+gsumConToSchema :: forall c f proxy. (GToSchema (C1 c f), Constructor c) =>
845+ SchemaOptions -> proxy (C1 c f) -> Schema -> Declare (Definitions Schema) Schema
858846gsumConToSchema opts proxy schema = do
859847 ref <- gdeclareSchemaRef opts proxy
860848 return $ gsumConToSchemaWith ref opts proxy schema