git.iko.soy/typeable/swagger2
on master help sign in
Merge ParamType/ItemsType/SchemaType into SwaggerType
commitf9c8629d780d625e4d7e33c843ff0aaba78a15aa authorNickolay Kudasov <nickolay.kudasov@gmail.com> dateTue 8 Dec 2015, 19:06 (11 years ago) parent352f68c
7 files changed+101−96
src/Data/Swagger.hs+1−3 src/Data/Swagger/Internal.hs+38−39 src/Data/Swagger/Internal/Param.hs+10−10 src/Data/Swagger/Internal/Schema.hs+18−18 src/Data/Swagger/Internal/Utils.hs+8 src/Data/Swagger/Lens.hs+4−4 test/Data/SwaggerSpec.hs+22−22
src/Data/Swagger.hs+1−3
@@ -27,9 +27,7 @@ module Data.Swagger (
2727 Operation(..),
2828
2929 -- * Types and formats
30− ParamType(..),
31− ItemsType(..),
32− SchemaType(..),
30+ SwaggerType(..),
3331 Format,
3432 CollectionFormat(..),
3533 ItemsCollectionFormat(..),
src/Data/Swagger/Internal.hs+38−39
@@ -1,6 +1,7 @@
11{-# LANGUAGE DeriveGeneric #-}
22{-# LANGUAGE DeriveTraversable #-}
33{-# LANGUAGE FlexibleInstances #-}
4+{-# LANGUAGE GADTs #-}
45{-# LANGUAGE GeneralizedNewtypeDeriving #-}
56{-# LANGUAGE OverloadedStrings #-}
67{-# LANGUAGE RecordWildCards #-}
@@ -293,17 +294,21 @@ data ParamOtherSchema = ParamOtherSchema
293294 -- Default value is csv.
294295 , _paramOtherSchemaCollectionFormat :: Maybe CollectionFormat
295296
296− , _paramOtherSchemaCommon :: SchemaCommon ParamType Items
297+ , _paramOtherSchemaCommon :: SchemaCommon (SwaggerType Param) Items
297298 } deriving (Eq, Show, Generic)
298299
299−data ParamType
300− = ParamString
301− | ParamNumber
302− | ParamInteger
303− | ParamBoolean
304− | ParamArray
305− | ParamFile
306− deriving (Eq, Show)
300+data SwaggerType t where
301+ SwaggerString :: SwaggerType t
302+ SwaggerNumber :: SwaggerType t
303+ SwaggerInteger :: SwaggerType t
304+ SwaggerBoolean :: SwaggerType t
305+ SwaggerArray :: SwaggerType t
306+ SwaggerFile :: SwaggerType Param
307+ SwaggerNull :: SwaggerType Schema
308+ SwaggerObject :: SwaggerType Schema
309+
310+deriving instance Eq (SwaggerType t)
311+deriving instance Show (SwaggerType t)
307312
308313data ParamLocation
309314 = -- | Parameters that are appended to the URL.
@@ -338,24 +343,6 @@ data CollectionFormat
338343 -- This is valid only for parameters in @'ParamQuery'@ or @'ParamFormData'@.
339344 deriving (Eq, Show)
340345
341−data ItemsType
342− = ItemsString
343− | ItemsNumber
344− | ItemsInteger
345− | ItemsBoolean
346− | ItemsArray
347− deriving (Eq, Show)
348−
349−data SchemaType
350− = SchemaArray
351− | SchemaBoolean
352− | SchemaInteger
353− | SchemaNumber
354− | SchemaNull
355− | SchemaObject
356− | SchemaString
357− deriving (Eq, Show)
358−
359346-- | Determines the format of the nested array.
360347data ItemsCollectionFormat
361348 = ItemsCollectionCSV -- ^ Comma separated values: @foo,bar@.
@@ -384,7 +371,7 @@ data Schema = Schema
384371 , _schemaMaxProperties :: Maybe Integer
385372 , _schemaMinProperties :: Maybe Integer
386373
387− , _schemaSchemaCommon :: SchemaCommon SchemaType SchemaItems
374+ , _schemaSchemaCommon :: SchemaCommon (SwaggerType Schema) SchemaItems
388375 } deriving (Eq, Show, Generic)
389376
390377data SchemaItems
@@ -450,7 +437,7 @@ data Items = Items
450437 -- Default value is @'ItemsCollectionCSV'@.
451438 _itemsCollectionFormat :: Maybe ItemsCollectionFormat
452439
453− , _itemsCommon :: SchemaCommon ItemsType Items
440+ , _itemsCommon :: SchemaCommon (SwaggerType Items) Items
454441 } deriving (Eq, Show, Generic)
455442
456443-- | A container for the expected responses of an operation.
@@ -500,7 +487,7 @@ data Header = Header
500487 -- Default value is @'ItemsCollectionCSV'@.
501488 , _headerCollectionFormat :: Maybe ItemsCollectionFormat
502489
503− , _headerCommon :: SchemaCommon ItemsType Items
490+ , _headerCommon :: SchemaCommon (SwaggerType Items) Items
504491 } deriving (Eq, Show, Generic)
505492
506493data Example = Example { getExample :: Map MediaType Value }
@@ -669,12 +656,8 @@ instance SwaggerMonoid Operation
669656instance SwaggerMonoid MimeList
670657deriving instance SwaggerMonoid URL
671658
672−instance SwaggerMonoid SchemaType where
673− swaggerMempty = SchemaNull
674− swaggerMappend _ y = y
675−
676−instance SwaggerMonoid ParamType where
677− swaggerMempty = ParamString
659+instance SwaggerMonoid (SwaggerType t) where
660+ swaggerMempty = SwaggerString
678661 swaggerMappend _ y = y
679662
680663instance SwaggerMonoid ParamLocation where
@@ -729,12 +712,9 @@ instance SwaggerMonoid ParamSchema where
729712-- =======================================================================
730713
731714deriveJSON (jsonPrefix "Param") ''ParamLocation
732−deriveJSON (jsonPrefix "Param") ''ParamType
733715deriveJSON' ''Info
734716deriveJSON' ''Contact
735717deriveJSON' ''License
736−deriveJSON (jsonPrefix "Schema") ''SchemaType
737−deriveJSON (jsonPrefix "Items") ''ItemsType
738718deriveJSON (jsonPrefix "ItemsCollection") ''ItemsCollectionFormat
739719deriveJSON (jsonPrefix "Collection") ''CollectionFormat
740720deriveJSON (jsonPrefix "ApiKey") ''ApiKeyLocation
@@ -838,6 +818,16 @@ instance ToJSON a => ToJSON (Referenced a) where
838818 toJSON (Ref ref) = toJSON ref
839819 toJSON (Inline x) = toJSON x
840820
821+instance ToJSON (SwaggerType t) where
822+ toJSON SwaggerArray = "array"
823+ toJSON SwaggerString = "string"
824+ toJSON SwaggerInteger = "integer"
825+ toJSON SwaggerNumber = "number"
826+ toJSON SwaggerBoolean = "boolean"
827+ toJSON SwaggerFile = "file"
828+ toJSON SwaggerNull = "null"
829+ toJSON SwaggerObject = "object"
830+
841831-- =======================================================================
842832-- Manual FromJSON instances
843833-- =======================================================================
@@ -970,3 +960,12 @@ instance FromJSON a => FromJSON (Referenced a) where
970960instance FromJSON Xml where
971961 parseJSON = genericParseJSON (jsonPrefix "xml")
972962
963+instance FromJSON (SwaggerType Schema) where
964+ parseJSON = parseOneOf [SwaggerString, SwaggerInteger, SwaggerNumber, SwaggerBoolean, SwaggerArray, SwaggerNull, SwaggerObject]
965+
966+instance FromJSON (SwaggerType Param) where
967+ parseJSON = parseOneOf [SwaggerString, SwaggerInteger, SwaggerNumber, SwaggerBoolean, SwaggerArray, SwaggerFile]
968+
969+instance FromJSON (SwaggerType Items) where
970+ parseJSON = parseOneOf [SwaggerString, SwaggerInteger, SwaggerNumber, SwaggerBoolean, SwaggerArray]
971+
src/Data/Swagger/Internal/Param.hs+10−10
@@ -34,17 +34,17 @@ class ToParamSchema a where
3434instance {-# OVERLAPPING #-} ToParamSchema String where
3535 toParamSchema _ loc = mempty
3636 & paramOtherSchemaIn .~ loc
37− & schemaType .~ ParamString
37+ & schemaType .~ SwaggerString
3838
3939instance ToParamSchema Bool where
4040 toParamSchema _ loc = mempty
4141 & paramOtherSchemaIn .~ loc
42− & schemaType .~ ParamBoolean
42+ & schemaType .~ SwaggerBoolean
4343
4444instance ToParamSchema Integer where
4545 toParamSchema _ loc = mempty
4646 & paramOtherSchemaIn .~ loc
47− & schemaType .~ ParamInteger
47+ & schemaType .~ SwaggerInteger
4848
4949instance ToParamSchema Int where toParamSchema = toParamSchemaBoundedIntegral
5050instance ToParamSchema Int8 where toParamSchema = toParamSchemaBoundedIntegral
@@ -61,36 +61,36 @@ instance ToParamSchema Word64 where toParamSchema = toParamSchemaBoundedIntegral
6161toParamSchemaBoundedIntegral :: forall proxy a. (Bounded a, Integral a) => proxy a -> ParamLocation -> ParamOtherSchema
6262toParamSchemaBoundedIntegral _ loc = mempty
6363 & paramOtherSchemaIn .~ loc
64− & schemaType .~ ParamInteger
64+ & schemaType .~ SwaggerInteger
6565 & schemaMinimum ?~ fromInteger (toInteger (minBound :: a))
6666 & schemaMaximum ?~ fromInteger (toInteger (maxBound :: a))
6767
6868instance ToParamSchema Char where
6969 toParamSchema _ loc = mempty
7070 & paramOtherSchemaIn .~ loc
71− & schemaType .~ ParamString
71+ & schemaType .~ SwaggerString
7272 & schemaMaxLength ?~ 1
7373 & schemaMinLength ?~ 1
7474
7575instance ToParamSchema Scientific where
7676 toParamSchema _ loc = mempty
7777 & paramOtherSchemaIn .~ loc
78− & schemaType .~ ParamNumber
78+ & schemaType .~ SwaggerNumber
7979
8080instance ToParamSchema Double where
8181 toParamSchema _ loc = mempty
8282 & paramOtherSchemaIn .~ loc
83− & schemaType .~ ParamNumber
83+ & schemaType .~ SwaggerNumber
8484
8585instance ToParamSchema Float where
8686 toParamSchema _ loc = mempty
8787 & paramOtherSchemaIn .~ loc
88− & schemaType .~ ParamNumber
88+ & schemaType .~ SwaggerNumber
8989
9090timeParamSchema :: String -> ParamLocation -> ParamOtherSchema
9191timeParamSchema format loc = mempty
9292 & paramOtherSchemaIn .~ loc
93− & schemaType .~ ParamString
93+ & schemaType .~ SwaggerString
9494 & schemaFormat ?~ T.pack format
9595 & schemaMinLength ?~ toInteger (length format)
9696
@@ -162,7 +162,7 @@ instance (GEnumParamSchema f, GEnumParamSchema g) => GEnumParamSchema (f :+: g)
162162instance Constructor c => GEnumParamSchema (C1 c U1) where
163163 genumParamSchema opts _ loc s = s
164164 & paramOtherSchemaIn .~ loc
165− & schemaType .~ ParamString
165+ & schemaType .~ SwaggerString
166166 & schemaEnum %~ addEnumValue tag
167167 where
168168 tag = toJSON (constructorTagModifier opts (conName (Proxy3 :: Proxy3 c f p)))
src/Data/Swagger/Internal/Schema.hs+18−18
@@ -58,7 +58,7 @@ named name schema = (Just name, schema)
5858--
5959-- instance ToSchema Coord where
6060-- toNamedSchema = (Just \"Coord\", mempty
61−-- & schemaType .~ SchemaObject
61+-- & schemaType .~ SwaggerObject
6262-- & schemaProperties .~
6363-- [ ("x", toSchemaRef (Proxy :: Proxy Double))
6464-- , ("y", toSchemaRef (Proxy :: Proxy Double))
@@ -113,17 +113,17 @@ gtoSchema opts proxy = snd . gtoNamedSchema opts proxy
113113
114114instance {-# OVERLAPPABLE #-} ToSchema a => ToSchema [a] where
115115 toNamedSchema _ = unnamed $ mempty
116− & schemaType .~ SchemaArray
116+ & schemaType .~ SwaggerArray
117117 & schemaItems ?~ SchemaItemsObject (toSchemaRef (Proxy :: Proxy a))
118118
119119instance {-# OVERLAPPING #-} ToSchema String where
120− toNamedSchema _ = unnamed $ mempty & schemaType .~ SchemaString
120+ toNamedSchema _ = unnamed $ mempty & schemaType .~ SwaggerString
121121
122122instance ToSchema Bool where
123− toNamedSchema _ = unnamed $ mempty & schemaType .~ SchemaBoolean
123+ toNamedSchema _ = unnamed $ mempty & schemaType .~ SwaggerBoolean
124124
125125instance ToSchema Integer where
126− toNamedSchema _ = unnamed $ mempty & schemaType .~ SchemaInteger
126+ toNamedSchema _ = unnamed $ mempty & schemaType .~ SwaggerInteger
127127
128128instance ToSchema Int where toNamedSchema = unnamed . toSchemaBoundedIntegral
129129instance ToSchema Int8 where toNamedSchema = unnamed . toSchemaBoundedIntegral
@@ -139,18 +139,18 @@ instance ToSchema Word64 where toNamedSchema = unnamed . toSchemaBoundedIntegral
139139
140140instance ToSchema Char where
141141 toNamedSchema _ = unnamed $ mempty
142− & schemaType .~ SchemaString
142+ & schemaType .~ SwaggerString
143143 & schemaMaxLength ?~ 1
144144 & schemaMinLength ?~ 1
145145
146146instance ToSchema Scientific where
147− toNamedSchema _ = unnamed $ mempty & schemaType .~ SchemaNumber
147+ toNamedSchema _ = unnamed $ mempty & schemaType .~ SwaggerNumber
148148
149149instance ToSchema Double where
150− toNamedSchema _ = unnamed $ mempty & schemaType .~ SchemaNumber
150+ toNamedSchema _ = unnamed $ mempty & schemaType .~ SwaggerNumber
151151
152152instance ToSchema Float where
153− toNamedSchema _ = unnamed $ mempty & schemaType .~ SchemaNumber
153+ toNamedSchema _ = unnamed $ mempty & schemaType .~ SwaggerNumber
154154
155155instance ToSchema a => ToSchema (Maybe a) where
156156 toNamedSchema _ = unnamed $ toSchema (Proxy :: Proxy a)
@@ -167,7 +167,7 @@ instance (ToSchema a, ToSchema b, ToSchema c, ToSchema d, ToSchema e, ToSchema f
167167
168168timeNamedSchema :: String -> String -> NamedSchema
169169timeNamedSchema name format = (Just name, mempty
170− & schemaType .~ SchemaString
170+ & schemaType .~ SwaggerString
171171 & schemaFormat ?~ T.pack format
172172 & schemaMinLength ?~ toInteger (length format))
173173
@@ -188,7 +188,7 @@ instance ToSchema LocalTime where
188188-- Just "yyyy-mm-ddThh:MM:ss(Z|+hh:MM)"
189189instance ToSchema ZonedTime where
190190 toNamedSchema _ = (Just "ZonedTime", mempty
191− & schemaType .~ SchemaString
191+ & schemaType .~ SwaggerString
192192 & schemaFormat ?~ "yyyy-mm-ddThh:MM:ss(Z|+hh:MM)"
193193 & schemaMinLength ?~ toInteger (length ("yyyy-mm-ddThh:MM:ssZ" :: String)))
194194
@@ -215,7 +215,7 @@ instance ToSchema a => ToSchema (IntMap a) where
215215
216216instance ToSchema a => ToSchema (Map String a) where
217217 toNamedSchema _ = unnamed $ mempty
218− & schemaType .~ SchemaObject
218+ & schemaType .~ SwaggerObject
219219 & schemaAdditionalProperties ?~ toSchema (Proxy :: Proxy a)
220220
221221instance ToSchema a => ToSchema (Map T.Text a) where toNamedSchema _ = unnamed $ toSchema (Proxy :: Proxy (Map String a))
@@ -295,7 +295,7 @@ defaultSchemaOptions = SchemaOptions
295295-- | Default schema for @'Bounded'@, @'Integral'@ types.
296296toSchemaBoundedIntegral :: forall a proxy. (Bounded a, Integral a) => proxy a -> Schema
297297toSchemaBoundedIntegral _ = mempty
298− & schemaType .~ SchemaInteger
298+ & schemaType .~ SwaggerInteger
299299 & schemaMinimum ?~ fromInteger (toInteger (minBound :: a))
300300 & schemaMaximum ?~ fromInteger (toInteger (maxBound :: a))
301301
@@ -327,7 +327,7 @@ gdatatypeSchemaName opts _ = case name of
327327
328328nullarySchema :: Schema
329329nullarySchema = mempty
330− & schemaType .~ SchemaArray
330+ & schemaType .~ SwaggerArray
331331 & schemaEnum ?~ [ toJSON () ]
332332
333333instance GToSchema U1 where
@@ -370,10 +370,10 @@ appendItem _ _ = error "GToSchema.appendItem: cannot append to SchemaItemsObject
370370withFieldSchema :: forall proxy s f. (Selector s, GToSchema f) => SchemaOptions -> proxy s f -> Bool -> Schema -> Schema
371371withFieldSchema opts _ isRequiredField schema
372372 | T.null fieldName = schema
373− & schemaType .~ SchemaArray
373+ & schemaType .~ SwaggerArray
374374 & schemaItems %~ appendItem fieldSchemaRef
375375 | otherwise = schema
376− & schemaType .~ SchemaObject
376+ & schemaType .~ SwaggerObject
377377 & schemaProperties . at fieldName ?~ fieldSchemaRef
378378 & if isRequiredField
379379 then schemaRequired %~ (fieldName :)
@@ -401,7 +401,7 @@ instance (GSumToSchema f, GSumToSchema g) => GToSchema (f :+: g) where
401401 (All allNullary, sumSchema) = gsumToSchema opts (Proxy :: Proxy (f :+: g)) s
402402
403403 toStringTag schema = mempty
404− & schemaType .~ SchemaString
404+ & schemaType .~ SwaggerString
405405 & schemaEnum ?~ map toJSON (schema ^.. schemaProperties.ifolded.asIndex)
406406
407407type AllNullary = All
@@ -420,7 +420,7 @@ instance (GSumToSchema f, GSumToSchema g) => GSumToSchema (f :+: g) where
420420gsumConToSchema :: forall c f proxy. Constructor c =>
421421 Bool -> Referenced Schema -> SchemaOptions -> proxy (C1 c f) -> Schema -> (AllNullary, Schema)
422422gsumConToSchema isNullary tagSchemaRef opts _ schema = (All isNullary, schema
423− & schemaType .~ SchemaObject
423+ & schemaType .~ SwaggerObject
424424 & schemaProperties . at tag ?~ tagSchemaRef
425425 & schemaMaxProperties ?~ 1
426426 & schemaMinProperties ?~ 1)
src/Data/Swagger/Internal/Utils.hs+8
@@ -52,6 +52,14 @@ deriveJSONDefault = deriveJSON (jsonPrefix "")
5252deriveJSON' :: Name -> Q [Dec]
5353deriveJSON' name = deriveJSON (jsonPrefix (nameBase name)) name
5454
55+parseOneOf :: ToJSON a => [a] -> Value -> Parser a
56+parseOneOf xs js =
57+ case lookup js ys of
58+ Nothing -> fail $ "invalid json: " ++ show js ++ " (expected one of " ++ show (map fst ys) ++ ")"
59+ Just x -> pure x
60+ where
61+ ys = zip (map toJSON xs) xs
62+
5563genericToJSONWithSub :: (Generic a, GToJSON (Rep a)) => Text -> Options -> a -> Value
5664genericToJSONWithSub sub opts x =
5765 case genericToJSON opts x of
src/Data/Swagger/Lens.hs+4−4
@@ -60,10 +60,10 @@ instance HasDescription ExternalDocs (Maybe Text) where description = external
6060class HasSchemaCommon s t i | s -> t i where
6161 schemaCommon :: Lens' s (SchemaCommon t i)
6262
63−instance HasSchemaCommon Schema SchemaType SchemaItems where schemaCommon = schemaSchemaCommon
64−instance HasSchemaCommon ParamOtherSchema ParamType Items where schemaCommon = paramOtherSchemaCommon
65−instance HasSchemaCommon Items ItemsType Items where schemaCommon = itemsCommon
66−instance HasSchemaCommon Header ItemsType Items where schemaCommon = headerCommon
63+instance HasSchemaCommon Schema (SwaggerType Schema) SchemaItems where schemaCommon = schemaSchemaCommon
64+instance HasSchemaCommon ParamOtherSchema (SwaggerType Param) Items where schemaCommon = paramOtherSchemaCommon
65+instance HasSchemaCommon Items (SwaggerType Items) Items where schemaCommon = itemsCommon
66+instance HasSchemaCommon Header (SwaggerType Items) Items where schemaCommon = headerCommon
6767instance HasSchemaCommon (SchemaCommon t i) t i where schemaCommon = id
6868
6969schemaType :: HasSchemaCommon s t i => Lens' s t
test/Data/SwaggerSpec.hs+22−22
@@ -154,7 +154,7 @@ operationExample = mempty
154154 stringSchema :: ParamLocation -> ParamOtherSchema
155155 stringSchema i = mempty
156156 & paramOtherSchemaIn .~ i
157− & schemaType .~ ParamString
157+ & schemaType .~ SwaggerString
158158
159159operationExampleJSON :: Value
160160operationExampleJSON = [aesonQQ|
@@ -220,7 +220,7 @@ operationExampleJSON = [aesonQQ|
220220
221221schemaPrimitiveExample :: Schema
222222schemaPrimitiveExample = mempty
223− & schemaType .~ SchemaString
223+ & schemaType .~ SwaggerString
224224 & schemaFormat ?~ "email"
225225
226226schemaPrimitiveExampleJSON :: Value
@@ -233,14 +233,14 @@ schemaPrimitiveExampleJSON = [aesonQQ|
233233
234234schemaSimpleModelExample :: Schema
235235schemaSimpleModelExample = mempty
236− & schemaType .~ SchemaObject
236+ & schemaType .~ SwaggerObject
237237 & schemaRequired .~ [ "name" ]
238238 & schemaProperties .~
239− [ ("name", Inline (mempty & schemaType .~ SchemaString))
239+ [ ("name", Inline (mempty & schemaType .~ SwaggerString))
240240 , ("address", Ref (Reference "#/definitions/Address"))
241241 , ("age", Inline $ mempty
242242 & schemaMinimum ?~ 0
243− & schemaType .~ SchemaInteger
243+ & schemaType .~ SwaggerInteger
244244 & schemaFormat ?~ "int32" ) ]
245245
246246schemaSimpleModelExampleJSON :: Value
@@ -268,8 +268,8 @@ schemaSimpleModelExampleJSON = [aesonQQ|
268268
269269schemaModelDictExample :: Schema
270270schemaModelDictExample = mempty
271− & schemaType .~ SchemaObject
272− & schemaAdditionalProperties ?~ (mempty & schemaType .~ SchemaString)
271+ & schemaType .~ SwaggerObject
272+ & schemaAdditionalProperties ?~ (mempty & schemaType .~ SwaggerString)
273273
274274schemaModelDictExampleJSON :: Value
275275schemaModelDictExampleJSON = [aesonQQ|
@@ -282,12 +282,12 @@ schemaModelDictExampleJSON = [aesonQQ|
282282|]
283283
284284schemaWithExampleExample :: Schema
285−schemaWithExampleExample = (mempty & schemaType .~ SchemaObject)
285+schemaWithExampleExample = (mempty & schemaType .~ SwaggerObject)
286286 { _schemaProperties =
287287 [ ("id", Inline $ mempty
288− & schemaType .~ SchemaInteger
288+ & schemaType .~ SwaggerInteger
289289 & schemaFormat ?~ "int64" )
290− , ("name", Inline (mempty & schemaType .~ SchemaString)) ]
290+ , ("name", Inline (mempty & schemaType .~ SwaggerString)) ]
291291 , _schemaRequired = [ "name" ]
292292 , _schemaExample = Just [aesonQQ|
293293 {
@@ -326,19 +326,19 @@ schemaWithExampleExampleJSON = [aesonQQ|
326326definitionsExample :: HashMap Text Schema
327327definitionsExample =
328328 [ ("Category", mempty
329− & schemaType .~ SchemaObject
329+ & schemaType .~ SwaggerObject
330330 & schemaProperties .~
331331 [ ("id", Inline $ mempty
332− & schemaType .~ SchemaInteger
332+ & schemaType .~ SwaggerInteger
333333 & schemaFormat ?~ "int64")
334− , ("name", Inline (mempty & schemaType .~ SchemaString)) ] )
334+ , ("name", Inline (mempty & schemaType .~ SwaggerString)) ] )
335335 , ("Tag", mempty
336− & schemaType .~ SchemaObject
336+ & schemaType .~ SwaggerObject
337337 & schemaProperties .~
338338 [ ("id", Inline $ mempty
339− & schemaType .~ SchemaInteger
339+ & schemaType .~ SwaggerInteger
340340 & schemaFormat ?~ "int64")
341− , ("name", Inline (mempty & schemaType .~ SchemaString)) ] ) ]
341+ , ("name", Inline (mempty & schemaType .~ SwaggerString)) ] ) ]
342342
343343definitionsExampleJSON :: Value
344344definitionsExampleJSON = [aesonQQ|
@@ -382,7 +382,7 @@ paramsDefinitionExample =
382382 , _paramRequired = Just True
383383 , _paramSchema = ParamOther $ mempty
384384 & paramOtherSchemaIn .~ ParamQuery
385− & schemaType .~ ParamInteger
385+ & schemaType .~ SwaggerInteger
386386 & schemaFormat ?~ "int32" })
387387 , ("limitParam", mempty
388388 { _paramName = "limit"
@@ -390,7 +390,7 @@ paramsDefinitionExample =
390390 , _paramRequired = Just True
391391 , _paramSchema = ParamOther $ mempty
392392 & paramOtherSchemaIn .~ ParamQuery
393− & schemaType .~ ParamInteger
393+ & schemaType .~ SwaggerInteger
394394 & schemaFormat ?~ "int32" }) ]
395395
396396paramsDefinitionExampleJSON :: Value
@@ -495,7 +495,7 @@ swaggerExample = mempty
495495 { _operationResponses = mempty
496496 { _responsesResponses =
497497 [ (200, Inline mempty
498− { _responseSchema = Just $ Inline (mempty & schemaType .~ SchemaObject)
498+ { _responseSchema = Just $ Inline (mempty & schemaType .~ SwaggerObject)
499499 { _schemaExample = Just [aesonQQ|
500500 {
501501 "created": 100,
@@ -504,9 +504,9 @@ swaggerExample = mempty
504504 , _schemaDescription = Just "This is some real Todo right here"
505505 , _schemaProperties =
506506 [ ("created", Inline $ mempty
507− & schemaType .~ SchemaInteger
507+ & schemaType .~ SwaggerInteger
508508 & schemaFormat ?~ "int32")
509− , ("description", Inline (mempty & schemaType .~ SchemaString)) ] }
509+ , ("description", Inline (mempty & schemaType .~ SwaggerString)) ] }
510510 , _responseDescription = "OK" }) ] }
511511 , _operationProduces = Just (MimeList [ "application/json" ])
512512 , _operationParameters =
@@ -516,7 +516,7 @@ swaggerExample = mempty
516516 , _paramDescription = Just "TodoId param"
517517 , _paramSchema = ParamOther $ mempty
518518 & paramOtherSchemaIn .~ ParamPath
519− & schemaType .~ ParamString } ]
519+ & schemaType .~ SwaggerString } ]
520520 , _operationTags = [ "todo" ] } }) ] } }
521521
522522swaggerExampleJSON :: Value