git.iko.soy/typeable/openapi3
on master help sign in
Rename Parameter to Param
98a5947Nickolay Kudasov
src/Data/Swagger.hs+5−5
@@ -27,7 +27,7 @@ module Data.Swagger (
27 Operation(..),
27 Operation(..),
28
28
29 -- * Types and formats
29 -- * Types and formats
30− ParameterType(..),
30+ ParamType(..),
31 ItemsType(..),
31 ItemsType(..),
32 SchemaType(..),
32 SchemaType(..),
33 Format,
33 Format,
@@ -35,10 +35,10 @@ module Data.Swagger (
35 ItemsCollectionFormat(..),
35 ItemsCollectionFormat(..),
36
36
37 -- * Parameters
37 -- * Parameters
38− Parameter(..),
38+ Param(..),
39− ParameterSchema(..),
39+ ParamSchema(..),
40− ParameterOtherSchema(..),
40+ ParamOtherSchema(..),
41− ParameterLocation(..),
41+ ParamLocation(..),
42 ParamName,
42 ParamName,
43 Items(..),
43 Items(..),
44 Header(..),
44 Header(..),
src/Data/Swagger/Internal.hs+59−59
@@ -64,7 +64,7 @@ data Swagger = Swagger
64
64
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
68
68
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)
192
192
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]
232
232
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] }
255
255
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
262
262
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
267
267
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
272
272
273 -- | Parameter schema.
273 -- | Parameter schema.
274− , _parameterSchema :: ParameterSchema
274+ , _paramSchema :: ParamSchema
275 } deriving (Eq, Show, Generic)
275 } deriving (Eq, Show, Generic)
276
276
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)
281
281
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
285
285
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
293
293
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
296
296
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
302
302
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
306
306
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
310
310
311− , _parameterOtherSchemaCommon :: SchemaCommon
311+ , _paramOtherSchemaCommon :: SchemaCommon
312 } deriving (Eq, Show, Generic)
312 } deriving (Eq, Show, Generic)
313
313
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)
322
322
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)
342
342
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)
355
355
356data ItemsType
356data ItemsType
@@ -661,11 +661,11 @@ instance Monoid SchemaCommon where
661 mempty = genericMempty
661 mempty = genericMempty
662 mappend = genericMappend
662 mappend = genericMappend
663
663
664−instance Monoid Parameter where
664+instance Monoid Param where
665 mempty = genericMempty
665 mempty = genericMempty
666 mappend = genericMappend
666 mappend = genericMappend
667
667
668−instance Monoid ParameterOtherSchema where
668+instance Monoid ParamOtherSchema where
669 mempty = genericMempty
669 mempty = genericMempty
670 mappend = genericMappend
670 mappend = genericMappend
671
671
@@ -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
710
710
711−instance SwaggerMonoid ParameterType where
711+instance SwaggerMonoid ParamType where
712 swaggerMempty = ParamString
712 swaggerMempty = ParamString
713 swaggerMappend _ y = y
713 swaggerMappend _ y = y
714
714
715−instance SwaggerMonoid ParameterLocation where
715+instance SwaggerMonoid ParamLocation where
716− swaggerMempty = ParameterQuery
716+ swaggerMempty = ParamQuery
717 swaggerMappend _ y = y
717 swaggerMappend _ y = y
718
718
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
731
731
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
735
735
@@ -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
755
755
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
761
761
762-- =======================================================================
762-- =======================================================================
763-- TH derived ToJSON and FromJSON instances
763-- TH derived ToJSON and FromJSON instances
764-- =======================================================================
764-- =======================================================================
765
765
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)
848
848
849−instance ToJSON Parameter where
849+instance ToJSON Param where
850− toJSON = genericToJSONWithSub "schema" (jsonPrefix "parameter")
850+ toJSON = genericToJSONWithSub "schema" (jsonPrefix "param")
851
851
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
855
855
856−instance ToJSON ParameterOtherSchema where
856+instance ToJSON ParamOtherSchema where
857− toJSON = genericToJSONWithSub "common" (jsonPrefix "parameterOtherSchema")
857+ toJSON = genericToJSONWithSub "common" (jsonPrefix "paramOtherSchema")
858
858
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)
919 ] ) js
919 ] ) js
@@ -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
951
951
952−instance FromJSON Parameter where
952+instance FromJSON Param where
953− parseJSON = genericParseJSONWithSub "schema" (jsonPrefix "parameter")
953+ parseJSON = genericParseJSONWithSub "schema" (jsonPrefix "param")
954
954
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
964
964
965−instance FromJSON ParameterOtherSchema where
965+instance FromJSON ParamOtherSchema where
966− parseJSON = genericParseJSONWithSub "common" (jsonPrefix "parameterOtherSchema")
966+ parseJSON = genericParseJSONWithSub "common" (jsonPrefix "paramOtherSchema")
967
967
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
991
991
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]) ]
995
995
996instance FromJSON Reference where
996instance FromJSON Reference where
997 parseJSON (Object o) = Reference <$> o .: "$ref"
997 parseJSON (Object o) = Reference <$> o .: "$ref"
src/Data/Swagger/Lens.hs+5−5
@@ -23,9 +23,9 @@ makeLenses ''Paths
23makeLenses ''PathItem
23makeLenses ''PathItem
24makeLenses ''Tag
24makeLenses ''Tag
25makeLenses ''Operation
25makeLenses ''Operation
26−makeLenses ''Parameter
26+makeLenses ''Param
27−makePrisms ''ParameterSchema
27+makePrisms ''ParamSchema
28−makeLenses ''ParameterOtherSchema
28+makeLenses ''ParamOtherSchema
29makeLenses ''Items
29makeLenses ''Items
30makeLenses ''Header
30makeLenses ''Header
31makeLenses ''Schema
31makeLenses ''Schema
@@ -51,7 +51,7 @@ instance HasDescription Response Text where description = responseDescript
51instance HasDescription Info (Maybe Text) where description = infoDescription
51instance HasDescription Info (Maybe Text) where description = infoDescription
52instance HasDescription Tag (Maybe Text) where description = tagDescription
52instance HasDescription Tag (Maybe Text) where description = tagDescription
53instance HasDescription Operation (Maybe Text) where description = operationDescription
53instance HasDescription Operation (Maybe Text) where description = operationDescription
54−instance HasDescription Parameter (Maybe Text) where description = parameterDescription
54+instance HasDescription Param (Maybe Text) where description = paramDescription
55instance HasDescription Header (Maybe Text) where description = headerDescription
55instance HasDescription Header (Maybe Text) where description = headerDescription
56instance HasDescription Schema (Maybe Text) where description = schemaDescription
56instance HasDescription Schema (Maybe Text) where description = schemaDescription
57instance HasDescription SecurityScheme (Maybe Text) where description = securitySchemeDescription
57instance HasDescription SecurityScheme (Maybe Text) where description = securitySchemeDescription
@@ -61,7 +61,7 @@ class HasSchemaCommon s where
61 schemaCommon :: Lens' s SchemaCommon
61 schemaCommon :: Lens' s SchemaCommon
62
62
63instance HasSchemaCommon Schema where schemaCommon = schemaSchemaCommon
63instance HasSchemaCommon Schema where schemaCommon = schemaSchemaCommon
64−instance HasSchemaCommon ParameterOtherSchema where schemaCommon = parameterOtherSchemaCommon
64+instance HasSchemaCommon ParamOtherSchema where schemaCommon = paramOtherSchemaCommon
65instance HasSchemaCommon Items where schemaCommon = itemsCommon
65instance HasSchemaCommon Items where schemaCommon = itemsCommon
66instance HasSchemaCommon Header where schemaCommon = headerCommon
66instance HasSchemaCommon Header where schemaCommon = headerCommon
67instance HasSchemaCommon SchemaCommon where schemaCommon = id
67instance HasSchemaCommon SchemaCommon where schemaCommon = id
test/Data/SwaggerSpec.hs+42−42
@@ -25,7 +25,7 @@ spec = do
25 context "Model with Map/Dictionary Properties" $ schemaModelDictExample <~> schemaModelDictExampleJSON
25 context "Model with Map/Dictionary Properties" $ schemaModelDictExample <~> schemaModelDictExampleJSON
26 context "Model with Example" $ schemaWithExampleExample <~> schemaWithExampleExampleJSON
26 context "Model with Example" $ schemaWithExampleExample <~> schemaWithExampleExampleJSON
27 describe "Definitions Object" $ definitionsExample <~> definitionsExampleJSON
27 describe "Definitions Object" $ definitionsExample <~> definitionsExampleJSON
28− describe "Parameters Definition Object" $ parametersDefinitionExample <~> parametersDefinitionExampleJSON
28+ describe "Parameters Definition Object" $ paramsDefinitionExample <~> paramsDefinitionExampleJSON
29 describe "Responses Definition Object" $ responsesDefinitionExample <~> responsesDefinitionExampleJSON
29 describe "Responses Definition Object" $ responsesDefinitionExample <~> responsesDefinitionExampleJSON
30 describe "Security Definitions Object" $ securityDefinitionsExample <~> securityDefinitionsExampleJSON
30 describe "Security Definitions Object" $ securityDefinitionsExample <~> securityDefinitionsExampleJSON
31 describe "Swagger Object" $ do
31 describe "Swagger Object" $ do
@@ -131,26 +131,26 @@ operationExample = mempty
131 , (405, Inline mempty { _responseDescription = "Invalid input" }) ] }
131 , (405, Inline mempty { _responseDescription = "Invalid input" }) ] }
132
132
133 params = map Inline
133 params = map Inline
134− [ Parameter
134+ [ Param
135− { _parameterName = "petId"
135+ { _paramName = "petId"
136− , _parameterDescription = Just "ID of pet that needs to be updated"
136+ , _paramDescription = Just "ID of pet that needs to be updated"
137− , _parameterRequired = Just True
137+ , _paramRequired = Just True
138− , _parameterSchema = ParameterOther (stringSchema ParameterPath) }
138+ , _paramSchema = ParamOther (stringSchema ParamPath) }
139− , Parameter
139+ , Param
140− { _parameterName = "name"
140+ { _paramName = "name"
141− , _parameterDescription = Just "Updated name of the pet"
141+ , _paramDescription = Just "Updated name of the pet"
142− , _parameterRequired = Just False
142+ , _paramRequired = Just False
143− , _parameterSchema = ParameterOther (stringSchema ParameterFormData) }
143+ , _paramSchema = ParamOther (stringSchema ParamFormData) }
144− , Parameter
144+ , Param
145− { _parameterName = "status"
145+ { _paramName = "status"
146− , _parameterDescription = Just "Updated status of the pet"
146+ , _paramDescription = Just "Updated status of the pet"
147− , _parameterRequired = Just False
147+ , _paramRequired = Just False
148− , _parameterSchema = ParameterOther (stringSchema ParameterFormData) }
148+ , _paramSchema = ParamOther (stringSchema ParamFormData) }
149 ]
149 ]
150
150
151 stringSchema i = mempty
151 stringSchema i = mempty
152− { _parameterOtherSchemaIn = i
152+ { _paramOtherSchemaIn = i
153− , _parameterOtherSchemaType = ParamString
153+ , _paramOtherSchemaType = ParamString
154 }
154 }
155
155
156operationExampleJSON :: Value
156operationExampleJSON :: Value
@@ -379,27 +379,27 @@ definitionsExampleJSON = [aesonQQ|
379-- Parameters Definition object
379-- Parameters Definition object
380-- =======================================================================
380-- =======================================================================
381
381
382−parametersDefinitionExample :: HashMap Text Parameter
382+paramsDefinitionExample :: HashMap Text Param
383−parametersDefinitionExample =
383+paramsDefinitionExample =
384 [ ("skipParam", mempty
384 [ ("skipParam", mempty
385− { _parameterName = "skip"
385+ { _paramName = "skip"
386− , _parameterDescription = Just "number of items to skip"
386+ , _paramDescription = Just "number of items to skip"
387− , _parameterRequired = Just True
387+ , _paramRequired = Just True
388− , _parameterSchema = ParameterOther mempty
388+ , _paramSchema = ParamOther mempty
389− { _parameterOtherSchemaIn = ParameterQuery
389+ { _paramOtherSchemaIn = ParamQuery
390− , _parameterOtherSchemaType = ParamInteger
390+ , _paramOtherSchemaType = ParamInteger
391− , _parameterOtherSchemaFormat = Just "int32" } })
391+ , _paramOtherSchemaFormat = Just "int32" } })
392 , ("limitParam", mempty
392 , ("limitParam", mempty
393− { _parameterName = "limit"
393+ { _paramName = "limit"
394− , _parameterDescription = Just "max records to return"
394+ , _paramDescription = Just "max records to return"
395− , _parameterRequired = Just True
395+ , _paramRequired = Just True
396− , _parameterSchema = ParameterOther mempty
396+ , _paramSchema = ParamOther mempty
397− { _parameterOtherSchemaIn = ParameterQuery
397+ { _paramOtherSchemaIn = ParamQuery
398− , _parameterOtherSchemaType = ParamInteger
398+ , _paramOtherSchemaType = ParamInteger
399− , _parameterOtherSchemaFormat = Just "int32" } }) ]
399+ , _paramOtherSchemaFormat = Just "int32" } }) ]
400
400
401−parametersDefinitionExampleJSON :: Value
401+paramsDefinitionExampleJSON :: Value
402−parametersDefinitionExampleJSON = [aesonQQ|
402+paramsDefinitionExampleJSON = [aesonQQ|
403{
403{
404 "skipParam": {
404 "skipParam": {
405 "name": "skip",
405 "name": "skip",
@@ -518,12 +518,12 @@ swaggerExample = mempty
518 , _operationProduces = Just (MimeList [ "application/json" ])
518 , _operationProduces = Just (MimeList [ "application/json" ])
519 , _operationParameters =
519 , _operationParameters =
520 [ Inline mempty
520 [ Inline mempty
521− { _parameterRequired = Just True
521+ { _paramRequired = Just True
522− , _parameterName = "id"
522+ , _paramName = "id"
523− , _parameterDescription = Just "TodoId param"
523+ , _paramDescription = Just "TodoId param"
524− , _parameterSchema = ParameterOther mempty
524+ , _paramSchema = ParamOther mempty
525− { _parameterOtherSchemaIn = ParameterPath
525+ { _paramOtherSchemaIn = ParamPath
526− , _parameterOtherSchemaType = ParamString } } ]
526+ , _paramOtherSchemaType = ParamString } } ]
527 , _operationTags = [ "todo" ] } }) ] } }
527 , _operationTags = [ "todo" ] } }) ] } }
528
528
529swaggerExampleJSON :: Value
529swaggerExampleJSON :: Value