@@ -35,117 +35,117 @@ import Data.Swagger.Internal.Utils
35data Swagger = Swagger
35data Swagger = Swagger
36 { -- | Provides metadata about the API.
36 { -- | Provides metadata about the API.
37 -- The metadata can be used by the clients if needed.
37 -- The metadata can be used by the clients if needed.
38− _swaggerInfo :: SwaggerInfo
38+ _info :: Info
40 -- | The host (name or ip) serving the API. It MAY include a port.
40 -- | The host (name or ip) serving the API. It MAY include a port.
41 -- If the host is not included, the host serving the documentation is to be used (including the port).
41 -- If the host is not included, the host serving the documentation is to be used (including the port).
42− , _swaggerHost :: Maybe SwaggerHost
42+ , _host :: Maybe Host
44 -- | The base path on which the API is served, which is relative to the host.
44 -- | The base path on which the API is served, which is relative to the host.
45 -- If it is not included, the API is served directly under the host.
45 -- If it is not included, the API is served directly under the host.
46 -- The value MUST start with a leading slash (/).
46 -- The value MUST start with a leading slash (/).
47− , _swaggerBasePath :: Maybe FilePath
47+ , _basePath :: Maybe FilePath
49 -- | The transfer protocol of the API.
49 -- | The transfer protocol of the API.
50 -- If the schemes is not included, the default scheme to be used is the one used to access the Swagger definition itself.
50 -- If the schemes is not included, the default scheme to be used is the one used to access the Swagger definition itself.
51− , _swaggerSchemes :: Maybe [SwaggerScheme]
51+ , _schemes :: Maybe [Scheme]
53 -- | A list of MIME types the APIs can consume.
53 -- | A list of MIME types the APIs can consume.
54 -- This is global to all APIs but can be overridden on specific API calls.
54 -- This is global to all APIs but can be overridden on specific API calls.
55− , _swaggerConsumes :: SwaggerMimeList
55+ , _consumes :: MimeList
57 -- | A list of MIME types the APIs can produce.
57 -- | A list of MIME types the APIs can produce.
58 -- This is global to all APIs but can be overridden on specific API calls.
58 -- This is global to all APIs but can be overridden on specific API calls.
59− , _swaggerProduces :: SwaggerMimeList
59+ , _produces :: MimeList
61 -- | The available paths and operations for the API.
61 -- | The available paths and operations for the API.
62− , _swaggerPaths :: SwaggerPaths
62+ , _paths :: Paths
64 -- | An object to hold data types produced and consumed by operations.
64 -- | An object to hold data types produced and consumed by operations.
65− , _swaggerDefinitions :: HashMap Text SwaggerSchema
65+ , _definitions :: HashMap Text Schema
67 -- | An object to hold parameters that can be used across operations.
67 -- | An object to hold parameters that can be used across operations.
68 -- This property does not define global parameters for all operations.
68 -- This property does not define global parameters for all operations.
69− , _swaggerParameters :: HashMap Text SwaggerParameter
69+ , _parameters :: HashMap Text Parameter
71 -- | An object to hold responses that can be used across operations.
71 -- | An object to hold responses that can be used across operations.
72 -- This property does not define global responses for all operations.
72 -- This property does not define global responses for all operations.
73− , _swaggerResponses :: HashMap Text SwaggerResponse
73+ , _responses :: HashMap Text Response
75 -- | Security scheme definitions that can be used across the specification.
75 -- | Security scheme definitions that can be used across the specification.
76− , _swaggerSecurityDefinitions :: HashMap Text SwaggerSecurityScheme
76+ , _securityDefinitions :: HashMap Text SecurityScheme
78 -- | A declaration of which security schemes are applied for the API as a whole.
78 -- | A declaration of which security schemes are applied for the API as a whole.
79 -- The list of values describes alternative security schemes that can be used
79 -- The list of values describes alternative security schemes that can be used
80 -- (that is, there is a logical OR between the security requirements).
80 -- (that is, there is a logical OR between the security requirements).
81 -- Individual operations can override this definition.
81 -- Individual operations can override this definition.
82− , _swaggerSecurity :: [SwaggerSecurityRequirement]
82+ , _security :: [SecurityRequirement]
84 -- | A list of tags used by the specification with additional metadata.
84 -- | A list of tags used by the specification with additional metadata.
85 -- The order of the tags can be used to reflect on their order by the parsing tools.
85 -- The order of the tags can be used to reflect on their order by the parsing tools.
86 -- Not all tags that are used by the Operation Object must be declared.
86 -- Not all tags that are used by the Operation Object must be declared.
87 -- The tags that are not declared may be organized randomly or based on the tools' logic.
87 -- The tags that are not declared may be organized randomly or based on the tools' logic.
88 -- Each tag name in the list MUST be unique.
88 -- Each tag name in the list MUST be unique.
89− , _swaggerTags :: [SwaggerTag]
89+ , _tags :: [Tag]
91 -- | Additional external documentation.
91 -- | Additional external documentation.
92− , _swaggerExternalDocs :: Maybe SwaggerExternalDocs
92+ , _externalDocs :: Maybe ExternalDocs
93 } deriving (Eq, Show, Generic)
93 } deriving (Eq, Show, Generic)
95-- | The object provides metadata about the API.
95-- | The object provides metadata about the API.
96-- The metadata can be used by the clients if needed,
96-- The metadata can be used by the clients if needed,
97-- and can be presented in the Swagger-UI for convenience.
97-- and can be presented in the Swagger-UI for convenience.
98−data SwaggerInfo = SwaggerInfo
98+data Info = Info
99 { -- | The title of the application.
99 { -- | The title of the application.
100− _swaggerInfoTitle :: Text
100+ _infoTitle :: Text
102 -- | A short description of the application.
102 -- | A short description of the application.
103 -- GFM syntax can be used for rich text representation.
103 -- GFM syntax can be used for rich text representation.
104− , _swaggerInfoDescription :: Maybe Text
104+ , _infoDescription :: Maybe Text
106 -- | The Terms of Service for the API.
106 -- | The Terms of Service for the API.
107− , _swaggerInfoTermsOfService :: Maybe Text
107+ , _infoTermsOfService :: Maybe Text
109 -- | The contact information for the exposed API.
109 -- | The contact information for the exposed API.
110− , _swaggerInfoContact :: Maybe SwaggerContact
110+ , _infoContact :: Maybe Contact
112 -- | The license information for the exposed API.
112 -- | The license information for the exposed API.
113− , _swaggerInfoLicense :: Maybe SwaggerLicense
113+ , _infoLicense :: Maybe License
115 -- | Provides the version of the application API
115 -- | Provides the version of the application API
116 -- (not to be confused with the specification version).
116 -- (not to be confused with the specification version).
117− , _swaggerInfoVersion :: Text
117+ , _infoVersion :: Text
118 } deriving (Eq, Show, Generic)
118 } deriving (Eq, Show, Generic)
120-- | Contact information for the exposed API.
120-- | Contact information for the exposed API.
121−data SwaggerContact = SwaggerContact
121+data Contact = Contact
122 { -- | The identifying name of the contact person/organization.
122 { -- | The identifying name of the contact person/organization.
123− _swaggerContactName :: Maybe Text
123+ _contactName :: Maybe Text
125 -- | The URL pointing to the contact information.
125 -- | The URL pointing to the contact information.
126− , _swaggerContactUrl :: Maybe URL
126+ , _contactUrl :: Maybe URL
128 -- | The email address of the contact person/organization.
128 -- | The email address of the contact person/organization.
129− , _swaggerContactEmail :: Maybe Text
129+ , _contactEmail :: Maybe Text
130 } deriving (Eq, Show)
130 } deriving (Eq, Show)
132-- | License information for the exposed API.
132-- | License information for the exposed API.
133−data SwaggerLicense = SwaggerLicense
133+data License = License
134 { -- | The license name used for the API.
134 { -- | The license name used for the API.
135− _swaggerLicenseName :: Text
135+ _licenseName :: Text
137 -- | A URL to the license used for the API.
137 -- | A URL to the license used for the API.
138− , _swaggerLicenseUrl :: Maybe URL
138+ , _licenseUrl :: Maybe URL
139 } deriving (Eq, Show)
139 } deriving (Eq, Show)
141-- | The host (name or ip) serving the API. It MAY include a port.
141-- | The host (name or ip) serving the API. It MAY include a port.
142−data SwaggerHost = SwaggerHost
142+data Host = Host
143− { _swaggerHostName :: HostName -- ^ Host name.
143+ { _hostName :: HostName -- ^ Host name.
144− , _swaggerHostPort :: Maybe PortNumber -- ^ Optional port.
144+ , _hostPort :: Maybe PortNumber -- ^ Optional port.
145 } deriving (Eq, Show)
145 } deriving (Eq, Show)
147-- | The transfer protocol of the API.
147-- | The transfer protocol of the API.
148−data SwaggerScheme
148+data Scheme
@@ -153,305 +153,305 @@ data SwaggerScheme
153 deriving (Eq, Show)
153 deriving (Eq, Show)
155-- | The available paths and operations for the API.
155-- | The available paths and operations for the API.
156−data SwaggerPaths = SwaggerPaths
156+data Paths = Paths
157 { -- | Holds the relative paths to the individual endpoints.
157 { -- | Holds the relative paths to the individual endpoints.
158− -- The path is appended to the @'swaggerBasePath'@ in order to construct the full URL.
158+ -- The path is appended to the @'basePath'@ in order to construct the full URL.
159− _swaggerPathsMap :: HashMap FilePath SwaggerPathItem
159+ _pathsMap :: HashMap FilePath PathItem
160 } deriving (Eq, Show, Generic)
160 } deriving (Eq, Show, Generic)
162-- | Describes the operations available on a single path.
162-- | Describes the operations available on a single path.
163−-- A @'SwaggerPathItem'@ may be empty, due to ACL constraints.
163+-- A @'PathItem'@ may be empty, due to ACL constraints.
164-- The path itself is still exposed to the documentation viewer
164-- The path itself is still exposed to the documentation viewer
165-- but they will not know which operations and parameters are available.
165-- but they will not know which operations and parameters are available.
166−data SwaggerPathItem = SwaggerPathItem
166+data PathItem = PathItem
167 { -- | A definition of a GET operation on this path.
167 { -- | A definition of a GET operation on this path.
168− _swaggerPathItemGet :: Maybe SwaggerOperation
168+ _pathItemGet :: Maybe Operation
170 -- | A definition of a PUT operation on this path.
170 -- | A definition of a PUT operation on this path.
171− , _swaggerPathItemPut :: Maybe SwaggerOperation
171+ , _pathItemPut :: Maybe Operation
173 -- | A definition of a POST operation on this path.
173 -- | A definition of a POST operation on this path.
174− , _swaggerPathItemPost :: Maybe SwaggerOperation
174+ , _pathItemPost :: Maybe Operation
176 -- | A definition of a DELETE operation on this path.
176 -- | A definition of a DELETE operation on this path.
177− , _swaggerPathItemDelete :: Maybe SwaggerOperation
177+ , _pathItemDelete :: Maybe Operation
179 -- | A definition of a OPTIONS operation on this path.
179 -- | A definition of a OPTIONS operation on this path.
180− , _swaggerPathItemOptions :: Maybe SwaggerOperation
180+ , _pathItemOptions :: Maybe Operation
182 -- | A definition of a HEAD operation on this path.
182 -- | A definition of a HEAD operation on this path.
183− , _swaggerPathItemHead :: Maybe SwaggerOperation
183+ , _pathItemHead :: Maybe Operation
185 -- | A definition of a PATCH operation on this path.
185 -- | A definition of a PATCH operation on this path.
186− , _swaggerPathItemPatch :: Maybe SwaggerOperation
186+ , _pathItemPatch :: Maybe Operation
188 -- | A list of parameters that are applicable for all the operations described under this path.
188 -- | A list of parameters that are applicable for all the operations described under this path.
189 -- These parameters can be overridden at the operation level, but cannot be removed there.
189 -- These parameters can be overridden at the operation level, but cannot be removed there.
190 -- The list MUST NOT include duplicated parameters.
190 -- The list MUST NOT include duplicated parameters.
191 -- A unique parameter is defined by a combination of a name and location.
191 -- A unique parameter is defined by a combination of a name and location.
192− , _swaggerPathItemParameters :: [SwaggerReferenced SwaggerParameter]
192+ , _pathItemParameters :: [Referenced Parameter]
193 } deriving (Eq, Show, Generic)
193 } deriving (Eq, Show, Generic)
195-- | Describes a single API operation on a path.
195-- | Describes a single API operation on a path.
196−data SwaggerOperation = SwaggerOperation
196+data Operation = Operation
197 { -- | A list of tags for API documentation control.
197 { -- | A list of tags for API documentation control.
198 -- Tags can be used for logical grouping of operations by resources or any other qualifier.
198 -- Tags can be used for logical grouping of operations by resources or any other qualifier.
199− _swaggerOperationTags :: [Text]
199+ _operationTags :: [Text]
201 -- | A short summary of what the operation does.
201 -- | A short summary of what the operation does.
202 -- For maximum readability in the swagger-ui, this field SHOULD be less than 120 characters.
202 -- For maximum readability in the swagger-ui, this field SHOULD be less than 120 characters.
203− , _swaggerOperationSummary :: Maybe Text
203+ , _operationSummary :: Maybe Text
205 -- | A verbose explanation of the operation behavior.
205 -- | A verbose explanation of the operation behavior.
206 -- GFM syntax can be used for rich text representation.
206 -- GFM syntax can be used for rich text representation.
207− , _swaggerOperationDescription :: Maybe Text
207+ , _operationDescription :: Maybe Text
209 -- | Additional external documentation for this operation.
209 -- | Additional external documentation for this operation.
210− , _swaggerOperationExternalDocs :: Maybe SwaggerExternalDocs
210+ , _operationExternalDocs :: Maybe ExternalDocs
212 -- | Unique string used to identify the operation.
212 -- | Unique string used to identify the operation.
213 -- The id MUST be unique among all operations described in the API.
213 -- The id MUST be unique among all operations described in the API.
214 -- Tools and libraries MAY use the it to uniquely identify an operation,
214 -- Tools and libraries MAY use the it to uniquely identify an operation,
215 -- therefore, it is recommended to follow common programming naming conventions.
215 -- therefore, it is recommended to follow common programming naming conventions.
216− , _swaggerOperationOperationId :: Maybe Text
216+ , _operationOperationId :: Maybe Text
218 -- | A list of MIME types the operation can consume.
218 -- | A list of MIME types the operation can consume.
219− -- This overrides the @'swaggerConsumes'@.
219+ -- This overrides the @'consumes'@.
220 -- @Just []@ MAY be used to clear the global definition.
220 -- @Just []@ MAY be used to clear the global definition.
221− , _swaggerOperationConsumes :: Maybe SwaggerMimeList
221+ , _operationConsumes :: Maybe MimeList
223 -- | A list of MIME types the operation can produce.
223 -- | A list of MIME types the operation can produce.
224− -- This overrides the @'swaggerProduces'@.
224+ -- This overrides the @'produces'@.
225 -- @Just []@ MAY be used to clear the global definition.
225 -- @Just []@ MAY be used to clear the global definition.
226− , _swaggerOperationProduces :: Maybe SwaggerMimeList
226+ , _operationProduces :: Maybe MimeList
228 -- | A list of parameters that are applicable for this operation.
228 -- | A list of parameters that are applicable for this operation.
229− -- If a parameter is already defined at the @'SwaggerPathItem'@,
229+ -- If a parameter is already defined at the @'PathItem'@,
230 -- the new definition will override it, but can never remove it.
230 -- the new definition will override it, but can never remove it.
231 -- The list MUST NOT include duplicated parameters.
231 -- The list MUST NOT include duplicated parameters.
232 -- A unique parameter is defined by a combination of a name and location.
232 -- A unique parameter is defined by a combination of a name and location.
233− , _swaggerOperationParameters :: [SwaggerReferenced SwaggerParameter]
233+ , _operationParameters :: [Referenced Parameter]
235 -- | The list of possible responses as they are returned from executing this operation.
235 -- | The list of possible responses as they are returned from executing this operation.
236− , _swaggerOperationResponses :: SwaggerResponses
236+ , _operationResponses :: Responses
238 -- | The transfer protocol for the operation.
238 -- | The transfer protocol for the operation.
239− -- The value overrides @'swaggerSchemes'@.
239+ -- The value overrides @'schemes'@.
240− , _swaggerOperationSchemes :: Maybe [SwaggerScheme]
240+ , _operationSchemes :: Maybe [Scheme]
242 -- | Declares this operation to be deprecated.
242 -- | Declares this operation to be deprecated.
243 -- Usage of the declared operation should be refrained.
243 -- Usage of the declared operation should be refrained.
244 -- Default value is @False@.
244 -- Default value is @False@.
245− , _swaggerOperationDeprecated :: Maybe Bool
245+ , _operationDeprecated :: Maybe Bool
247 -- | A declaration of which security schemes are applied for this operation.
247 -- | A declaration of which security schemes are applied for this operation.
248 -- The list of values describes alternative security schemes that can be used
248 -- The list of values describes alternative security schemes that can be used
249 -- (that is, there is a logical OR between the security requirements).
249 -- (that is, there is a logical OR between the security requirements).
250 -- This definition overrides any declared top-level security.
250 -- This definition overrides any declared top-level security.
251 -- To remove a top-level security declaration, @Just []@ can be used.
251 -- To remove a top-level security declaration, @Just []@ can be used.
252− , _swaggerOperationSecurity :: [SwaggerSecurityRequirement]
252+ , _operationSecurity :: [SecurityRequirement]
253 } deriving (Eq, Show, Generic)
253 } deriving (Eq, Show, Generic)
255−newtype SwaggerMimeList = SwaggerMimeList { getSwaggerMimeList :: [MediaType] }
255+newtype MimeList = MimeList { getMimeList :: [MediaType] }
256 deriving (Eq, Show, Monoid)
256 deriving (Eq, Show, Monoid)
258-- | Describes a single operation parameter.
258-- | Describes a single operation parameter.
259-- A unique parameter is defined by a combination of a name and location.
259-- A unique parameter is defined by a combination of a name and location.
260−data SwaggerParameter = SwaggerParameter
260+data Parameter = Parameter
261 { -- | The name of the parameter.
261 { -- | The name of the parameter.
262 -- Parameter names are case sensitive.
262 -- Parameter names are case sensitive.
263− _swaggerParameterName :: Text
263+ _parameterName :: Text
265 -- | A brief description of the parameter.
265 -- | A brief description of the parameter.
266 -- This could contain examples of use.
266 -- This could contain examples of use.
267 -- GFM syntax can be used for rich text representation.
267 -- GFM syntax can be used for rich text representation.
268− , _swaggerParameterDescription :: Maybe Text
268+ , _parameterDescription :: Maybe Text
270 -- | Determines whether this parameter is mandatory.
270 -- | Determines whether this parameter is mandatory.
271 -- If the parameter is in "path", this property is required and its value MUST be true.
271 -- If the parameter is in "path", this property is required and its value MUST be true.
272 -- Otherwise, the property MAY be included and its default value is @False@.
272 -- Otherwise, the property MAY be included and its default value is @False@.
273− , _swaggerParameterRequired :: Maybe Bool
273+ , _parameterRequired :: Maybe Bool
275 -- | Parameter schema.
275 -- | Parameter schema.
276− , _swaggerParameterSchema :: SwaggerParameterSchema
276+ , _parameterSchema :: ParameterSchema
277 } deriving (Eq, Show, Generic)
277 } deriving (Eq, Show, Generic)
279−data SwaggerParameterSchema
279+data ParameterSchema
280− = SwaggerParameterBody (SwaggerReferenced SwaggerSchema)
280+ = ParameterBody (Referenced Schema)
281− | SwaggerParameterOther SwaggerParameterOtherSchema
281+ | ParameterOther ParameterOtherSchema
282 deriving (Eq, Show)
282 deriving (Eq, Show)
284−data SwaggerParameterOtherSchema = SwaggerParameterOtherSchema
284+data ParameterOtherSchema = ParameterOtherSchema
285 { -- | The location of the parameter.
285 { -- | The location of the parameter.
286− _swaggerParameterOtherSchemaIn :: SwaggerParameterLocation
286+ _parameterOtherSchemaIn :: ParameterLocation
288 -- | The type of the parameter.
288 -- | The type of the parameter.
289 -- Since the parameter is not located at the request body,
289 -- Since the parameter is not located at the request body,
290 -- it is limited to simple types (that is, not an object).
290 -- it is limited to simple types (that is, not an object).
291− -- If type is @'SwaggerParamFile'@, the @consumes@ MUST be either
291+ -- If type is @'ParamFile'@, the @consumes@ MUST be either
292 -- "multipart/form-data" or " application/x-www-form-urlencoded"
292 -- "multipart/form-data" or " application/x-www-form-urlencoded"
293− -- and the parameter MUST be in @'SwaggerParameterFormData'@.
293+ -- and the parameter MUST be in @'ParameterFormData'@.
294− , _swaggerParameterOtherSchemaType :: SwaggerParameterType
294+ , _parameterOtherSchemaType :: ParameterType
296 -- | The extending format for the previously mentioned type.
296 -- | The extending format for the previously mentioned type.
297− , _swaggerParameterOtherSchemaFormat :: Maybe SwaggerFormat
297+ , _parameterOtherSchemaFormat :: Maybe Format
299 -- | Sets the ability to pass empty-valued parameters.
299 -- | Sets the ability to pass empty-valued parameters.
300− -- This is valid only for either @'SwaggerParameterQuery'@ or @'SwaggerParameterFormData'@
300+ -- This is valid only for either @'ParameterQuery'@ or @'ParameterFormData'@
301 -- and allows you to send a parameter with a name only or an empty value.
301 -- and allows you to send a parameter with a name only or an empty value.
302 -- Default value is @False@.
302 -- Default value is @False@.
303− , _swaggerParameterOtherSchemaAllowEmptyValue :: Maybe Bool
303+ , _parameterOtherSchemaAllowEmptyValue :: Maybe Bool
305− -- | __Required if type is @'SwaggerParamArray'@__.
305+ -- | __Required if type is @'ParamArray'@__.
306 -- Describes the type of items in the array.
306 -- Describes the type of items in the array.
307− , _swaggerParameterOtherSchemaItems :: Maybe SwaggerItems
307+ , _parameterOtherSchemaItems :: Maybe Items
309− -- | Determines the format of the array if @'SwaggerParamArray'@ is used.
309+ -- | Determines the format of the array if @'ParamArray'@ is used.
310 -- Default value is csv.
310 -- Default value is csv.
311− , _swaggerParameterOtherSchemaCollectionFormat :: Maybe SwaggerCollectionFormat
311+ , _parameterOtherSchemaCollectionFormat :: Maybe CollectionFormat
313− , _swaggerParameterOtherSchemaCommon :: SwaggerSchemaCommon
313+ , _parameterOtherSchemaCommon :: SchemaCommon
314 } deriving (Eq, Show, Generic)
314 } deriving (Eq, Show, Generic)
316−data SwaggerParameterType
316+data ParameterType
317− = SwaggerParamString
317+ = ParamString
318− | SwaggerParamNumber
318+ | ParamNumber
319− | SwaggerParamInteger
319+ | ParamInteger
320− | SwaggerParamBoolean
320+ | ParamBoolean
321− | SwaggerParamArray
321+ | ParamArray
322− | SwaggerParamFile
322+ | ParamFile
323 deriving (Eq, Show)
323 deriving (Eq, Show)
325−data SwaggerParameterLocation
325+data ParameterLocation
326 = -- | Parameters that are appended to the URL.
326 = -- | Parameters that are appended to the URL.
327 -- For example, in @/items?id=###@, the query parameter is @id@.
327 -- For example, in @/items?id=###@, the query parameter is @id@.
328− SwaggerParameterQuery
328+ ParameterQuery
329 -- | Custom headers that are expected as part of the request.
329 -- | Custom headers that are expected as part of the request.
330− | SwaggerParameterHeader
330+ | ParameterHeader
331 -- | Used together with Path Templating, where the parameter value is actually part of the operation's URL.
331 -- | Used together with Path Templating, where the parameter value is actually part of the operation's URL.
332 -- This does not include the host or base path of the API.
332 -- This does not include the host or base path of the API.
333 -- For example, in @/items/{itemId}@, the path parameter is @itemId@.
333 -- For example, in @/items/{itemId}@, the path parameter is @itemId@.
334− | SwaggerParameterPath
334+ | ParameterPath
335 -- | Used to describe the payload of an HTTP request when either @application/x-www-form-urlencoded@
335 -- | Used to describe the payload of an HTTP request when either @application/x-www-form-urlencoded@
336 -- or @multipart/form-data@ are used as the content type of the request
336 -- or @multipart/form-data@ are used as the content type of the request
337 -- (in Swagger's definition, the @consumes@ property of an operation).
337 -- (in Swagger's definition, the @consumes@ property of an operation).
338− -- This is the only parameter type that can be used to send files, thus supporting the @'SwaggerParamFile'@ type.
338+ -- This is the only parameter type that can be used to send files, thus supporting the @'ParamFile'@ type.
339 -- Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation.
339 -- Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation.
340 -- Form parameters have a different format based on the content-type used
340 -- Form parameters have a different format based on the content-type used
341 -- (for further details, consult <http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4>).
341 -- (for further details, consult <http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4>).
342− | SwaggerParameterFormData
342+ | ParameterFormData
343 deriving (Eq, Show)
343 deriving (Eq, Show)
345−type SwaggerFormat = Text
345+type Format = Text
347-- | Determines the format of the array.
347-- | Determines the format of the array.
348−data SwaggerCollectionFormat
348+data CollectionFormat
349− = SwaggerCollectionCSV -- ^ Comma separated values: @foo,bar@.
349+ = CollectionCSV -- ^ Comma separated values: @foo,bar@.
350− | SwaggerCollectionSSV -- ^ Space separated values: @foo bar@.
350+ | CollectionSSV -- ^ Space separated values: @foo bar@.
351− | SwaggerCollectionTSV -- ^ Tab separated values: @foo\\tbar@.
351+ | CollectionTSV -- ^ Tab separated values: @foo\\tbar@.
352− | SwaggerCollectionPipes -- ^ Pipe separated values: @foo|bar@.
352+ | CollectionPipes -- ^ Pipe separated values: @foo|bar@.
353− | SwaggerCollectionMulti -- ^ Corresponds to multiple parameter instances
353+ | CollectionMulti -- ^ Corresponds to multiple parameter instances
354 -- instead of multiple values for a single instance @foo=bar&foo=baz@.
354 -- instead of multiple values for a single instance @foo=bar&foo=baz@.
355− -- This is valid only for parameters in @'SwaggerParameterQuery'@ or @'SwaggerParameterFormData'@.
355+ -- This is valid only for parameters in @'ParameterQuery'@ or @'ParameterFormData'@.
356 deriving (Eq, Show)
356 deriving (Eq, Show)
358−data SwaggerItemsType
358+data ItemsType
359− = SwaggerItemsString
359+ = ItemsString
360− | SwaggerItemsNumber
360+ | ItemsNumber
361− | SwaggerItemsInteger
361+ | ItemsInteger
362− | SwaggerItemsBoolean
362+ | ItemsBoolean
363− | SwaggerItemsArray
363+ | ItemsArray
364 deriving (Eq, Show)
364 deriving (Eq, Show)
366−data SwaggerSchemaType
366+data SchemaType
367− = SwaggerSchemaArray
367+ = SchemaArray
368− | SwaggerSchemaBoolean
368+ | SchemaBoolean
369− | SwaggerSchemaInteger
369+ | SchemaInteger
370− | SwaggerSchemaNumber
370+ | SchemaNumber
371− | SwaggerSchemaNull
371+ | SchemaNull
372− | SwaggerSchemaObject
372+ | SchemaObject
373− | SwaggerSchemaString
373+ | SchemaString
374 deriving (Eq, Show)
374 deriving (Eq, Show)
376-- | Determines the format of the nested array.
376-- | Determines the format of the nested array.
377−data SwaggerItemsCollectionFormat
377+data ItemsCollectionFormat
378− = SwaggerItemsCollectionCSV -- ^ Comma separated values: @foo,bar@.
378+ = ItemsCollectionCSV -- ^ Comma separated values: @foo,bar@.
379− | SwaggerItemsCollectionSSV -- ^ Space separated values: @foo bar@.
379+ | ItemsCollectionSSV -- ^ Space separated values: @foo bar@.
380− | SwaggerItemsCollectionTSV -- ^ Tab separated values: @foo\\tbar@.
380+ | ItemsCollectionTSV -- ^ Tab separated values: @foo\\tbar@.
381− | SwaggerItemsCollectionPipes -- ^ Pipe separated values: @foo|bar@.
381+ | ItemsCollectionPipes -- ^ Pipe separated values: @foo|bar@.
382 deriving (Eq, Show)
382 deriving (Eq, Show)
384−type SwaggerParamName = Text
384+type ParamName = Text
386−data SwaggerSchema = SwaggerSchema
386+data Schema = Schema
387− { _swaggerSchemaType :: SwaggerSchemaType
387+ { _schemaType :: SchemaType
388− , _swaggerSchemaFormat :: Maybe SwaggerFormat
388+ , _schemaFormat :: Maybe Format
389− , _swaggerSchemaTitle :: Maybe Text
389+ , _schemaTitle :: Maybe Text
390− , _swaggerSchemaDescription :: Maybe Text
390+ , _schemaDescription :: Maybe Text
391− , _swaggerSchemaRequired :: [SwaggerParamName]
391+ , _schemaRequired :: [ParamName]
393− , _swaggerSchemaItems :: Maybe SwaggerSchemaItems
393+ , _schemaItems :: Maybe SchemaItems
394− , _swaggerSchemaAllOf :: Maybe [SwaggerSchema]
394+ , _schemaAllOf :: Maybe [Schema]
395− , _swaggerSchemaProperties :: HashMap Text (SwaggerReferenced SwaggerSchema)
395+ , _schemaProperties :: HashMap Text (Referenced Schema)
396− , _swaggerSchemaAdditionalProperties :: Maybe SwaggerSchema
396+ , _schemaAdditionalProperties :: Maybe Schema
398− , _swaggerSchemaDiscriminator :: Maybe Text
398+ , _schemaDiscriminator :: Maybe Text
399− , _swaggerSchemaReadOnly :: Maybe Bool
399+ , _schemaReadOnly :: Maybe Bool
400− , _swaggerSchemaXml :: Maybe SwaggerXml
400+ , _schemaXml :: Maybe Xml
401− , _swaggerSchemaExternalDocs :: Maybe SwaggerExternalDocs
401+ , _schemaExternalDocs :: Maybe ExternalDocs
402− , _swaggerSchemaExample :: Maybe Value
402+ , _schemaExample :: Maybe Value
404− , _swaggerSchemaMaxProperties :: Maybe Integer
404+ , _schemaMaxProperties :: Maybe Integer
405− , _swaggerSchemaMinProperties :: Maybe Integer
405+ , _schemaMinProperties :: Maybe Integer
407− , _swaggerSchemaCommon :: SwaggerSchemaCommon
407+ , _schemaSchemaCommon :: SchemaCommon
408 } deriving (Eq, Show, Generic)
408 } deriving (Eq, Show, Generic)
410−data SwaggerSchemaItems
410+data SchemaItems
411− = SwaggerSchemaItemsObject (SwaggerReferenced SwaggerSchema)
411+ = SchemaItemsObject (Referenced Schema)
412− | SwaggerSchemaItemsArray [SwaggerReferenced SwaggerSchema]
412+ | SchemaItemsArray [Referenced Schema]
413 deriving (Eq, Show)
413 deriving (Eq, Show)
415−data SwaggerSchemaCommon = SwaggerSchemaCommon
415+data SchemaCommon = SchemaCommon
416 { -- | Declares the value of the parameter that the server will use if none is provided,
416 { -- | Declares the value of the parameter that the server will use if none is provided,
417 -- for example a @"count"@ to control the number of results per page might default to @100@
417 -- for example a @"count"@ to control the number of results per page might default to @100@
418 -- if not supplied by the client in the request.
418 -- if not supplied by the client in the request.
419 -- (Note: "default" has no meaning for required parameters.)
419 -- (Note: "default" has no meaning for required parameters.)
420 -- Unlike JSON Schema this value MUST conform to the defined type for this parameter.
420 -- Unlike JSON Schema this value MUST conform to the defined type for this parameter.
421− _swaggerSchemaDefault :: Maybe Value
421+ _schemaCommonDefault :: Maybe Value
423− , _swaggerSchemaMaximum :: Maybe Integer
423+ , _schemaCommonMaximum :: Maybe Integer
424− , _swaggerSchemaExclusiveMaximum :: Maybe Bool
424+ , _schemaCommonExclusiveMaximum :: Maybe Bool
425− , _swaggerSchemaMinimum :: Maybe Integer
425+ , _schemaCommonMinimum :: Maybe Integer
426− , _swaggerSchemaExclusiveMinimum :: Maybe Bool
426+ , _schemaCommonExclusiveMinimum :: Maybe Bool
427− , _swaggerSchemaMaxLength :: Maybe Integer
427+ , _schemaCommonMaxLength :: Maybe Integer
428− , _swaggerSchemaMinLength :: Maybe Integer
428+ , _schemaCommonMinLength :: Maybe Integer
429− , _swaggerSchemaPattern :: Maybe Text
429+ , _schemaCommonPattern :: Maybe Text
430− , _swaggerSchemaMaxItems :: Maybe Integer
430+ , _schemaCommonMaxItems :: Maybe Integer
431− , _swaggerSchemaMinItems :: Maybe Integer
431+ , _schemaCommonMinItems :: Maybe Integer
432− , _swaggerSchemaUniqueItems :: Maybe Bool
432+ , _schemaCommonUniqueItems :: Maybe Bool
433− , _swaggerSchemaEnum :: Maybe [Value]
433+ , _schemaCommonEnum :: Maybe [Value]
434− , _swaggerSchemaMultipleOf :: Maybe Integer
434+ , _schemaCommonMultipleOf :: Maybe Integer
435 } deriving (Eq, Show, Generic)
435 } deriving (Eq, Show, Generic)
437−data SwaggerXml = SwaggerXml
437+data Xml = Xml
438 { -- | Replaces the name of the element/attribute used for the described schema property.
438 { -- | Replaces the name of the element/attribute used for the described schema property.
439− -- When defined within the @'SwaggerItems'@ (items), it will affect the name of the individual XML elements within the list.
439+ -- When defined within the @'Items'@ (items), it will affect the name of the individual XML elements within the list.
440 -- When defined alongside type being array (outside the items),
440 -- When defined alongside type being array (outside the items),
441 -- it will affect the wrapping element and only if wrapped is true.
441 -- it will affect the wrapping element and only if wrapped is true.
442 -- If wrapped is false, it will be ignored.
442 -- If wrapped is false, it will be ignored.
443− _swaggerXmlName :: Maybe Text
443+ _xmlName :: Maybe Text
445 -- | The URL of the namespace definition.
445 -- | The URL of the namespace definition.
446 -- Value SHOULD be in the form of a URL.
446 -- Value SHOULD be in the form of a URL.
447− , _swaggerXmlNamespace :: Maybe Text
447+ , _xmlNamespace :: Maybe Text
449 -- | The prefix to be used for the name.
449 -- | The prefix to be used for the name.
450− , _swaggerXmlPrefix :: Maybe Text
450+ , _xmlPrefix :: Maybe Text
452 -- | Declares whether the property definition translates to an attribute instead of an element.
452 -- | Declares whether the property definition translates to an attribute instead of an element.
453 -- Default value is @False@.
453 -- Default value is @False@.
454− , _swaggerXmlAttribute :: Maybe Bool
454+ , _xmlAttribute :: Maybe Bool
456 -- | MAY be used only for an array definition.
456 -- | MAY be used only for an array definition.
457 -- Signifies whether the array is wrapped
457 -- Signifies whether the array is wrapped
@@ -459,25 +459,25 @@ data SwaggerXml = SwaggerXml
459 -- or unwrapped (@\<book/\>\<book/\>@).
459 -- or unwrapped (@\<book/\>\<book/\>@).
460 -- Default value is @False@.
460 -- Default value is @False@.
461 -- The definition takes effect only when defined alongside type being array (outside the items).
461 -- The definition takes effect only when defined alongside type being array (outside the items).
462− , _swaggerXmlWrapped :: Maybe Bool
462+ , _xmlWrapped :: Maybe Bool
463 } deriving (Eq, Show, Generic)
463 } deriving (Eq, Show, Generic)
465−data SwaggerItems = SwaggerItems
465+data Items = Items
466 { -- | The internal type of the array.
466 { -- | The internal type of the array.
467− _swaggerItemsType :: SwaggerItemsType
467+ _itemsType :: ItemsType
469 -- | The extending format for the previously mentioned type.
469 -- | The extending format for the previously mentioned type.
470− , _swaggerItemsFormat :: Maybe SwaggerFormat
470+ , _itemsFormat :: Maybe Format
472− -- | __Required if type is @'SwaggerItemsArray'@.__
472+ -- | __Required if type is @'ItemsArray'@.__
473 -- Describes the type of items in the array.
473 -- Describes the type of items in the array.
474− , _swaggerItemsItems :: Maybe SwaggerItems
474+ , _itemsItems :: Maybe Items
476 -- | Determines the format of the array if type array is used.
476 -- | Determines the format of the array if type array is used.
477− -- Default value is @'SwaggerItemsCollectionCSV'@.
477+ -- Default value is @'ItemsCollectionCSV'@.
478− , _swaggerItemsCollectionFormat :: Maybe SwaggerItemsCollectionFormat
478+ , _itemsCollectionFormat :: Maybe ItemsCollectionFormat
480− , _swaggerItemsCommon :: SwaggerSchemaCommon
480+ , _itemsCommon :: SchemaCommon
481 } deriving (Eq, Show, Generic)
481 } deriving (Eq, Show, Generic)
483-- | A container for the expected responses of an operation.
483-- | A container for the expected responses of an operation.
@@ -485,76 +485,76 @@ data SwaggerItems = SwaggerItems
485-- It is not expected from the documentation to necessarily cover all possible HTTP response codes,
485-- It is not expected from the documentation to necessarily cover all possible HTTP response codes,
486-- since they may not be known in advance.
486-- since they may not be known in advance.
487-- However, it is expected from the documentation to cover a successful operation response and any known errors.
487-- However, it is expected from the documentation to cover a successful operation response and any known errors.
488−data SwaggerResponses = SwaggerResponses
488+data Responses = Responses
489 { -- | The documentation of responses other than the ones declared for specific HTTP response codes.
489 { -- | The documentation of responses other than the ones declared for specific HTTP response codes.
490 -- It can be used to cover undeclared responses.
490 -- It can be used to cover undeclared responses.
491− _swaggerResponsesDefault :: Maybe (SwaggerReferenced SwaggerResponse)
491+ _responsesDefault :: Maybe (Referenced Response)
493 -- | Any HTTP status code can be used as the property name (one property per HTTP status code).
493 -- | Any HTTP status code can be used as the property name (one property per HTTP status code).
494 -- Describes the expected response for those HTTP status codes.
494 -- Describes the expected response for those HTTP status codes.
495− , _swaggerResponsesResponses :: HashMap HttpStatusCode (SwaggerReferenced SwaggerResponse)
495+ , _responsesResponses :: HashMap HttpStatusCode (Referenced Response)
496 } deriving (Eq, Show, Generic)
496 } deriving (Eq, Show, Generic)
498type HttpStatusCode = Int
498type HttpStatusCode = Int
500-- | Describes a single response from an API Operation.
500-- | Describes a single response from an API Operation.
501−data SwaggerResponse = SwaggerResponse
501+data Response = Response
502 { -- | A short description of the response.
502 { -- | A short description of the response.
503 -- GFM syntax can be used for rich text representation.
503 -- GFM syntax can be used for rich text representation.
504− _swaggerResponseDescription :: Text
504+ _responseDescription :: Text
506 -- | A definition of the response structure.
506 -- | A definition of the response structure.
507 -- It can be a primitive, an array or an object.
507 -- It can be a primitive, an array or an object.
508 -- If this field does not exist, it means no content is returned as part of the response.
508 -- If this field does not exist, it means no content is returned as part of the response.
509 -- As an extension to the Schema Object, its root type value may also be "file".
509 -- As an extension to the Schema Object, its root type value may also be "file".
510 -- This SHOULD be accompanied by a relevant produces mime-type.
510 -- This SHOULD be accompanied by a relevant produces mime-type.
511− , _swaggerResponseSchema :: Maybe (SwaggerReferenced SwaggerSchema)
511+ , _responseSchema :: Maybe (Referenced Schema)
513 -- | A list of headers that are sent with the response.
513 -- | A list of headers that are sent with the response.
514− , _swaggerResponseHeaders :: HashMap HeaderName SwaggerHeader
514+ , _responseHeaders :: HashMap HeaderName Header
516 -- | An example of the response message.
516 -- | An example of the response message.
517− , _swaggerResponseExamples :: Maybe SwaggerExample
517+ , _responseExamples :: Maybe Example
518 } deriving (Eq, Show, Generic)
518 } deriving (Eq, Show, Generic)
520type HeaderName = Text
520type HeaderName = Text
522−data SwaggerHeader = SwaggerHeader
522+data Header = Header
523 { -- | A short description of the header.
523 { -- | A short description of the header.
524− _swaggerHeaderDescription :: Maybe Text
524+ _headerDescription :: Maybe Text
526 -- | The type of the object.
526 -- | The type of the object.
527− , _swaggerHeaderType :: SwaggerItemsType
527+ , _headerType :: ItemsType
529 -- | The extending format for the previously mentioned type. See Data Type Formats for further details.
529 -- | The extending format for the previously mentioned type. See Data Type Formats for further details.
530− , _swaggerHeaderFormat :: Maybe SwaggerFormat
530+ , _headerFormat :: Maybe Format
532− -- | __Required if type is @'SwaggerItemsArray'@__.
532+ -- | __Required if type is @'ItemsArray'@__.
533 -- Describes the type of items in the array.
533 -- Describes the type of items in the array.
534− , _swaggerHeaderItems :: Maybe SwaggerItems
534+ , _headerItems :: Maybe Items
536 -- | Determines the format of the array if type array is used.
536 -- | Determines the format of the array if type array is used.
537− -- Default value is @'SwaggerItemsCollectionCSV'@.
537+ -- Default value is @'ItemsCollectionCSV'@.
538− , _swaggerHeaderCollectionFormat :: Maybe SwaggerItemsCollectionFormat
538+ , _headerCollectionFormat :: Maybe ItemsCollectionFormat
540− , _swaggerHeaderCommon :: SwaggerSchemaCommon
540+ , _headerCommon :: SchemaCommon
541 } deriving (Eq, Show, Generic)
541 } deriving (Eq, Show, Generic)
543−data SwaggerExample = SwaggerExample { getSwaggerExample :: Map MediaType Value }
543+data Example = Example { getExample :: Map MediaType Value }
544 deriving (Eq, Show)
544 deriving (Eq, Show)
546-- | The location of the API key.
546-- | The location of the API key.
547−data SwaggerApiKeyLocation
547+data ApiKeyLocation
548− = SwaggerApiKeyQuery
548+ = ApiKeyQuery
549− | SwaggerApiKeyHeader
549+ | ApiKeyHeader
550 deriving (Eq, Show)
550 deriving (Eq, Show)
552−data SwaggerApiKeyParams = SwaggerApiKeyParams
552+data ApiKeyParams = ApiKeyParams
553 { -- | The name of the header or query parameter to be used.
553 { -- | The name of the header or query parameter to be used.
554− _swaggerApiKeyName :: Text
554+ _apiKeyName :: Text
556 -- | The location of the API key.
556 -- | The location of the API key.
557− , _swaggerApiKeyIn :: SwaggerApiKeyLocation
557+ , _apiKeyIn :: ApiKeyLocation
558 } deriving (Eq, Show)
558 } deriving (Eq, Show)
560-- | The authorization URL to be used for OAuth2 flow. This SHOULD be in the form of a URL.
560-- | The authorization URL to be used for OAuth2 flow. This SHOULD be in the form of a URL.
@@ -563,74 +563,74 @@ type AuthorizationURL = Text
563-- | The token URL to be used for OAuth2 flow. This SHOULD be in the form of a URL.
563-- | The token URL to be used for OAuth2 flow. This SHOULD be in the form of a URL.
564type TokenURL = Text
564type TokenURL = Text
566−data SwaggerOAuth2Flow
566+data OAuth2Flow
567− = SwaggerOAuth2Implicit AuthorizationURL
567+ = OAuth2Implicit AuthorizationURL
568− | SwaggerOAuth2Password TokenURL
568+ | OAuth2Password TokenURL
569− | SwaggerOAuth2Application TokenURL
569+ | OAuth2Application TokenURL
570− | SwaggerOAuth2AccessCode AuthorizationURL TokenURL
570+ | OAuth2AccessCode AuthorizationURL TokenURL
571 deriving (Eq, Show)
571 deriving (Eq, Show)
573−data SwaggerOAuth2Params = SwaggerOAuth2Params
573+data OAuth2Params = OAuth2Params
574 { -- | The flow used by the OAuth2 security scheme.
574 { -- | The flow used by the OAuth2 security scheme.
575− _swaggerOAuth2Flow :: SwaggerOAuth2Flow
575+ _oauth2Flow :: OAuth2Flow
577 -- | The available scopes for the OAuth2 security scheme.
577 -- | The available scopes for the OAuth2 security scheme.
578− , _swaggerOAuth2Scopes :: HashMap Text Text
578+ , _oauth2Scopes :: HashMap Text Text
579 } deriving (Eq, Show, Generic)
579 } deriving (Eq, Show, Generic)
581−data SwaggerSecuritySchemeType
581+data SecuritySchemeType
582− = SwaggerSecuritySchemeBasic
582+ = SecuritySchemeBasic
583− | SwaggerSecuritySchemeApiKey SwaggerApiKeyParams
583+ | SecuritySchemeApiKey ApiKeyParams
584− | SwaggerSecuritySchemeOAuth2 SwaggerOAuth2Params
584+ | SecuritySchemeOAuth2 OAuth2Params
585 deriving (Eq, Show)
585 deriving (Eq, Show)
587−data SwaggerSecurityScheme = SwaggerSecurityScheme
587+data SecurityScheme = SecurityScheme
588 { -- | The type of the security scheme.
588 { -- | The type of the security scheme.
589− _swaggerSecuritySchemeType :: SwaggerSecuritySchemeType
589+ _securitySchemeType :: SecuritySchemeType
591 -- | A short description for security scheme.
591 -- | A short description for security scheme.
592− , _swaggerSecuritySchemeDescription :: Maybe Text
592+ , _securitySchemeDescription :: Maybe Text
593 } deriving (Eq, Show, Generic)
593 } deriving (Eq, Show, Generic)
595-- | Lists the required security schemes to execute this operation.
595-- | Lists the required security schemes to execute this operation.
596-- The object can have multiple security schemes declared in it which are all required
596-- The object can have multiple security schemes declared in it which are all required
597-- (that is, there is a logical AND between the schemes).
597-- (that is, there is a logical AND between the schemes).
598−newtype SwaggerSecurityRequirement = SwaggerSecurityRequirement
598+newtype SecurityRequirement = SecurityRequirement
599− { getSwaggerSecurityRequirement :: HashMap Text [Text]
599+ { getSecurityRequirement :: HashMap Text [Text]
600 } deriving (Eq, Read, Show, Monoid, ToJSON, FromJSON)
600 } deriving (Eq, Read, Show, Monoid, ToJSON, FromJSON)
602−-- | Allows adding meta data to a single tag that is used by @SwaggerOperation@.
602+-- | Allows adding meta data to a single tag that is used by @Operation@.
603−-- It is not mandatory to have a @SwaggerTag@ per tag used there.
603+-- It is not mandatory to have a @Tag@ per tag used there.
604−data SwaggerTag = SwaggerTag
604+data Tag = Tag
605 { -- | The name of the tag.
605 { -- | The name of the tag.
606− _swaggerTagName :: Text
606+ _tagName :: Text
608 -- | A short description for the tag.
608 -- | A short description for the tag.
609 -- GFM syntax can be used for rich text representation.
609 -- GFM syntax can be used for rich text representation.
610− , _swaggerTagDescription :: Maybe Text
610+ , _tagDescription :: Maybe Text
612 -- | Additional external documentation for this tag.
612 -- | Additional external documentation for this tag.
613− , _swaggerTagExternalDocs :: Maybe SwaggerExternalDocs
613+ , _tagExternalDocs :: Maybe ExternalDocs
614 } deriving (Eq, Show)
614 } deriving (Eq, Show)
616-- | Allows referencing an external resource for extended documentation.
616-- | Allows referencing an external resource for extended documentation.
617−data SwaggerExternalDocs = SwaggerExternalDocs
617+data ExternalDocs = ExternalDocs
618 { -- | A short description of the target documentation.
618 { -- | A short description of the target documentation.
619 -- GFM syntax can be used for rich text representation.
619 -- GFM syntax can be used for rich text representation.
620− _swaggerExternalDocsDescription :: Maybe Text
620+ _externalDocsDescription :: Maybe Text
622 -- | The URL for the target documentation.
622 -- | The URL for the target documentation.
623− , _swaggerExternalDocsUrl :: URL
623+ , _externalDocsUrl :: URL
624 } deriving (Eq, Show, Generic)
624 } deriving (Eq, Show, Generic)
626-- | A simple object to allow referencing other definitions in the specification.
626-- | A simple object to allow referencing other definitions in the specification.
627-- It can be used to reference parameters and responses that are defined at the top level for reuse.
627-- It can be used to reference parameters and responses that are defined at the top level for reuse.
628−newtype SwaggerReference = SwaggerReference { getSwaggerReference :: Text }
628+newtype Reference = Reference { getReference :: Text }
629 deriving (Eq, Show)
629 deriving (Eq, Show)
631−data SwaggerReferenced a
631+data Referenced a
632− = SwaggerRef SwaggerReference
632+ = Ref Reference
633− | SwaggerInline a
633+ | Inline a
634 deriving (Eq, Show)
634 deriving (Eq, Show)
636newtype URL = URL { getUrl :: Text } deriving (Eq, Show, ToJSON, FromJSON)
636newtype URL = URL { getUrl :: Text } deriving (Eq, Show, ToJSON, FromJSON)
@@ -643,47 +643,47 @@ instance Monoid Swagger where
643 mempty = genericMempty
643 mempty = genericMempty
644 mappend = genericMappend
644 mappend = genericMappend
646−instance Monoid SwaggerInfo where
646+instance Monoid Info where
647 mempty = genericMempty
647 mempty = genericMempty
648 mappend = genericMappend
648 mappend = genericMappend
650−instance Monoid SwaggerPaths where
650+instance Monoid Paths where
651 mempty = genericMempty
651 mempty = genericMempty
652 mappend = genericMappend
652 mappend = genericMappend
654−instance Monoid SwaggerPathItem where
654+instance Monoid PathItem where
655 mempty = genericMempty
655 mempty = genericMempty
656 mappend = genericMappend
656 mappend = genericMappend
658−instance Monoid SwaggerSchema where
658+instance Monoid Schema where
659 mempty = genericMempty
659 mempty = genericMempty
660 mappend = genericMappend
660 mappend = genericMappend
662−instance Monoid SwaggerSchemaCommon where
662+instance Monoid SchemaCommon where
663 mempty = genericMempty
663 mempty = genericMempty
664 mappend = genericMappend
664 mappend = genericMappend
666−instance Monoid SwaggerParameter where
666+instance Monoid Parameter where
667 mempty = genericMempty
667 mempty = genericMempty
668 mappend = genericMappend
668 mappend = genericMappend
670−instance Monoid SwaggerParameterOtherSchema where
670+instance Monoid ParameterOtherSchema where
671 mempty = genericMempty
671 mempty = genericMempty
672 mappend = genericMappend
672 mappend = genericMappend
674−instance Monoid SwaggerResponses where
674+instance Monoid Responses where
675 mempty = genericMempty
675 mempty = genericMempty
676 mappend = genericMappend
676 mappend = genericMappend
678−instance Monoid SwaggerResponse where
678+instance Monoid Response where
679 mempty = genericMempty
679 mempty = genericMempty
680 mappend = genericMappend
680 mappend = genericMappend
682−instance Monoid SwaggerExternalDocs where
682+instance Monoid ExternalDocs where
683 mempty = genericMempty
683 mempty = genericMempty
684 mappend = genericMappend
684 mappend = genericMappend
686−instance Monoid SwaggerOperation where
686+instance Monoid Operation where
687 mempty = genericMempty
687 mempty = genericMempty
688 mappend = genericMappend
688 mappend = genericMappend
@@ -691,217 +691,217 @@ instance Monoid SwaggerOperation where
691-- SwaggerMonoid helper instances
691-- SwaggerMonoid helper instances
692-- =======================================================================
692-- =======================================================================
694−instance SwaggerMonoid SwaggerInfo
694+instance SwaggerMonoid Info
695−instance SwaggerMonoid SwaggerPaths
695+instance SwaggerMonoid Paths
696−instance SwaggerMonoid SwaggerPathItem
696+instance SwaggerMonoid PathItem
697−instance SwaggerMonoid SwaggerSchema
697+instance SwaggerMonoid Schema
698−instance SwaggerMonoid SwaggerSchemaCommon
698+instance SwaggerMonoid SchemaCommon
699−instance SwaggerMonoid SwaggerParameter
699+instance SwaggerMonoid Parameter
700−instance SwaggerMonoid SwaggerParameterOtherSchema
700+instance SwaggerMonoid ParameterOtherSchema
701−instance SwaggerMonoid SwaggerResponses
701+instance SwaggerMonoid Responses
702−instance SwaggerMonoid SwaggerResponse
702+instance SwaggerMonoid Response
703−instance SwaggerMonoid SwaggerExternalDocs
703+instance SwaggerMonoid ExternalDocs
704−instance SwaggerMonoid SwaggerOperation
704+instance SwaggerMonoid Operation
706−instance SwaggerMonoid SwaggerMimeList
706+instance SwaggerMonoid MimeList
707deriving instance SwaggerMonoid URL
707deriving instance SwaggerMonoid URL
709−instance SwaggerMonoid SwaggerSchemaType where
709+instance SwaggerMonoid SchemaType where
710− swaggerMempty = SwaggerSchemaNull
710+ swaggerMempty = SchemaNull
711 swaggerMappend _ y = y
711 swaggerMappend _ y = y
713−instance SwaggerMonoid SwaggerParameterType where
713+instance SwaggerMonoid ParameterType where
714− swaggerMempty = SwaggerParamString
714+ swaggerMempty = ParamString
715 swaggerMappend _ y = y
715 swaggerMappend _ y = y
717−instance SwaggerMonoid SwaggerParameterLocation where
717+instance SwaggerMonoid ParameterLocation where
718− swaggerMempty = SwaggerParameterQuery
718+ swaggerMempty = ParameterQuery
719 swaggerMappend _ y = y
719 swaggerMappend _ y = y
721−instance SwaggerMonoid (HashMap Text SwaggerSchema) where
721+instance SwaggerMonoid (HashMap Text Schema) where
722 swaggerMempty = HashMap.empty
722 swaggerMempty = HashMap.empty
723 swaggerMappend = HashMap.unionWith mappend
723 swaggerMappend = HashMap.unionWith mappend
725−instance SwaggerMonoid (HashMap Text (SwaggerReferenced SwaggerSchema)) where
725+instance SwaggerMonoid (HashMap Text (Referenced Schema)) where
726 swaggerMempty = HashMap.empty
726 swaggerMempty = HashMap.empty
727 swaggerMappend = HashMap.unionWith swaggerMappend
727 swaggerMappend = HashMap.unionWith swaggerMappend
729−instance Monoid a => SwaggerMonoid (SwaggerReferenced a) where
729+instance Monoid a => SwaggerMonoid (Referenced a) where
730− swaggerMempty = SwaggerInline mempty
730+ swaggerMempty = Inline mempty
731− swaggerMappend (SwaggerInline x) (SwaggerInline y) = SwaggerInline (x <> y)
731+ swaggerMappend (Inline x) (Inline y) = Inline (x <> y)
732 swaggerMappend _ y = y
732 swaggerMappend _ y = y
734−instance SwaggerMonoid (HashMap Text SwaggerParameter) where
734+instance SwaggerMonoid (HashMap Text Parameter) where
735 swaggerMempty = HashMap.empty
735 swaggerMempty = HashMap.empty
736 swaggerMappend = HashMap.unionWith mappend
736 swaggerMappend = HashMap.unionWith mappend
738−instance SwaggerMonoid (HashMap Text SwaggerResponse) where
738+instance SwaggerMonoid (HashMap Text Response) where
739 swaggerMempty = HashMap.empty
739 swaggerMempty = HashMap.empty
740 swaggerMappend = flip HashMap.union
740 swaggerMappend = flip HashMap.union
742−instance SwaggerMonoid (HashMap Text SwaggerSecurityScheme) where
742+instance SwaggerMonoid (HashMap Text SecurityScheme) where
743 swaggerMempty = HashMap.empty
743 swaggerMempty = HashMap.empty
744 swaggerMappend = flip HashMap.union
744 swaggerMappend = flip HashMap.union
746−instance SwaggerMonoid (HashMap FilePath SwaggerPathItem) where
746+instance SwaggerMonoid (HashMap FilePath PathItem) where
747 swaggerMempty = HashMap.empty
747 swaggerMempty = HashMap.empty
748 swaggerMappend = HashMap.unionWith mappend
748 swaggerMappend = HashMap.unionWith mappend
750−instance SwaggerMonoid (HashMap HeaderName SwaggerHeader) where
750+instance SwaggerMonoid (HashMap HeaderName Header) where
751 swaggerMempty = HashMap.empty
751 swaggerMempty = HashMap.empty
752 swaggerMappend = flip HashMap.union
752 swaggerMappend = flip HashMap.union
754−instance SwaggerMonoid (HashMap HttpStatusCode (SwaggerReferenced SwaggerResponse)) where
754+instance SwaggerMonoid (HashMap HttpStatusCode (Referenced Response)) where
755 swaggerMempty = HashMap.empty
755 swaggerMempty = HashMap.empty
756 swaggerMappend = flip HashMap.union
756 swaggerMappend = flip HashMap.union
758−instance SwaggerMonoid SwaggerParameterSchema where
758+instance SwaggerMonoid ParameterSchema where
759− swaggerMempty = SwaggerParameterOther swaggerMempty
759+ swaggerMempty = ParameterOther swaggerMempty
760− swaggerMappend (SwaggerParameterBody x) (SwaggerParameterBody y) = SwaggerParameterBody (swaggerMappend x y)
760+ swaggerMappend (ParameterBody x) (ParameterBody y) = ParameterBody (swaggerMappend x y)
761− swaggerMappend (SwaggerParameterOther x) (SwaggerParameterOther y) = SwaggerParameterOther (swaggerMappend x y)
761+ swaggerMappend (ParameterOther x) (ParameterOther y) = ParameterOther (swaggerMappend x y)
762 swaggerMappend _ y = y
762 swaggerMappend _ y = y
764-- =======================================================================
764-- =======================================================================
765-- TH derived ToJSON and FromJSON instances
765-- TH derived ToJSON and FromJSON instances
766-- =======================================================================
766-- =======================================================================
768−deriveJSON (jsonPrefix "SwaggerParameter") ''SwaggerParameterLocation
768+deriveJSON (jsonPrefix "Parameter") ''ParameterLocation
769−deriveJSON (jsonPrefix "SwaggerParam") ''SwaggerParameterType
769+deriveJSON (jsonPrefix "Param") ''ParameterType
770−deriveJSON' ''SwaggerInfo
770+deriveJSON' ''Info
771−deriveJSON' ''SwaggerContact
771+deriveJSON' ''Contact
772−deriveJSON' ''SwaggerLicense
772+deriveJSON' ''License
773−deriveJSON (jsonPrefix "SwaggerSchema") ''SwaggerSchemaType
773+deriveJSON (jsonPrefix "Schema") ''SchemaType
774−deriveJSON (jsonPrefix "SwaggerItems") ''SwaggerItemsType
774+deriveJSON (jsonPrefix "Items") ''ItemsType
775−deriveJSON (jsonPrefix "SwaggerItemsCollection") ''SwaggerItemsCollectionFormat
775+deriveJSON (jsonPrefix "ItemsCollection") ''ItemsCollectionFormat
776−deriveJSON (jsonPrefix "SwaggerCollection") ''SwaggerCollectionFormat
776+deriveJSON (jsonPrefix "Collection") ''CollectionFormat
777−deriveJSON (jsonPrefix "SwaggerApiKey") ''SwaggerApiKeyLocation
777+deriveJSON (jsonPrefix "ApiKey") ''ApiKeyLocation
778−deriveJSON (jsonPrefix "swaggerApiKey") ''SwaggerApiKeyParams
778+deriveJSON (jsonPrefix "apiKey") ''ApiKeyParams
779−deriveJSON (jsonPrefix "swaggerSchema") ''SwaggerSchemaCommon
779+deriveJSON' ''SchemaCommon
780−deriveJSONDefault ''SwaggerScheme
780+deriveJSONDefault ''Scheme
781−deriveJSON' ''SwaggerTag
781+deriveJSON' ''Tag
782−deriveJSON' ''SwaggerExternalDocs
782+deriveJSON' ''ExternalDocs
784−deriveToJSON' ''SwaggerOperation
784+deriveToJSON' ''Operation
785−deriveToJSON' ''SwaggerResponse
785+deriveToJSON' ''Response
786−deriveToJSON' ''SwaggerPathItem
786+deriveToJSON' ''PathItem
787−deriveToJSON' ''SwaggerXml
787+deriveToJSON' ''Xml
789-- =======================================================================
789-- =======================================================================
790-- Manual ToJSON instances
790-- Manual ToJSON instances
791-- =======================================================================
791-- =======================================================================
793−instance ToJSON SwaggerOAuth2Flow where
793+instance ToJSON OAuth2Flow where
794− toJSON (SwaggerOAuth2Implicit authUrl) = object
794+ toJSON (OAuth2Implicit authUrl) = object
795 [ "flow" .= ("implicit" :: Text)
795 [ "flow" .= ("implicit" :: Text)
796 , "authorizationUrl" .= authUrl ]
796 , "authorizationUrl" .= authUrl ]
797− toJSON (SwaggerOAuth2Password tokenUrl) = object
797+ toJSON (OAuth2Password tokenUrl) = object
798 [ "flow" .= ("password" :: Text)
798 [ "flow" .= ("password" :: Text)
799 , "tokenUrl" .= tokenUrl ]
799 , "tokenUrl" .= tokenUrl ]
800− toJSON (SwaggerOAuth2Application tokenUrl) = object
800+ toJSON (OAuth2Application tokenUrl) = object
801 [ "flow" .= ("application" :: Text)
801 [ "flow" .= ("application" :: Text)
802 , "tokenUrl" .= tokenUrl ]
802 , "tokenUrl" .= tokenUrl ]
803− toJSON (SwaggerOAuth2AccessCode authUrl tokenUrl) = object
803+ toJSON (OAuth2AccessCode authUrl tokenUrl) = object
804 [ "flow" .= ("accessCode" :: Text)
804 [ "flow" .= ("accessCode" :: Text)
805 , "authorizationUrl" .= authUrl
805 , "authorizationUrl" .= authUrl
806 , "tokenUrl" .= tokenUrl ]
806 , "tokenUrl" .= tokenUrl ]
808−instance ToJSON SwaggerOAuth2Params where
808+instance ToJSON OAuth2Params where
809− toJSON = genericToJSONWithSub "flow" (jsonPrefix "swaggerOAuth2")
809+ toJSON = genericToJSONWithSub "flow" (jsonPrefix "oauth2")
811−instance ToJSON SwaggerSecuritySchemeType where
811+instance ToJSON SecuritySchemeType where
812− toJSON SwaggerSecuritySchemeBasic
812+ toJSON SecuritySchemeBasic
813 = object [ "type" .= ("basic" :: Text) ]
813 = object [ "type" .= ("basic" :: Text) ]
814− toJSON (SwaggerSecuritySchemeApiKey params)
814+ toJSON (SecuritySchemeApiKey params)
815 = toJSON params
815 = toJSON params
816 <+> object [ "type" .= ("apiKey" :: Text) ]
816 <+> object [ "type" .= ("apiKey" :: Text) ]
817− toJSON (SwaggerSecuritySchemeOAuth2 params)
817+ toJSON (SecuritySchemeOAuth2 params)
818 = toJSON params
818 = toJSON params
819 <+> object [ "type" .= ("oauth2" :: Text) ]
819 <+> object [ "type" .= ("oauth2" :: Text) ]
821instance ToJSON Swagger where
821instance ToJSON Swagger where
822− toJSON = addVersion . genericToJSON (jsonPrefix "swagger")
822+ toJSON = addVersion . genericToJSON (jsonPrefix "")
824 addVersion (Object o) = Object (HashMap.insert "swagger" "2.0" o)
824 addVersion (Object o) = Object (HashMap.insert "swagger" "2.0" o)
825 addVersion _ = error "impossible"
825 addVersion _ = error "impossible"
827−instance ToJSON SwaggerSecurityScheme where
827+instance ToJSON SecurityScheme where
828− toJSON = genericToJSONWithSub "type" (jsonPrefix "swaggerSecurityScheme")
828+ toJSON = genericToJSONWithSub "type" (jsonPrefix "securityScheme")
830−instance ToJSON SwaggerSchema where
830+instance ToJSON Schema where
831− toJSON = genericToJSONWithSub "common" (jsonPrefix "swaggerSchema")
831+ toJSON = genericToJSONWithSub "schemaCommon" (jsonPrefix "schema")
833−instance ToJSON SwaggerHeader where
833+instance ToJSON Header where
834− toJSON = genericToJSONWithSub "common" (jsonPrefix "swaggerHeader")
834+ toJSON = genericToJSONWithSub "common" (jsonPrefix "header")
836−instance ToJSON SwaggerItems where
836+instance ToJSON Items where
837− toJSON = genericToJSONWithSub "common" (jsonPrefix "swaggerItems")
837+ toJSON = genericToJSONWithSub "common" (jsonPrefix "items")
839−instance ToJSON SwaggerHost where
839+instance ToJSON Host where
840− toJSON (SwaggerHost host mport) = toJSON $
840+ toJSON (Host host mport) = toJSON $
841 case mport of
841 case mport of
842 Nothing -> host
842 Nothing -> host
843 Just port -> host ++ ":" ++ show port
843 Just port -> host ++ ":" ++ show port
845−instance ToJSON SwaggerPaths where
845+instance ToJSON Paths where
846− toJSON (SwaggerPaths m) = toJSON m
846+ toJSON (Paths m) = toJSON m
848−instance ToJSON SwaggerMimeList where
848+instance ToJSON MimeList where
849− toJSON (SwaggerMimeList xs) = toJSON (map show xs)
849+ toJSON (MimeList xs) = toJSON (map show xs)
851−instance ToJSON SwaggerParameter where
851+instance ToJSON Parameter where
852− toJSON = genericToJSONWithSub "schema" (jsonPrefix "swaggerParameter")
852+ toJSON = genericToJSONWithSub "schema" (jsonPrefix "parameter")
854−instance ToJSON SwaggerParameterSchema where
854+instance ToJSON ParameterSchema where
855− toJSON (SwaggerParameterBody s) = object [ "in" .= ("body" :: Text), "schema" .= s ]
855+ toJSON (ParameterBody s) = object [ "in" .= ("body" :: Text), "schema" .= s ]
856− toJSON (SwaggerParameterOther s) = toJSON s
856+ toJSON (ParameterOther s) = toJSON s
858−instance ToJSON SwaggerParameterOtherSchema where
858+instance ToJSON ParameterOtherSchema where
859− toJSON = genericToJSONWithSub "common" (jsonPrefix "swaggerParameterOtherSchema")
859+ toJSON = genericToJSONWithSub "common" (jsonPrefix "parameterOtherSchema")
861−instance ToJSON SwaggerSchemaItems where
861+instance ToJSON SchemaItems where
862− toJSON (SwaggerSchemaItemsObject x) = toJSON x
862+ toJSON (SchemaItemsObject x) = toJSON x
863− toJSON (SwaggerSchemaItemsArray xs) = toJSON xs
863+ toJSON (SchemaItemsArray xs) = toJSON xs
865−instance ToJSON SwaggerResponses where
865+instance ToJSON Responses where
866− toJSON (SwaggerResponses def rs) = toJSON (hashMapMapKeys show rs) <+> object [ "default" .= def ]
866+ toJSON (Responses def rs) = toJSON (hashMapMapKeys show rs) <+> object [ "default" .= def ]
868−instance ToJSON SwaggerExample where
868+instance ToJSON Example where
869− toJSON = toJSON . Map.mapKeys show . getSwaggerExample
869+ toJSON = toJSON . Map.mapKeys show . getExample
871−instance ToJSON SwaggerReference where
871+instance ToJSON Reference where
872− toJSON (SwaggerReference ref) = object [ "$ref" .= ref ]
872+ toJSON (Reference ref) = object [ "$ref" .= ref ]
874−instance ToJSON a => ToJSON (SwaggerReferenced a) where
874+instance ToJSON a => ToJSON (Referenced a) where
875− toJSON (SwaggerRef ref) = toJSON ref
875+ toJSON (Ref ref) = toJSON ref
876− toJSON (SwaggerInline x) = toJSON x
876+ toJSON (Inline x) = toJSON x
878-- =======================================================================
878-- =======================================================================
879-- Manual FromJSON instances
879-- Manual FromJSON instances
880-- =======================================================================
880-- =======================================================================
882−instance FromJSON SwaggerOAuth2Flow where
882+instance FromJSON OAuth2Flow where
883 parseJSON (Object o) = do
883 parseJSON (Object o) = do
884 (flow :: Text) <- o .: "flow"
884 (flow :: Text) <- o .: "flow"
885 case flow of
885 case flow of
886− "implicit" -> SwaggerOAuth2Implicit <$> o .: "authorizationUrl"
886+ "implicit" -> OAuth2Implicit <$> o .: "authorizationUrl"
887− "password" -> SwaggerOAuth2Password <$> o .: "tokenUrl"
887+ "password" -> OAuth2Password <$> o .: "tokenUrl"
888− "application" -> SwaggerOAuth2Application <$> o .: "tokenUrl"
888+ "application" -> OAuth2Application <$> o .: "tokenUrl"
889− "accessCode" -> SwaggerOAuth2AccessCode
889+ "accessCode" -> OAuth2AccessCode
890 <$> o .: "authorizationUrl"
890 <$> o .: "authorizationUrl"
891 <*> o .: "tokenUrl"
891 <*> o .: "tokenUrl"
892 _ -> empty
892 _ -> empty
893 parseJSON _ = empty
893 parseJSON _ = empty
895−instance FromJSON SwaggerOAuth2Params where
895+instance FromJSON OAuth2Params where
896− parseJSON = genericParseJSONWithSub "flow" (jsonPrefix "swaggerOAuth2")
896+ parseJSON = genericParseJSONWithSub "flow" (jsonPrefix "oauth2")
898−instance FromJSON SwaggerSecuritySchemeType where
898+instance FromJSON SecuritySchemeType where
899 parseJSON json@(Object o) = do
899 parseJSON json@(Object o) = do
900 (t :: Text) <- o .: "type"
900 (t :: Text) <- o .: "type"
901 case t of
901 case t of
902− "basic" -> pure SwaggerSecuritySchemeBasic
902+ "basic" -> pure SecuritySchemeBasic
903− "apiKey" -> SwaggerSecuritySchemeApiKey <$> parseJSON json
903+ "apiKey" -> SecuritySchemeApiKey <$> parseJSON json
904− "oauth2" -> SwaggerSecuritySchemeOAuth2 <$> parseJSON json
904+ "oauth2" -> SecuritySchemeOAuth2 <$> parseJSON json
905 _ -> empty
905 _ -> empty
906 parseJSON _ = empty
906 parseJSON _ = empty
@@ -909,101 +909,101 @@ instance FromJSON Swagger where
909 parseJSON json@(Object o) = do
909 parseJSON json@(Object o) = do
910 (version :: Text) <- o .: "swagger"
910 (version :: Text) <- o .: "swagger"
911 when (version /= "2.0") empty
911 when (version /= "2.0") empty
912− (genericParseJSON (jsonPrefix "swagger")
912+ (genericParseJSON (jsonPrefix "")
913− `withDefaults` [ "consumes" .= (mempty :: SwaggerMimeList)
913+ `withDefaults` [ "consumes" .= (mempty :: MimeList)
914− , "produces" .= (mempty :: SwaggerMimeList)
914+ , "produces" .= (mempty :: MimeList)
915− , "security" .= ([] :: [SwaggerSecurityRequirement])
915+ , "security" .= ([] :: [SecurityRequirement])
916− , "tags" .= ([] :: [SwaggerTag])
916+ , "tags" .= ([] :: [Tag])
917− , "definitions" .= (mempty :: HashMap Text SwaggerSchema)
917+ , "definitions" .= (mempty :: HashMap Text Schema)
918− , "parameters" .= (mempty :: HashMap Text SwaggerParameter)
918+ , "parameters" .= (mempty :: HashMap Text Parameter)
919− , "responses" .= (mempty :: HashMap Text SwaggerResponse)
919+ , "responses" .= (mempty :: HashMap Text Response)
920− , "securityDefinitions" .= (mempty :: HashMap Text SwaggerSecurityScheme)
920+ , "securityDefinitions" .= (mempty :: HashMap Text SecurityScheme)
922 parseJSON _ = empty
922 parseJSON _ = empty
924−instance FromJSON SwaggerSecurityScheme where
924+instance FromJSON SecurityScheme where
925− parseJSON = genericParseJSONWithSub "type" (jsonPrefix "swaggerSecurityScheme")
925+ parseJSON = genericParseJSONWithSub "type" (jsonPrefix "securityScheme")
927−instance FromJSON SwaggerSchema where
927+instance FromJSON Schema where
928− parseJSON = genericParseJSONWithSub "common" (jsonPrefix "swaggerSchema")
928+ parseJSON = genericParseJSONWithSub "schemaCommon" (jsonPrefix "schema")
929− `withDefaults` [ "properties" .= (mempty :: HashMap Text SwaggerSchema)
929+ `withDefaults` [ "properties" .= (mempty :: HashMap Text Schema)
930− , "required" .= ([] :: [SwaggerParamName]) ]
930+ , "required" .= ([] :: [ParamName]) ]
932−instance FromJSON SwaggerHeader where
932+instance FromJSON Header where
933− parseJSON = genericParseJSONWithSub "common" (jsonPrefix "swaggerHeader")
933+ parseJSON = genericParseJSONWithSub "common" (jsonPrefix "header")
935−instance FromJSON SwaggerItems where
935+instance FromJSON Items where
936− parseJSON = genericParseJSONWithSub "common" (jsonPrefix "swaggerItems")
936+ parseJSON = genericParseJSONWithSub "common" (jsonPrefix "items")
938−instance FromJSON SwaggerHost where
938+instance FromJSON Host where
939 parseJSON (String s) =
939 parseJSON (String s) =
940 case fromInteger <$> readMaybe portStr of
940 case fromInteger <$> readMaybe portStr of
941 Nothing | not (null portStr) -> fail $ "Invalid port `" ++ portStr ++ "'"
941 Nothing | not (null portStr) -> fail $ "Invalid port `" ++ portStr ++ "'"
942− mport -> pure $ SwaggerHost host mport
942+ mport -> pure $ Host host mport
944 (hostText, portText) = Text.breakOn ":" s
944 (hostText, portText) = Text.breakOn ":" s
945 [host, portStr] = map Text.unpack [hostText, portText]
945 [host, portStr] = map Text.unpack [hostText, portText]
946 parseJSON _ = empty
946 parseJSON _ = empty
948−instance FromJSON SwaggerPaths where
948+instance FromJSON Paths where
949− parseJSON json = SwaggerPaths <$> parseJSON json
949+ parseJSON json = Paths <$> parseJSON json
951−instance FromJSON SwaggerMimeList where
951+instance FromJSON MimeList where
952− parseJSON json = (SwaggerMimeList . map fromString) <$> parseJSON json
952+ parseJSON json = (MimeList . map fromString) <$> parseJSON json
954−instance FromJSON SwaggerParameter where
954+instance FromJSON Parameter where
955− parseJSON = genericParseJSONWithSub "schema" (jsonPrefix "swaggerParameter")
955+ parseJSON = genericParseJSONWithSub "schema" (jsonPrefix "parameter")
957−instance FromJSON SwaggerParameterSchema where
957+instance FromJSON ParameterSchema where
958 parseJSON json@(Object o) = do
958 parseJSON json@(Object o) = do
959 (i :: Text) <- o .: "in"
959 (i :: Text) <- o .: "in"
960 case i of
960 case i of
961 "body" -> do
961 "body" -> do
962 schema <- o .: "schema"
962 schema <- o .: "schema"
963− SwaggerParameterBody <$> parseJSON schema
963+ ParameterBody <$> parseJSON schema
964− _ -> SwaggerParameterOther <$> parseJSON json
964+ _ -> ParameterOther <$> parseJSON json
965 parseJSON _ = empty
965 parseJSON _ = empty
967−instance FromJSON SwaggerParameterOtherSchema where
967+instance FromJSON ParameterOtherSchema where
968− parseJSON = genericParseJSONWithSub "common" (jsonPrefix "swaggerParameterOtherSchema")
968+ parseJSON = genericParseJSONWithSub "common" (jsonPrefix "parameterOtherSchema")
970−instance FromJSON SwaggerSchemaItems where
970+instance FromJSON SchemaItems where
971− parseJSON json@(Object _) = SwaggerSchemaItemsObject <$> parseJSON json
971+ parseJSON json@(Object _) = SchemaItemsObject <$> parseJSON json
972− parseJSON json@(Array _) = SwaggerSchemaItemsArray <$> parseJSON json
972+ parseJSON json@(Array _) = SchemaItemsArray <$> parseJSON json
973 parseJSON _ = empty
973 parseJSON _ = empty
975−instance FromJSON SwaggerResponses where
975+instance FromJSON Responses where
976− parseJSON (Object o) = SwaggerResponses
976+ parseJSON (Object o) = Responses
977 <$> o .:? "default"
977 <$> o .:? "default"
978 <*> (parseJSON (Object (HashMap.delete "default" o)) >>= hashMapReadKeys)
978 <*> (parseJSON (Object (HashMap.delete "default" o)) >>= hashMapReadKeys)
979 parseJSON _ = empty
979 parseJSON _ = empty
981−instance FromJSON SwaggerExample where
981+instance FromJSON Example where
982 parseJSON json = do
982 parseJSON json = do
983 m <- parseJSON json
983 m <- parseJSON json
984− pure $ SwaggerExample (Map.mapKeys fromString m)
984+ pure $ Example (Map.mapKeys fromString m)
986−instance FromJSON SwaggerResponse where
986+instance FromJSON Response where
987− parseJSON = genericParseJSON (jsonPrefix "swaggerResponse")
987+ parseJSON = genericParseJSON (jsonPrefix "response")
988− `withDefaults` [ "headers" .= (mempty :: HashMap HeaderName SwaggerHeader) ]
988+ `withDefaults` [ "headers" .= (mempty :: HashMap HeaderName Header) ]
990−instance FromJSON SwaggerOperation where
990+instance FromJSON Operation where
991− parseJSON = genericParseJSON (jsonPrefix "swaggerOperation")
991+ parseJSON = genericParseJSON (jsonPrefix "operation")
992− `withDefaults` [ "security" .= ([] :: [SwaggerSecurityRequirement]) ]
992+ `withDefaults` [ "security" .= ([] :: [SecurityRequirement]) ]
994−instance FromJSON SwaggerPathItem where
994+instance FromJSON PathItem where
995− parseJSON = genericParseJSON (jsonPrefix "swaggerPathItem")
995+ parseJSON = genericParseJSON (jsonPrefix "pathItem")
996− `withDefaults` [ "parameters" .= ([] :: [SwaggerParameter]) ]
996+ `withDefaults` [ "parameters" .= ([] :: [Parameter]) ]
998−instance FromJSON SwaggerReference where
998+instance FromJSON Reference where
999− parseJSON (Object o) = SwaggerReference <$> o .: "$ref"
999+ parseJSON (Object o) = Reference <$> o .: "$ref"
1000 parseJSON _ = empty
1000 parseJSON _ = empty
1002−instance FromJSON a => FromJSON (SwaggerReferenced a) where
1002+instance FromJSON a => FromJSON (Referenced a) where
1003 parseJSON json
1003 parseJSON json
1004− = SwaggerRef <$> parseJSON json
1004+ = Ref <$> parseJSON json
1005− <|> SwaggerInline <$> parseJSON json
1005+ <|> Inline <$> parseJSON json
1007−instance FromJSON SwaggerXml where
1007+instance FromJSON Xml where
1008− parseJSON = genericParseJSON (jsonPrefix "swaggerXml")
1008+ parseJSON = genericParseJSON (jsonPrefix "xml")