@@ -273,10 +273,10 @@ data Param = Param
273 , _paramRequired :: Maybe Bool
273 , _paramRequired :: Maybe Bool
275 -- | Parameter schema.
275 -- | Parameter schema.
276− , _paramSchema :: ParamSchema
276+ , _paramSchema :: ParamAnySchema
277 } deriving (Eq, Show, Generic)
277 } deriving (Eq, Show, Generic)
279−data ParamSchema
279+data ParamAnySchema
280 = ParamBody (Referenced Schema)
280 = ParamBody (Referenced Schema)
281 | ParamOther ParamOtherSchema
281 | ParamOther ParamOtherSchema
282 deriving (Eq, Show)
282 deriving (Eq, Show)
@@ -295,7 +295,7 @@ data ParamOtherSchema = ParamOtherSchema
295 -- Default value is csv.
295 -- Default value is csv.
296 , _paramOtherSchemaCollectionFormat :: Maybe (CollectionFormat Param)
296 , _paramOtherSchemaCollectionFormat :: Maybe (CollectionFormat Param)
298− , _paramOtherSchemaCommon :: SchemaCommon ParamOtherSchema Items
298+ , _paramOtherSchemaParamSchema :: ParamSchema ParamOtherSchema Items
299 } deriving (Eq, Show, Generic)
299 } deriving (Eq, Show, Generic)
301data SwaggerType t where
301data SwaggerType t where
@@ -371,7 +371,7 @@ data Schema = Schema
371 , _schemaMaxProperties :: Maybe Integer
371 , _schemaMaxProperties :: Maybe Integer
372 , _schemaMinProperties :: Maybe Integer
372 , _schemaMinProperties :: Maybe Integer
374− , _schemaSchemaCommon :: SchemaCommon Schema SchemaItems
374+ , _schemaParamSchema :: ParamSchema Schema SchemaItems
375 } deriving (Eq, Show, Generic)
375 } deriving (Eq, Show, Generic)
377data SchemaItems
377data SchemaItems
@@ -379,29 +379,29 @@ data SchemaItems
379 | SchemaItemsArray [Referenced Schema]
379 | SchemaItemsArray [Referenced Schema]
380 deriving (Eq, Show)
380 deriving (Eq, Show)
382−data SchemaCommon t items = SchemaCommon
382+data ParamSchema t items = ParamSchema
383 { -- | Declares the value of the parameter that the server will use if none is provided,
383 { -- | Declares the value of the parameter that the server will use if none is provided,
384 -- for example a @"count"@ to control the number of results per page might default to @100@
384 -- for example a @"count"@ to control the number of results per page might default to @100@
385 -- if not supplied by the client in the request.
385 -- if not supplied by the client in the request.
386 -- (Note: "default" has no meaning for required parameters.)
386 -- (Note: "default" has no meaning for required parameters.)
387 -- Unlike JSON Schema this value MUST conform to the defined type for this parameter.
387 -- Unlike JSON Schema this value MUST conform to the defined type for this parameter.
388− _schemaCommonDefault :: Maybe Value
388+ _paramSchemaDefault :: Maybe Value
390− , _schemaCommonType :: SwaggerType t
390+ , _paramSchemaType :: SwaggerType t
391− , _schemaCommonFormat :: Maybe Format
391+ , _paramSchemaFormat :: Maybe Format
392− , _schemaCommonItems :: Maybe items
392+ , _paramSchemaItems :: Maybe items
393− , _schemaCommonMaximum :: Maybe Scientific
393+ , _paramSchemaMaximum :: Maybe Scientific
394− , _schemaCommonExclusiveMaximum :: Maybe Bool
394+ , _paramSchemaExclusiveMaximum :: Maybe Bool
395− , _schemaCommonMinimum :: Maybe Scientific
395+ , _paramSchemaMinimum :: Maybe Scientific
396− , _schemaCommonExclusiveMinimum :: Maybe Bool
396+ , _paramSchemaExclusiveMinimum :: Maybe Bool
397− , _schemaCommonMaxLength :: Maybe Integer
397+ , _paramSchemaMaxLength :: Maybe Integer
398− , _schemaCommonMinLength :: Maybe Integer
398+ , _paramSchemaMinLength :: Maybe Integer
399− , _schemaCommonPattern :: Maybe Text
399+ , _paramSchemaPattern :: Maybe Text
400− , _schemaCommonMaxItems :: Maybe Integer
400+ , _paramSchemaMaxItems :: Maybe Integer
401− , _schemaCommonMinItems :: Maybe Integer
401+ , _paramSchemaMinItems :: Maybe Integer
402− , _schemaCommonUniqueItems :: Maybe Bool
402+ , _paramSchemaUniqueItems :: Maybe Bool
403− , _schemaCommonEnum :: Maybe [Value]
403+ , _paramSchemaEnum :: Maybe [Value]
404− , _schemaCommonMultipleOf :: Maybe Scientific
404+ , _paramSchemaMultipleOf :: Maybe Scientific
405 } deriving (Eq, Show, Generic)
405 } deriving (Eq, Show, Generic)
407data Xml = Xml
407data Xml = Xml
@@ -437,7 +437,7 @@ data Items = Items
437 -- Default value is @'ItemsCollectionCSV'@.
437 -- Default value is @'ItemsCollectionCSV'@.
438 _itemsCollectionFormat :: Maybe (CollectionFormat Items)
438 _itemsCollectionFormat :: Maybe (CollectionFormat Items)
440− , _itemsCommon :: SchemaCommon Items Items
440+ , _itemsParamSchema :: ParamSchema Items Items
441 } deriving (Eq, Show, Generic)
441 } deriving (Eq, Show, Generic)
443-- | A container for the expected responses of an operation.
443-- | A container for the expected responses of an operation.
@@ -487,7 +487,7 @@ data Header = Header
487 -- Default value is @'ItemsCollectionCSV'@.
487 -- Default value is @'ItemsCollectionCSV'@.
488 , _headerCollectionFormat :: Maybe (CollectionFormat Items)
488 , _headerCollectionFormat :: Maybe (CollectionFormat Items)
490− , _headerCommon :: SchemaCommon Header Items
490+ , _headerParamSchema :: ParamSchema Header Items
491 } deriving (Eq, Show, Generic)
491 } deriving (Eq, Show, Generic)
493data Example = Example { getExample :: Map MediaType Value }
493data Example = Example { getExample :: Map MediaType Value }
@@ -609,7 +609,7 @@ instance Monoid Schema where
609 mempty = genericMempty
609 mempty = genericMempty
610 mappend = genericMappend
610 mappend = genericMappend
612−instance Monoid (SchemaCommon t i) where
612+instance Monoid (ParamSchema t i) where
613 mempty = genericMempty
613 mempty = genericMempty
614 mappend = genericMappend
614 mappend = genericMappend
@@ -645,7 +645,7 @@ instance SwaggerMonoid Info
645instance SwaggerMonoid Paths
645instance SwaggerMonoid Paths
646instance SwaggerMonoid PathItem
646instance SwaggerMonoid PathItem
647instance SwaggerMonoid Schema
647instance SwaggerMonoid Schema
648−instance SwaggerMonoid (SchemaCommon t i)
648+instance SwaggerMonoid (ParamSchema t i)
649instance SwaggerMonoid Param
649instance SwaggerMonoid Param
650instance SwaggerMonoid ParamOtherSchema
650instance SwaggerMonoid ParamOtherSchema
651instance SwaggerMonoid Responses
651instance SwaggerMonoid Responses
@@ -701,7 +701,7 @@ instance SwaggerMonoid (HashMap HttpStatusCode (Referenced Response)) where
701 swaggerMempty = HashMap.empty
701 swaggerMempty = HashMap.empty
702 swaggerMappend = flip HashMap.union
702 swaggerMappend = flip HashMap.union
704−instance SwaggerMonoid ParamSchema where
704+instance SwaggerMonoid ParamAnySchema where
705 swaggerMempty = ParamOther swaggerMempty
705 swaggerMempty = ParamOther swaggerMempty
706 swaggerMappend (ParamBody x) (ParamBody y) = ParamBody (swaggerMappend x y)
706 swaggerMappend (ParamBody x) (ParamBody y) = ParamBody (swaggerMappend x y)
707 swaggerMappend (ParamOther x) (ParamOther y) = ParamOther (swaggerMappend x y)
707 swaggerMappend (ParamOther x) (ParamOther y) = ParamOther (swaggerMappend x y)
@@ -721,7 +721,7 @@ deriveJSONDefault ''Scheme
721deriveJSON' ''Tag
721deriveJSON' ''Tag
722deriveJSON' ''ExternalDocs
722deriveJSON' ''ExternalDocs
724−deriveToJSON' ''SchemaCommon
724+deriveToJSON' ''ParamSchema
725deriveToJSON' ''Operation
725deriveToJSON' ''Operation
726deriveToJSON' ''Response
726deriveToJSON' ''Response
727deriveToJSON' ''PathItem
727deriveToJSON' ''PathItem
@@ -769,13 +769,13 @@ instance ToJSON SecurityScheme where
769 toJSON = genericToJSONWithSub "type" (jsonPrefix "securityScheme")
769 toJSON = genericToJSONWithSub "type" (jsonPrefix "securityScheme")
771instance ToJSON Schema where
771instance ToJSON Schema where
772− toJSON = genericToJSONWithSub "schemaCommon" (jsonPrefix "schema")
772+ toJSON = genericToJSONWithSub "paramSchema" (jsonPrefix "schema")
774instance ToJSON Header where
774instance ToJSON Header where
775− toJSON = genericToJSONWithSub "common" (jsonPrefix "header")
775+ toJSON = genericToJSONWithSub "paramSchema" (jsonPrefix "header")
777instance ToJSON Items where
777instance ToJSON Items where
778− toJSON = genericToJSONWithSub "common" (jsonPrefix "items")
778+ toJSON = genericToJSONWithSub "paramSchema" (jsonPrefix "items")
780instance ToJSON Host where
780instance ToJSON Host where
781 toJSON (Host host mport) = toJSON $
781 toJSON (Host host mport) = toJSON $
@@ -792,12 +792,12 @@ instance ToJSON MimeList where
792instance ToJSON Param where
792instance ToJSON Param where
793 toJSON = genericToJSONWithSub "schema" (jsonPrefix "param")
793 toJSON = genericToJSONWithSub "schema" (jsonPrefix "param")
795−instance ToJSON ParamSchema where
795+instance ToJSON ParamAnySchema where
796 toJSON (ParamBody s) = object [ "in" .= ("body" :: Text), "schema" .= s ]
796 toJSON (ParamBody s) = object [ "in" .= ("body" :: Text), "schema" .= s ]
797 toJSON (ParamOther s) = toJSON s
797 toJSON (ParamOther s) = toJSON s
799instance ToJSON ParamOtherSchema where
799instance ToJSON ParamOtherSchema where
800− toJSON = genericToJSONWithSub "common" (jsonPrefix "paramOtherSchema")
800+ toJSON = genericToJSONWithSub "paramSchema" (jsonPrefix "paramOtherSchema")
802instance ToJSON SchemaItems where
802instance ToJSON SchemaItems where
803 toJSON (SchemaItemsObject x) = toJSON x
803 toJSON (SchemaItemsObject x) = toJSON x
@@ -883,15 +883,15 @@ instance FromJSON SecurityScheme where
883 parseJSON = genericParseJSONWithSub "type" (jsonPrefix "securityScheme")
883 parseJSON = genericParseJSONWithSub "type" (jsonPrefix "securityScheme")
885instance FromJSON Schema where
885instance FromJSON Schema where
886− parseJSON = genericParseJSONWithSub "schemaCommon" (jsonPrefix "schema")
886+ parseJSON = genericParseJSONWithSub "paramSchema" (jsonPrefix "schema")
887 `withDefaults` [ "properties" .= (mempty :: HashMap Text Schema)
887 `withDefaults` [ "properties" .= (mempty :: HashMap Text Schema)
888 , "required" .= ([] :: [ParamName]) ]
888 , "required" .= ([] :: [ParamName]) ]
890instance FromJSON Header where
890instance FromJSON Header where
891− parseJSON = genericParseJSONWithSub "common" (jsonPrefix "header")
891+ parseJSON = genericParseJSONWithSub "paramSchema" (jsonPrefix "header")
893instance FromJSON Items where
893instance FromJSON Items where
894− parseJSON = genericParseJSONWithSub "common" (jsonPrefix "items")
894+ parseJSON = genericParseJSONWithSub "paramSchema" (jsonPrefix "items")
896instance FromJSON Host where
896instance FromJSON Host where
897 parseJSON (String s) =
897 parseJSON (String s) =
@@ -912,7 +912,7 @@ instance FromJSON MimeList where
912instance FromJSON Param where
912instance FromJSON Param where
913 parseJSON = genericParseJSONWithSub "schema" (jsonPrefix "param")
913 parseJSON = genericParseJSONWithSub "schema" (jsonPrefix "param")
915−instance FromJSON ParamSchema where
915+instance FromJSON ParamAnySchema where
916 parseJSON js@(Object o) = do
916 parseJSON js@(Object o) = do
917 (i :: Text) <- o .: "in"
917 (i :: Text) <- o .: "in"
918 case i of
918 case i of
@@ -923,7 +923,7 @@ instance FromJSON ParamSchema where
923 parseJSON _ = empty
923 parseJSON _ = empty
925instance FromJSON ParamOtherSchema where
925instance FromJSON ParamOtherSchema where
926− parseJSON = genericParseJSONWithSub "common" (jsonPrefix "paramOtherSchema")
926+ parseJSON = genericParseJSONWithSub "paramSchema" (jsonPrefix "paramOtherSchema")
928instance FromJSON SchemaItems where
928instance FromJSON SchemaItems where
929 parseJSON js@(Object _) = SchemaItemsObject <$> parseJSON js
929 parseJSON js@(Object _) = SchemaItemsObject <$> parseJSON js
@@ -983,5 +983,5 @@ instance FromJSON (CollectionFormat Items) where
983-- NOTE: The constraint @FromJSON (SwaggerType t)@ is necessary here!
983-- NOTE: The constraint @FromJSON (SwaggerType t)@ is necessary here!
984-- Without the constraint the general instance will be used
984-- Without the constraint the general instance will be used
985-- that only accepts common types (i.e. NOT object, null or file).
985-- that only accepts common types (i.e. NOT object, null or file).
986−instance (FromJSON (SwaggerType t), FromJSON i) => FromJSON (SchemaCommon t i) where
986+instance (FromJSON (SwaggerType t), FromJSON i) => FromJSON (ParamSchema t i) where
987− parseJSON = genericParseJSON (jsonPrefix "SchemaCommon")
987+ parseJSON = genericParseJSON (jsonPrefix "ParamSchema")