git.iko.soy/typeable/openapi3
on master help sign in
Add Eq instances
e41e388Nickolay Kudasov
src/Data/Swagger/Internal.hs+37−37
@@ -87,7 +87,7 @@ data Swagger = Swagger
87
87
88 -- | Additional external documentation.
88 -- | Additional external documentation.
89 , swaggerExternalDocs :: SwaggerExternalDocs
89 , swaggerExternalDocs :: SwaggerExternalDocs
90− } deriving (Show, Generic)
90+ } deriving (Eq, Show, Generic)
91
91
92-- | The object provides metadata about the API.
92-- | The object provides metadata about the API.
93-- The metadata can be used by the clients if needed,
93-- The metadata can be used by the clients if needed,
@@ -112,7 +112,7 @@ data SwaggerInfo = SwaggerInfo
112 -- | Provides the version of the application API
112 -- | Provides the version of the application API
113 -- (not to be confused with the specification version).
113 -- (not to be confused with the specification version).
114 , swaggerInfoVersion :: Text
114 , swaggerInfoVersion :: Text
115− } deriving (Show)
115+ } deriving (Eq, Show)
116
116
117-- | Contact information for the exposed API.
117-- | Contact information for the exposed API.
118data SwaggerContact = SwaggerContact
118data SwaggerContact = SwaggerContact
@@ -124,7 +124,7 @@ data SwaggerContact = SwaggerContact
124
124
125 -- | The email address of the contact person/organization.
125 -- | The email address of the contact person/organization.
126 , swaggerContactEmail :: Maybe Text
126 , swaggerContactEmail :: Maybe Text
127− } deriving (Show)
127+ } deriving (Eq, Show)
128
128
129-- | License information for the exposed API.
129-- | License information for the exposed API.
130data SwaggerLicense = SwaggerLicense
130data SwaggerLicense = SwaggerLicense
@@ -133,13 +133,13 @@ data SwaggerLicense = SwaggerLicense
133
133
134 -- | A URL to the license used for the API.
134 -- | A URL to the license used for the API.
135 , swaggerLicenseUrl :: Maybe URL
135 , swaggerLicenseUrl :: Maybe URL
136− } deriving (Show)
136+ } deriving (Eq, Show)
137
137
138-- | The host (name or ip) serving the API. It MAY include a port.
138-- | The host (name or ip) serving the API. It MAY include a port.
139data SwaggerHost = SwaggerHost
139data SwaggerHost = SwaggerHost
140 { swaggerHostName :: HostName -- ^ Host name.
140 { swaggerHostName :: HostName -- ^ Host name.
141 , swaggerHostPort :: Maybe PortNumber -- ^ Optional port.
141 , swaggerHostPort :: Maybe PortNumber -- ^ Optional port.
142− } deriving (Show)
142+ } deriving (Eq, Show)
143
143
144-- | The transfer protocol of the API.
144-- | The transfer protocol of the API.
145data SwaggerScheme
145data SwaggerScheme
@@ -147,14 +147,14 @@ data SwaggerScheme
147 | Https
147 | Https
148 | Ws
148 | Ws
149 | Wss
149 | Wss
150− deriving (Show)
150+ deriving (Eq, Show)
151
151
152-- | The available paths and operations for the API.
152-- | The available paths and operations for the API.
153data SwaggerPaths = SwaggerPaths
153data SwaggerPaths = SwaggerPaths
154 { -- | Holds the relative paths to the individual endpoints.
154 { -- | Holds the relative paths to the individual endpoints.
155 -- The path is appended to the @'swaggerBasePath'@ in order to construct the full URL.
155 -- The path is appended to the @'swaggerBasePath'@ in order to construct the full URL.
156 swaggerPathsMap :: HashMap FilePath SwaggerPathItem
156 swaggerPathsMap :: HashMap FilePath SwaggerPathItem
157− } deriving (Show)
157+ } deriving (Eq, Show)
158
158
159-- | Describes the operations available on a single path.
159-- | Describes the operations available on a single path.
160-- A @'SwaggerPathItem'@ may be empty, due to ACL constraints.
160-- A @'SwaggerPathItem'@ may be empty, due to ACL constraints.
@@ -187,7 +187,7 @@ data SwaggerPathItem = SwaggerPathItem
187 -- The list MUST NOT include duplicated parameters.
187 -- The list MUST NOT include duplicated parameters.
188 -- A unique parameter is defined by a combination of a name and location.
188 -- A unique parameter is defined by a combination of a name and location.
189 , swaggerPathItemParameters :: [SwaggerParameter]
189 , swaggerPathItemParameters :: [SwaggerParameter]
190− } deriving (Show)
190+ } deriving (Eq, Show)
191
191
192-- | Describes a single API operation on a path.
192-- | Describes a single API operation on a path.
193data SwaggerOperation = SwaggerOperation
193data SwaggerOperation = SwaggerOperation
@@ -247,10 +247,10 @@ data SwaggerOperation = SwaggerOperation
247 -- This definition overrides any declared top-level security.
247 -- This definition overrides any declared top-level security.
248 -- To remove a top-level security declaration, @Just []@ can be used.
248 -- To remove a top-level security declaration, @Just []@ can be used.
249 , swaggerOperationSecurity :: [SwaggerSecurityRequirement]
249 , swaggerOperationSecurity :: [SwaggerSecurityRequirement]
250− } deriving (Show)
250+ } deriving (Eq, Show)
251
251
252newtype SwaggerMimeList = SwaggerMimeList { getSwaggerMimeList :: [MediaType] }
252newtype SwaggerMimeList = SwaggerMimeList { getSwaggerMimeList :: [MediaType] }
253− deriving (Show)
253+ deriving (Eq, Show)
254
254
255-- | Describes a single operation parameter.
255-- | Describes a single operation parameter.
256-- A unique parameter is defined by a combination of a name and location.
256-- A unique parameter is defined by a combination of a name and location.
@@ -271,12 +271,12 @@ data SwaggerParameter = SwaggerParameter
271
271
272 -- | Parameter schema.
272 -- | Parameter schema.
273 , swaggerParameterSchema :: SwaggerParameterSchema
273 , swaggerParameterSchema :: SwaggerParameterSchema
274− } deriving (Show, Generic)
274+ } deriving (Eq, Show, Generic)
275
275
276data SwaggerParameterSchema
276data SwaggerParameterSchema
277 = SwaggerParameterBody SwaggerSchema
277 = SwaggerParameterBody SwaggerSchema
278 | SwaggerParameterOther SwaggerParameterOtherSchema
278 | SwaggerParameterOther SwaggerParameterOtherSchema
279− deriving (Show)
279+ deriving (Eq, Show)
280
280
281data SwaggerParameterOtherSchema = SwaggerParameterOtherSchema
281data SwaggerParameterOtherSchema = SwaggerParameterOtherSchema
282 { -- | The location of the parameter.
282 { -- | The location of the parameter.
@@ -308,7 +308,7 @@ data SwaggerParameterOtherSchema = SwaggerParameterOtherSchema
308 , swaggerParameterOtherSchemaCollectionFormat :: Maybe SwaggerCollectionFormat
308 , swaggerParameterOtherSchemaCollectionFormat :: Maybe SwaggerCollectionFormat
309
309
310 , swaggerParameterOtherSchemaCommon :: SwaggerSchemaCommon
310 , swaggerParameterOtherSchemaCommon :: SwaggerSchemaCommon
311− } deriving (Show, Generic)
311+ } deriving (Eq, Show, Generic)
312
312
313data SwaggerParameterType
313data SwaggerParameterType
314 = SwaggerParamString
314 = SwaggerParamString
@@ -317,7 +317,7 @@ data SwaggerParameterType
317 | SwaggerParamBoolean
317 | SwaggerParamBoolean
318 | SwaggerParamArray
318 | SwaggerParamArray
319 | SwaggerParamFile
319 | SwaggerParamFile
320− deriving (Show)
320+ deriving (Eq, Show)
321
321
322data SwaggerParameterLocation
322data SwaggerParameterLocation
323 = -- | Parameters that are appended to the URL.
323 = -- | Parameters that are appended to the URL.
@@ -337,7 +337,7 @@ data SwaggerParameterLocation
337 -- Form parameters have a different format based on the content-type used
337 -- Form parameters have a different format based on the content-type used
338 -- (for further details, consult <http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4>).
338 -- (for further details, consult <http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4>).
339 | SwaggerParameterFormData
339 | SwaggerParameterFormData
340− deriving (Show)
340+ deriving (Eq, Show)
341
341
342type SwaggerFormat = Text
342type SwaggerFormat = Text
343
343
@@ -350,7 +350,7 @@ data SwaggerCollectionFormat
350 | SwaggerCollectionMulti -- ^ Corresponds to multiple parameter instances
350 | SwaggerCollectionMulti -- ^ Corresponds to multiple parameter instances
351 -- instead of multiple values for a single instance @foo=bar&foo=baz@.
351 -- instead of multiple values for a single instance @foo=bar&foo=baz@.
352 -- This is valid only for parameters in @'SwaggerParameterQuery'@ or @'SwaggerParameterFormData'@.
352 -- This is valid only for parameters in @'SwaggerParameterQuery'@ or @'SwaggerParameterFormData'@.
353− deriving (Show)
353+ deriving (Eq, Show)
354
354
355data SwaggerItemsType
355data SwaggerItemsType
356 = SwaggerItemsString
356 = SwaggerItemsString
@@ -358,7 +358,7 @@ data SwaggerItemsType
358 | SwaggerItemsInteger
358 | SwaggerItemsInteger
359 | SwaggerItemsBoolean
359 | SwaggerItemsBoolean
360 | SwaggerItemsArray
360 | SwaggerItemsArray
361− deriving (Show)
361+ deriving (Eq, Show)
362
362
363data SwaggerSchemaType
363data SwaggerSchemaType
364 = SwaggerSchemaArray
364 = SwaggerSchemaArray
@@ -368,7 +368,7 @@ data SwaggerSchemaType
368 | SwaggerSchemaNull
368 | SwaggerSchemaNull
369 | SwaggerSchemaObject
369 | SwaggerSchemaObject
370 | SwaggerSchemaString
370 | SwaggerSchemaString
371− deriving (Show)
371+ deriving (Eq, Show)
372
372
373-- | Determines the format of the nested array.
373-- | Determines the format of the nested array.
374data SwaggerItemsCollectionFormat
374data SwaggerItemsCollectionFormat
@@ -376,7 +376,7 @@ data SwaggerItemsCollectionFormat
376 | SwaggerItemsCollectionSSV -- ^ Space separated values: @foo bar@.
376 | SwaggerItemsCollectionSSV -- ^ Space separated values: @foo bar@.
377 | SwaggerItemsCollectionTSV -- ^ Tab separated values: @foo\\tbar@.
377 | SwaggerItemsCollectionTSV -- ^ Tab separated values: @foo\\tbar@.
378 | SwaggerItemsCollectionPipes -- ^ Pipe separated values: @foo|bar@.
378 | SwaggerItemsCollectionPipes -- ^ Pipe separated values: @foo|bar@.
379− deriving (Show)
379+ deriving (Eq, Show)
380
380
381data SwaggerSchema = SwaggerSchema
381data SwaggerSchema = SwaggerSchema
382 { swaggerSchemaType :: SwaggerSchemaType
382 { swaggerSchemaType :: SwaggerSchemaType
@@ -400,12 +400,12 @@ data SwaggerSchema = SwaggerSchema
400 , swaggerSchemaMinProperties :: Maybe Integer
400 , swaggerSchemaMinProperties :: Maybe Integer
401
401
402 , swaggerSchemaCommon :: SwaggerSchemaCommon
402 , swaggerSchemaCommon :: SwaggerSchemaCommon
403− } deriving (Show, Generic)
403+ } deriving (Eq, Show, Generic)
404
404
405data SwaggerSchemaItems
405data SwaggerSchemaItems
406 = SwaggerSchemaItemsObject SwaggerSchema
406 = SwaggerSchemaItemsObject SwaggerSchema
407 | SwaggerSchemaItemsArray [SwaggerSchema]
407 | SwaggerSchemaItemsArray [SwaggerSchema]
408− deriving (Show)
408+ deriving (Eq, Show)
409
409
410data SwaggerSchemaCommon = SwaggerSchemaCommon
410data SwaggerSchemaCommon = SwaggerSchemaCommon
411 { -- | Declares the value of the parameter that the server will use if none is provided,
411 { -- | Declares the value of the parameter that the server will use if none is provided,
@@ -427,7 +427,7 @@ data SwaggerSchemaCommon = SwaggerSchemaCommon
427 , swaggerSchemaUniqueItems :: Maybe Bool
427 , swaggerSchemaUniqueItems :: Maybe Bool
428 , swaggerSchemaEnum :: Maybe [Value]
428 , swaggerSchemaEnum :: Maybe [Value]
429 , swaggerSchemaMultipleOf :: Maybe Integer
429 , swaggerSchemaMultipleOf :: Maybe Integer
430− } deriving (Show, Generic)
430+ } deriving (Eq, Show, Generic)
431
431
432data SwaggerXml = SwaggerXml
432data SwaggerXml = SwaggerXml
433 { -- | Replaces the name of the element/attribute used for the described schema property.
433 { -- | Replaces the name of the element/attribute used for the described schema property.
@@ -455,7 +455,7 @@ data SwaggerXml = SwaggerXml
455 -- Default value is @False@.
455 -- Default value is @False@.
456 -- The definition takes effect only when defined alongside type being array (outside the items).
456 -- The definition takes effect only when defined alongside type being array (outside the items).
457 , swaggerXmlWrapped :: Bool
457 , swaggerXmlWrapped :: Bool
458− } deriving (Show)
458+ } deriving (Eq, Show)
459
459
460data SwaggerItems = SwaggerItems
460data SwaggerItems = SwaggerItems
461 { -- | The internal type of the array.
461 { -- | The internal type of the array.
@@ -473,7 +473,7 @@ data SwaggerItems = SwaggerItems
473 , swaggerItemsCollectionFormat :: SwaggerItemsCollectionFormat
473 , swaggerItemsCollectionFormat :: SwaggerItemsCollectionFormat
474
474
475 , swaggerItemsCommon :: SwaggerSchemaCommon
475 , swaggerItemsCommon :: SwaggerSchemaCommon
476− } deriving (Show, Generic)
476+ } deriving (Eq, Show, Generic)
477
477
478-- | A container for the expected responses of an operation.
478-- | A container for the expected responses of an operation.
479-- The container maps a HTTP response code to the expected response.
479-- The container maps a HTTP response code to the expected response.
@@ -488,7 +488,7 @@ data SwaggerResponses = SwaggerResponses
488 -- | Any HTTP status code can be used as the property name (one property per HTTP status code).
488 -- | Any HTTP status code can be used as the property name (one property per HTTP status code).
489 -- Describes the expected response for those HTTP status codes.
489 -- Describes the expected response for those HTTP status codes.
490 , swaggerResponsesResponses :: HashMap HttpStatusCode SwaggerResponse
490 , swaggerResponsesResponses :: HashMap HttpStatusCode SwaggerResponse
491− } deriving (Show)
491+ } deriving (Eq, Show)
492
492
493type HttpStatusCode = Int
493type HttpStatusCode = Int
494
494
@@ -510,7 +510,7 @@ data SwaggerResponse = SwaggerResponse
510
510
511 -- | An example of the response message.
511 -- | An example of the response message.
512 , swaggerResponseExamples :: Maybe SwaggerExample
512 , swaggerResponseExamples :: Maybe SwaggerExample
513− } deriving (Show)
513+ } deriving (Eq, Show)
514
514
515type HeaderName = Text
515type HeaderName = Text
516
516
@@ -533,16 +533,16 @@ data SwaggerHeader = SwaggerHeader
533 , swaggerHeaderCollectionFormat :: SwaggerItemsCollectionFormat
533 , swaggerHeaderCollectionFormat :: SwaggerItemsCollectionFormat
534
534
535 , swaggerHeaderCommon :: SwaggerSchemaCommon
535 , swaggerHeaderCommon :: SwaggerSchemaCommon
536− } deriving (Show, Generic)
536+ } deriving (Eq, Show, Generic)
537
537
538data SwaggerExample = SwaggerExample { getSwaggerExample :: Map MediaType Value }
538data SwaggerExample = SwaggerExample { getSwaggerExample :: Map MediaType Value }
539− deriving (Show)
539+ deriving (Eq, Show)
540
540
541-- | The location of the API key.
541-- | The location of the API key.
542data SwaggerApiKeyLocation
542data SwaggerApiKeyLocation
543 = SwaggerApiKeyQuery
543 = SwaggerApiKeyQuery
544 | SwaggerApiKeyHeader
544 | SwaggerApiKeyHeader
545− deriving (Show)
545+ deriving (Eq, Show)
546
546
547data SwaggerApiKeyParams = SwaggerApiKeyParams
547data SwaggerApiKeyParams = SwaggerApiKeyParams
548 { -- | The name of the header or query parameter to be used.
548 { -- | The name of the header or query parameter to be used.
@@ -550,7 +550,7 @@ data SwaggerApiKeyParams = SwaggerApiKeyParams
550
550
551 -- | The location of the API key.
551 -- | The location of the API key.
552 , swaggerApiKeyIn :: SwaggerApiKeyLocation
552 , swaggerApiKeyIn :: SwaggerApiKeyLocation
553− } deriving (Show)
553+ } deriving (Eq, Show)
554
554
555-- | The authorization URL to be used for OAuth2 flow. This SHOULD be in the form of a URL.
555-- | The authorization URL to be used for OAuth2 flow. This SHOULD be in the form of a URL.
556type AuthorizationURL = Text
556type AuthorizationURL = Text
@@ -563,7 +563,7 @@ data SwaggerOAuth2Flow
563 | SwaggerOAuth2Password TokenURL
563 | SwaggerOAuth2Password TokenURL
564 | SwaggerOAuth2Application TokenURL
564 | SwaggerOAuth2Application TokenURL
565 | SwaggerOAuth2AccessCode AuthorizationURL TokenURL
565 | SwaggerOAuth2AccessCode AuthorizationURL TokenURL
566− deriving (Show)
566+ deriving (Eq, Show)
567
567
568data SwaggerOAuth2Params = SwaggerOAuth2Params
568data SwaggerOAuth2Params = SwaggerOAuth2Params
569 { -- | The flow used by the OAuth2 security scheme.
569 { -- | The flow used by the OAuth2 security scheme.
@@ -571,13 +571,13 @@ data SwaggerOAuth2Params = SwaggerOAuth2Params
571
571
572 -- | The available scopes for the OAuth2 security scheme.
572 -- | The available scopes for the OAuth2 security scheme.
573 , swaggerOAuth2Scopes :: HashMap Text Text
573 , swaggerOAuth2Scopes :: HashMap Text Text
574− } deriving (Show, Generic)
574+ } deriving (Eq, Show, Generic)
575
575
576data SwaggerSecuritySchemeType
576data SwaggerSecuritySchemeType
577 = SwaggerSecuritySchemeBasic
577 = SwaggerSecuritySchemeBasic
578 | SwaggerSecuritySchemeApiKey SwaggerApiKeyParams
578 | SwaggerSecuritySchemeApiKey SwaggerApiKeyParams
579 | SwaggerSecuritySchemeOAuth2 SwaggerOAuth2Params
579 | SwaggerSecuritySchemeOAuth2 SwaggerOAuth2Params
580− deriving (Show)
580+ deriving (Eq, Show)
581
581
582data SwaggerSecuritySchemeTypeName
582data SwaggerSecuritySchemeTypeName
583 = SwaggerSecuritySchemeTypeBasic
583 = SwaggerSecuritySchemeTypeBasic
@@ -604,7 +604,7 @@ data SwaggerSecurityScheme = SwaggerSecurityScheme
604
604
605 -- | A short description for security scheme.
605 -- | A short description for security scheme.
606 , swaggerSecuritySchemeDescription :: Maybe Text
606 , swaggerSecuritySchemeDescription :: Maybe Text
607− } deriving (Show, Generic)
607+ } deriving (Eq, Show, Generic)
608
608
609-- | Lists the required security schemes to execute this operation.
609-- | Lists the required security schemes to execute this operation.
610-- The object can have multiple security schemes declared in it which are all required
610-- The object can have multiple security schemes declared in it which are all required
@@ -625,7 +625,7 @@ data SwaggerTag = SwaggerTag
625
625
626 -- | Additional external documentation for this tag.
626 -- | Additional external documentation for this tag.
627 , swaggerTagExternalDocs :: Maybe SwaggerExternalDocs
627 , swaggerTagExternalDocs :: Maybe SwaggerExternalDocs
628− } deriving (Show)
628+ } deriving (Eq, Show)
629
629
630-- | Allows referencing an external resource for extended documentation.
630-- | Allows referencing an external resource for extended documentation.
631data SwaggerExternalDocs = SwaggerExternalDocs
631data SwaggerExternalDocs = SwaggerExternalDocs
@@ -635,9 +635,9 @@ data SwaggerExternalDocs = SwaggerExternalDocs
635
635
636 -- | The URL for the target documentation.
636 -- | The URL for the target documentation.
637 , swaggerExternalDocsUrl :: URL
637 , swaggerExternalDocsUrl :: URL
638− } deriving (Show)
638+ } deriving (Eq, Show)
639
639
640−newtype URL = URL { getUrl :: Text } deriving (Show, ToJSON, FromJSON)
640+newtype URL = URL { getUrl :: Text } deriving (Eq, Show, ToJSON, FromJSON)
641
641
642-- =======================================================================
642-- =======================================================================
643-- TH derived ToJSON and FromJSON instances
643-- TH derived ToJSON and FromJSON instances