@@ -64,7 +64,7 @@ data Swagger = Swagger
65 -- | An object to hold parameters that can be used across operations.
65 -- | An object to hold parameters that can be used across operations.
66 -- This property does not define global parameters for all operations.
66 -- This property does not define global parameters for all operations.
67− , _parameters :: HashMap Text Parameter
67+ , _parameters :: HashMap Text Param
69 -- | An object to hold responses that can be used across operations.
69 -- | An object to hold responses that can be used across operations.
70 -- This property does not define global responses for all operations.
70 -- This property does not define global responses for all operations.
@@ -187,7 +187,7 @@ data PathItem = PathItem
187 -- These parameters can be overridden at the operation level, but cannot be removed there.
187 -- These parameters can be overridden at the operation level, but cannot be removed there.
188 -- The list MUST NOT include duplicated parameters.
188 -- The list MUST NOT include duplicated parameters.
189 -- A unique parameter is defined by a combination of a name and location.
189 -- A unique parameter is defined by a combination of a name and location.
190− , _pathItemParameters :: [Referenced Parameter]
190+ , _pathItemParameters :: [Referenced Param]
191 } deriving (Eq, Show, Generic)
191 } deriving (Eq, Show, Generic)
193-- | Describes a single API operation on a path.
193-- | Describes a single API operation on a path.
@@ -228,7 +228,7 @@ data Operation = Operation
228 -- the new definition will override it, but can never remove it.
228 -- the new definition will override it, but can never remove it.
229 -- The list MUST NOT include duplicated parameters.
229 -- The list MUST NOT include duplicated parameters.
230 -- A unique parameter is defined by a combination of a name and location.
230 -- A unique parameter is defined by a combination of a name and location.
231− , _operationParameters :: [Referenced Parameter]
231+ , _operationParameters :: [Referenced Param]
233 -- | The list of possible responses as they are returned from executing this operation.
233 -- | The list of possible responses as they are returned from executing this operation.
234 , _operationResponses :: Responses
234 , _operationResponses :: Responses
@@ -255,63 +255,63 @@ newtype MimeList = MimeList { getMimeList :: [MediaType] }
256-- | Describes a single operation parameter.
256-- | Describes a single operation parameter.
257-- A unique parameter is defined by a combination of a name and location.
257-- A unique parameter is defined by a combination of a name and location.
258−data Parameter = Parameter
258+data Param = Param
259 { -- | The name of the parameter.
259 { -- | The name of the parameter.
260 -- Parameter names are case sensitive.
260 -- Parameter names are case sensitive.
261− _parameterName :: Text
261+ _paramName :: Text
263 -- | A brief description of the parameter.
263 -- | A brief description of the parameter.
264 -- This could contain examples of use.
264 -- This could contain examples of use.
265 -- GFM syntax can be used for rich text representation.
265 -- GFM syntax can be used for rich text representation.
266− , _parameterDescription :: Maybe Text
266+ , _paramDescription :: Maybe Text
268 -- | Determines whether this parameter is mandatory.
268 -- | Determines whether this parameter is mandatory.
269 -- If the parameter is in "path", this property is required and its value MUST be true.
269 -- If the parameter is in "path", this property is required and its value MUST be true.
270 -- Otherwise, the property MAY be included and its default value is @False@.
270 -- Otherwise, the property MAY be included and its default value is @False@.
271− , _parameterRequired :: Maybe Bool
271+ , _paramRequired :: Maybe Bool
273 -- | Parameter schema.
273 -- | Parameter schema.
274− , _parameterSchema :: ParameterSchema
274+ , _paramSchema :: ParamSchema
275 } deriving (Eq, Show, Generic)
275 } deriving (Eq, Show, Generic)
277−data ParameterSchema
277+data ParamSchema
278− = ParameterBody (Referenced Schema)
278+ = ParamBody (Referenced Schema)
279− | ParameterOther ParameterOtherSchema
279+ | ParamOther ParamOtherSchema
280 deriving (Eq, Show)
280 deriving (Eq, Show)
282−data ParameterOtherSchema = ParameterOtherSchema
282+data ParamOtherSchema = ParamOtherSchema
283 { -- | The location of the parameter.
283 { -- | The location of the parameter.
284− _parameterOtherSchemaIn :: ParameterLocation
284+ _paramOtherSchemaIn :: ParamLocation
286 -- | The type of the parameter.
286 -- | The type of the parameter.
287 -- Since the parameter is not located at the request body,
287 -- Since the parameter is not located at the request body,
288 -- it is limited to simple types (that is, not an object).
288 -- it is limited to simple types (that is, not an object).
289 -- If type is @'ParamFile'@, the @consumes@ MUST be either
289 -- If type is @'ParamFile'@, the @consumes@ MUST be either
290 -- "multipart/form-data" or " application/x-www-form-urlencoded"
290 -- "multipart/form-data" or " application/x-www-form-urlencoded"
291− -- and the parameter MUST be in @'ParameterFormData'@.
291+ -- and the parameter MUST be in @'ParamFormData'@.
292− , _parameterOtherSchemaType :: ParameterType
292+ , _paramOtherSchemaType :: ParamType
294 -- | The extending format for the previously mentioned type.
294 -- | The extending format for the previously mentioned type.
295− , _parameterOtherSchemaFormat :: Maybe Format
295+ , _paramOtherSchemaFormat :: Maybe Format
297 -- | Sets the ability to pass empty-valued parameters.
297 -- | Sets the ability to pass empty-valued parameters.
298− -- This is valid only for either @'ParameterQuery'@ or @'ParameterFormData'@
298+ -- This is valid only for either @'ParamQuery'@ or @'ParamFormData'@
299 -- and allows you to send a parameter with a name only or an empty value.
299 -- and allows you to send a parameter with a name only or an empty value.
300 -- Default value is @False@.
300 -- Default value is @False@.
301− , _parameterOtherSchemaAllowEmptyValue :: Maybe Bool
301+ , _paramOtherSchemaAllowEmptyValue :: Maybe Bool
303 -- | __Required if type is @'ParamArray'@__.
303 -- | __Required if type is @'ParamArray'@__.
304 -- Describes the type of items in the array.
304 -- Describes the type of items in the array.
305− , _parameterOtherSchemaItems :: Maybe Items
305+ , _paramOtherSchemaItems :: Maybe Items
307 -- | Determines the format of the array if @'ParamArray'@ is used.
307 -- | Determines the format of the array if @'ParamArray'@ is used.
308 -- Default value is csv.
308 -- Default value is csv.
309− , _parameterOtherSchemaCollectionFormat :: Maybe CollectionFormat
309+ , _paramOtherSchemaCollectionFormat :: Maybe CollectionFormat
311− , _parameterOtherSchemaCommon :: SchemaCommon
311+ , _paramOtherSchemaCommon :: SchemaCommon
312 } deriving (Eq, Show, Generic)
312 } deriving (Eq, Show, Generic)
314−data ParameterType
314+data ParamType
315 = ParamString
315 = ParamString
316 | ParamNumber
316 | ParamNumber
317 | ParamInteger
317 | ParamInteger
@@ -320,16 +320,16 @@ data ParameterType
320 | ParamFile
320 | ParamFile
321 deriving (Eq, Show)
321 deriving (Eq, Show)
323−data ParameterLocation
323+data ParamLocation
324 = -- | Parameters that are appended to the URL.
324 = -- | Parameters that are appended to the URL.
325 -- For example, in @/items?id=###@, the query parameter is @id@.
325 -- For example, in @/items?id=###@, the query parameter is @id@.
326− ParameterQuery
326+ ParamQuery
327 -- | Custom headers that are expected as part of the request.
327 -- | Custom headers that are expected as part of the request.
328− | ParameterHeader
328+ | ParamHeader
329 -- | Used together with Path Templating, where the parameter value is actually part of the operation's URL.
329 -- | Used together with Path Templating, where the parameter value is actually part of the operation's URL.
330 -- This does not include the host or base path of the API.
330 -- This does not include the host or base path of the API.
331 -- For example, in @/items/{itemId}@, the path parameter is @itemId@.
331 -- For example, in @/items/{itemId}@, the path parameter is @itemId@.
332− | ParameterPath
332+ | ParamPath
333 -- | Used to describe the payload of an HTTP request when either @application/x-www-form-urlencoded@
333 -- | Used to describe the payload of an HTTP request when either @application/x-www-form-urlencoded@
334 -- or @multipart/form-data@ are used as the content type of the request
334 -- or @multipart/form-data@ are used as the content type of the request
335 -- (in Swagger's definition, the @consumes@ property of an operation).
335 -- (in Swagger's definition, the @consumes@ property of an operation).
@@ -337,7 +337,7 @@ data ParameterLocation
337 -- Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation.
337 -- Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation.
338 -- Form parameters have a different format based on the content-type used
338 -- Form parameters have a different format based on the content-type used
339 -- (for further details, consult <http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4>).
339 -- (for further details, consult <http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4>).
340− | ParameterFormData
340+ | ParamFormData
341 deriving (Eq, Show)
341 deriving (Eq, Show)
343type Format = Text
343type Format = Text
@@ -349,8 +349,8 @@ data CollectionFormat
349 | CollectionTSV -- ^ Tab separated values: @foo\\tbar@.
349 | CollectionTSV -- ^ Tab separated values: @foo\\tbar@.
350 | CollectionPipes -- ^ Pipe separated values: @foo|bar@.
350 | CollectionPipes -- ^ Pipe separated values: @foo|bar@.
351 | CollectionMulti -- ^ Corresponds to multiple parameter instances
351 | CollectionMulti -- ^ Corresponds to multiple parameter instances
352− -- instead of multiple values for a single instance @foo=bar&foo=baz@.
352+ -- instead of multiple values for a single instance @foo=bar&foo=baz@.
353− -- This is valid only for parameters in @'ParameterQuery'@ or @'ParameterFormData'@.
353+ -- This is valid only for parameters in @'ParamQuery'@ or @'ParamFormData'@.
354 deriving (Eq, Show)
354 deriving (Eq, Show)
356data ItemsType
356data ItemsType
@@ -661,11 +661,11 @@ instance Monoid SchemaCommon where
661 mempty = genericMempty
661 mempty = genericMempty
662 mappend = genericMappend
662 mappend = genericMappend
664−instance Monoid Parameter where
664+instance Monoid Param where
665 mempty = genericMempty
665 mempty = genericMempty
666 mappend = genericMappend
666 mappend = genericMappend
668−instance Monoid ParameterOtherSchema where
668+instance Monoid ParamOtherSchema where
669 mempty = genericMempty
669 mempty = genericMempty
670 mappend = genericMappend
670 mappend = genericMappend
@@ -694,8 +694,8 @@ instance SwaggerMonoid Paths
694instance SwaggerMonoid PathItem
694instance SwaggerMonoid PathItem
695instance SwaggerMonoid Schema
695instance SwaggerMonoid Schema
696instance SwaggerMonoid SchemaCommon
696instance SwaggerMonoid SchemaCommon
697−instance SwaggerMonoid Parameter
697+instance SwaggerMonoid Param
698−instance SwaggerMonoid ParameterOtherSchema
698+instance SwaggerMonoid ParamOtherSchema
699instance SwaggerMonoid Responses
699instance SwaggerMonoid Responses
700instance SwaggerMonoid Response
700instance SwaggerMonoid Response
701instance SwaggerMonoid ExternalDocs
701instance SwaggerMonoid ExternalDocs
@@ -708,12 +708,12 @@ instance SwaggerMonoid SchemaType where
708 swaggerMempty = SchemaNull
708 swaggerMempty = SchemaNull
709 swaggerMappend _ y = y
709 swaggerMappend _ y = y
711−instance SwaggerMonoid ParameterType where
711+instance SwaggerMonoid ParamType where
712 swaggerMempty = ParamString
712 swaggerMempty = ParamString
713 swaggerMappend _ y = y
713 swaggerMappend _ y = y
715−instance SwaggerMonoid ParameterLocation where
715+instance SwaggerMonoid ParamLocation where
716− swaggerMempty = ParameterQuery
716+ swaggerMempty = ParamQuery
717 swaggerMappend _ y = y
717 swaggerMappend _ y = y
719instance SwaggerMonoid (HashMap Text Schema) where
719instance SwaggerMonoid (HashMap Text Schema) where
@@ -729,7 +729,7 @@ instance Monoid a => SwaggerMonoid (Referenced a) where
729 swaggerMappend (Inline x) (Inline y) = Inline (x <> y)
729 swaggerMappend (Inline x) (Inline y) = Inline (x <> y)
730 swaggerMappend _ y = y
730 swaggerMappend _ y = y
732−instance SwaggerMonoid (HashMap Text Parameter) where
732+instance SwaggerMonoid (HashMap Text Param) where
733 swaggerMempty = HashMap.empty
733 swaggerMempty = HashMap.empty
734 swaggerMappend = HashMap.unionWith mappend
734 swaggerMappend = HashMap.unionWith mappend
@@ -753,18 +753,18 @@ instance SwaggerMonoid (HashMap HttpStatusCode (Referenced Response)) where
753 swaggerMempty = HashMap.empty
753 swaggerMempty = HashMap.empty
754 swaggerMappend = flip HashMap.union
754 swaggerMappend = flip HashMap.union
756−instance SwaggerMonoid ParameterSchema where
756+instance SwaggerMonoid ParamSchema where
757− swaggerMempty = ParameterOther swaggerMempty
757+ swaggerMempty = ParamOther swaggerMempty
758− swaggerMappend (ParameterBody x) (ParameterBody y) = ParameterBody (swaggerMappend x y)
758+ swaggerMappend (ParamBody x) (ParamBody y) = ParamBody (swaggerMappend x y)
759− swaggerMappend (ParameterOther x) (ParameterOther y) = ParameterOther (swaggerMappend x y)
759+ swaggerMappend (ParamOther x) (ParamOther y) = ParamOther (swaggerMappend x y)
760 swaggerMappend _ y = y
760 swaggerMappend _ y = y
762-- =======================================================================
762-- =======================================================================
763-- TH derived ToJSON and FromJSON instances
763-- TH derived ToJSON and FromJSON instances
764-- =======================================================================
764-- =======================================================================
766−deriveJSON (jsonPrefix "Parameter") ''ParameterLocation
766+deriveJSON (jsonPrefix "Param") ''ParamLocation
767−deriveJSON (jsonPrefix "Param") ''ParameterType
767+deriveJSON (jsonPrefix "Param") ''ParamType
768deriveJSON' ''Info
768deriveJSON' ''Info
769deriveJSON' ''Contact
769deriveJSON' ''Contact
770deriveJSON' ''License
770deriveJSON' ''License
@@ -846,15 +846,15 @@ instance ToJSON Paths where
846instance ToJSON MimeList where
846instance ToJSON MimeList where
847 toJSON (MimeList xs) = toJSON (map show xs)
847 toJSON (MimeList xs) = toJSON (map show xs)
849−instance ToJSON Parameter where
849+instance ToJSON Param where
850− toJSON = genericToJSONWithSub "schema" (jsonPrefix "parameter")
850+ toJSON = genericToJSONWithSub "schema" (jsonPrefix "param")
852−instance ToJSON ParameterSchema where
852+instance ToJSON ParamSchema where
853− toJSON (ParameterBody s) = object [ "in" .= ("body" :: Text), "schema" .= s ]
853+ toJSON (ParamBody s) = object [ "in" .= ("body" :: Text), "schema" .= s ]
854− toJSON (ParameterOther s) = toJSON s
854+ toJSON (ParamOther s) = toJSON s
856−instance ToJSON ParameterOtherSchema where
856+instance ToJSON ParamOtherSchema where
857− toJSON = genericToJSONWithSub "common" (jsonPrefix "parameterOtherSchema")
857+ toJSON = genericToJSONWithSub "common" (jsonPrefix "paramOtherSchema")
859instance ToJSON SchemaItems where
859instance ToJSON SchemaItems where
860 toJSON (SchemaItemsObject x) = toJSON x
860 toJSON (SchemaItemsObject x) = toJSON x
@@ -913,7 +913,7 @@ instance FromJSON Swagger where
913 , "security" .= ([] :: [SecurityRequirement])
913 , "security" .= ([] :: [SecurityRequirement])
914 , "tags" .= ([] :: [Tag])
914 , "tags" .= ([] :: [Tag])
915 , "definitions" .= (mempty :: HashMap Text Schema)
915 , "definitions" .= (mempty :: HashMap Text Schema)
916− , "parameters" .= (mempty :: HashMap Text Parameter)
916+ , "parameters" .= (mempty :: HashMap Text Param)
917 , "responses" .= (mempty :: HashMap Text Response)
917 , "responses" .= (mempty :: HashMap Text Response)
918 , "securityDefinitions" .= (mempty :: HashMap Text SecurityScheme)
918 , "securityDefinitions" .= (mempty :: HashMap Text SecurityScheme)
@@ -949,21 +949,21 @@ instance FromJSON Paths where
949instance FromJSON MimeList where
949instance FromJSON MimeList where
950 parseJSON js = (MimeList . map fromString) <$> parseJSON js
950 parseJSON js = (MimeList . map fromString) <$> parseJSON js
952−instance FromJSON Parameter where
952+instance FromJSON Param where
953− parseJSON = genericParseJSONWithSub "schema" (jsonPrefix "parameter")
953+ parseJSON = genericParseJSONWithSub "schema" (jsonPrefix "param")
955−instance FromJSON ParameterSchema where
955+instance FromJSON ParamSchema where
956 parseJSON js@(Object o) = do
956 parseJSON js@(Object o) = do
957 (i :: Text) <- o .: "in"
957 (i :: Text) <- o .: "in"
958 case i of
958 case i of
959 "body" -> do
959 "body" -> do
960 schema <- o .: "schema"
960 schema <- o .: "schema"
961− ParameterBody <$> parseJSON schema
961+ ParamBody <$> parseJSON schema
962− _ -> ParameterOther <$> parseJSON js
962+ _ -> ParamOther <$> parseJSON js
963 parseJSON _ = empty
963 parseJSON _ = empty
965−instance FromJSON ParameterOtherSchema where
965+instance FromJSON ParamOtherSchema where
966− parseJSON = genericParseJSONWithSub "common" (jsonPrefix "parameterOtherSchema")
966+ parseJSON = genericParseJSONWithSub "common" (jsonPrefix "paramOtherSchema")
968instance FromJSON SchemaItems where
968instance FromJSON SchemaItems where
969 parseJSON js@(Object _) = SchemaItemsObject <$> parseJSON js
969 parseJSON js@(Object _) = SchemaItemsObject <$> parseJSON js
@@ -991,7 +991,7 @@ instance FromJSON Operation where
992instance FromJSON PathItem where
992instance FromJSON PathItem where
993 parseJSON = genericParseJSON (jsonPrefix "pathItem")
993 parseJSON = genericParseJSON (jsonPrefix "pathItem")
994− `withDefaults` [ "parameters" .= ([] :: [Parameter]) ]
994+ `withDefaults` [ "parameters" .= ([] :: [Param]) ]
996instance FromJSON Reference where
996instance FromJSON Reference where
997 parseJSON (Object o) = Reference <$> o .: "$ref"
997 parseJSON (Object o) = Reference <$> o .: "$ref"