git.iko.soy/typeable/openapi3
on master help sign in
Add Eq instances
commite41e3887df3eafbc7602fba326c84df9b0a6066a authorNickolay Kudasov <nickolay.kudasov@gmail.com> dateSat 7 Nov 2015, 18:35 (11 years ago) parent3f343ca
1 file changed+37−37
src/Data/Swagger/Internal.hs+37−37
src/Data/Swagger/Internal.hs+37−37
@@ -87,7 +87,7 @@ data Swagger = Swagger
8787
8888 -- | Additional external documentation.
8989 , swaggerExternalDocs :: SwaggerExternalDocs
90− } deriving (Show, Generic)
90+ } deriving (Eq, Show, Generic)
9191
9292-- | The object provides metadata about the API.
9393-- The metadata can be used by the clients if needed,
@@ -112,7 +112,7 @@ data SwaggerInfo = SwaggerInfo
112112 -- | Provides the version of the application API
113113 -- (not to be confused with the specification version).
114114 , swaggerInfoVersion :: Text
115− } deriving (Show)
115+ } deriving (Eq, Show)
116116
117117-- | Contact information for the exposed API.
118118data SwaggerContact = SwaggerContact
@@ -124,7 +124,7 @@ data SwaggerContact = SwaggerContact
124124
125125 -- | The email address of the contact person/organization.
126126 , swaggerContactEmail :: Maybe Text
127− } deriving (Show)
127+ } deriving (Eq, Show)
128128
129129-- | License information for the exposed API.
130130data SwaggerLicense = SwaggerLicense
@@ -133,13 +133,13 @@ data SwaggerLicense = SwaggerLicense
133133
134134 -- | A URL to the license used for the API.
135135 , swaggerLicenseUrl :: Maybe URL
136− } deriving (Show)
136+ } deriving (Eq, Show)
137137
138138-- | The host (name or ip) serving the API. It MAY include a port.
139139data SwaggerHost = SwaggerHost
140140 { swaggerHostName :: HostName -- ^ Host name.
141141 , swaggerHostPort :: Maybe PortNumber -- ^ Optional port.
142− } deriving (Show)
142+ } deriving (Eq, Show)
143143
144144-- | The transfer protocol of the API.
145145data SwaggerScheme
@@ -147,14 +147,14 @@ data SwaggerScheme
147147 | Https
148148 | Ws
149149 | Wss
150− deriving (Show)
150+ deriving (Eq, Show)
151151
152152-- | The available paths and operations for the API.
153153data SwaggerPaths = SwaggerPaths
154154 { -- | Holds the relative paths to the individual endpoints.
155155 -- The path is appended to the @'swaggerBasePath'@ in order to construct the full URL.
156156 swaggerPathsMap :: HashMap FilePath SwaggerPathItem
157− } deriving (Show)
157+ } deriving (Eq, Show)
158158
159159-- | Describes the operations available on a single path.
160160-- A @'SwaggerPathItem'@ may be empty, due to ACL constraints.
@@ -187,7 +187,7 @@ data SwaggerPathItem = SwaggerPathItem
187187 -- The list MUST NOT include duplicated parameters.
188188 -- A unique parameter is defined by a combination of a name and location.
189189 , swaggerPathItemParameters :: [SwaggerParameter]
190− } deriving (Show)
190+ } deriving (Eq, Show)
191191
192192-- | Describes a single API operation on a path.
193193data SwaggerOperation = SwaggerOperation
@@ -247,10 +247,10 @@ data SwaggerOperation = SwaggerOperation
247247 -- This definition overrides any declared top-level security.
248248 -- To remove a top-level security declaration, @Just []@ can be used.
249249 , swaggerOperationSecurity :: [SwaggerSecurityRequirement]
250− } deriving (Show)
250+ } deriving (Eq, Show)
251251
252252newtype SwaggerMimeList = SwaggerMimeList { getSwaggerMimeList :: [MediaType] }
253− deriving (Show)
253+ deriving (Eq, Show)
254254
255255-- | Describes a single operation parameter.
256256-- A unique parameter is defined by a combination of a name and location.
@@ -271,12 +271,12 @@ data SwaggerParameter = SwaggerParameter
271271
272272 -- | Parameter schema.
273273 , swaggerParameterSchema :: SwaggerParameterSchema
274− } deriving (Show, Generic)
274+ } deriving (Eq, Show, Generic)
275275
276276data SwaggerParameterSchema
277277 = SwaggerParameterBody SwaggerSchema
278278 | SwaggerParameterOther SwaggerParameterOtherSchema
279− deriving (Show)
279+ deriving (Eq, Show)
280280
281281data SwaggerParameterOtherSchema = SwaggerParameterOtherSchema
282282 { -- | The location of the parameter.
@@ -308,7 +308,7 @@ data SwaggerParameterOtherSchema = SwaggerParameterOtherSchema
308308 , swaggerParameterOtherSchemaCollectionFormat :: Maybe SwaggerCollectionFormat
309309
310310 , swaggerParameterOtherSchemaCommon :: SwaggerSchemaCommon
311− } deriving (Show, Generic)
311+ } deriving (Eq, Show, Generic)
312312
313313data SwaggerParameterType
314314 = SwaggerParamString
@@ -317,7 +317,7 @@ data SwaggerParameterType
317317 | SwaggerParamBoolean
318318 | SwaggerParamArray
319319 | SwaggerParamFile
320− deriving (Show)
320+ deriving (Eq, Show)
321321
322322data SwaggerParameterLocation
323323 = -- | Parameters that are appended to the URL.
@@ -337,7 +337,7 @@ data SwaggerParameterLocation
337337 -- Form parameters have a different format based on the content-type used
338338 -- (for further details, consult <http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4>).
339339 | SwaggerParameterFormData
340− deriving (Show)
340+ deriving (Eq, Show)
341341
342342type SwaggerFormat = Text
343343
@@ -350,7 +350,7 @@ data SwaggerCollectionFormat
350350 | SwaggerCollectionMulti -- ^ Corresponds to multiple parameter instances
351351 -- instead of multiple values for a single instance @foo=bar&foo=baz@.
352352 -- This is valid only for parameters in @'SwaggerParameterQuery'@ or @'SwaggerParameterFormData'@.
353− deriving (Show)
353+ deriving (Eq, Show)
354354
355355data SwaggerItemsType
356356 = SwaggerItemsString
@@ -358,7 +358,7 @@ data SwaggerItemsType
358358 | SwaggerItemsInteger
359359 | SwaggerItemsBoolean
360360 | SwaggerItemsArray
361− deriving (Show)
361+ deriving (Eq, Show)
362362
363363data SwaggerSchemaType
364364 = SwaggerSchemaArray
@@ -368,7 +368,7 @@ data SwaggerSchemaType
368368 | SwaggerSchemaNull
369369 | SwaggerSchemaObject
370370 | SwaggerSchemaString
371− deriving (Show)
371+ deriving (Eq, Show)
372372
373373-- | Determines the format of the nested array.
374374data SwaggerItemsCollectionFormat
@@ -376,7 +376,7 @@ data SwaggerItemsCollectionFormat
376376 | SwaggerItemsCollectionSSV -- ^ Space separated values: @foo bar@.
377377 | SwaggerItemsCollectionTSV -- ^ Tab separated values: @foo\\tbar@.
378378 | SwaggerItemsCollectionPipes -- ^ Pipe separated values: @foo|bar@.
379− deriving (Show)
379+ deriving (Eq, Show)
380380
381381data SwaggerSchema = SwaggerSchema
382382 { swaggerSchemaType :: SwaggerSchemaType
@@ -400,12 +400,12 @@ data SwaggerSchema = SwaggerSchema
400400 , swaggerSchemaMinProperties :: Maybe Integer
401401
402402 , swaggerSchemaCommon :: SwaggerSchemaCommon
403− } deriving (Show, Generic)
403+ } deriving (Eq, Show, Generic)
404404
405405data SwaggerSchemaItems
406406 = SwaggerSchemaItemsObject SwaggerSchema
407407 | SwaggerSchemaItemsArray [SwaggerSchema]
408− deriving (Show)
408+ deriving (Eq, Show)
409409
410410data SwaggerSchemaCommon = SwaggerSchemaCommon
411411 { -- | Declares the value of the parameter that the server will use if none is provided,
@@ -427,7 +427,7 @@ data SwaggerSchemaCommon = SwaggerSchemaCommon
427427 , swaggerSchemaUniqueItems :: Maybe Bool
428428 , swaggerSchemaEnum :: Maybe [Value]
429429 , swaggerSchemaMultipleOf :: Maybe Integer
430− } deriving (Show, Generic)
430+ } deriving (Eq, Show, Generic)
431431
432432data SwaggerXml = SwaggerXml
433433 { -- | Replaces the name of the element/attribute used for the described schema property.
@@ -455,7 +455,7 @@ data SwaggerXml = SwaggerXml
455455 -- Default value is @False@.
456456 -- The definition takes effect only when defined alongside type being array (outside the items).
457457 , swaggerXmlWrapped :: Bool
458− } deriving (Show)
458+ } deriving (Eq, Show)
459459
460460data SwaggerItems = SwaggerItems
461461 { -- | The internal type of the array.
@@ -473,7 +473,7 @@ data SwaggerItems = SwaggerItems
473473 , swaggerItemsCollectionFormat :: SwaggerItemsCollectionFormat
474474
475475 , swaggerItemsCommon :: SwaggerSchemaCommon
476− } deriving (Show, Generic)
476+ } deriving (Eq, Show, Generic)
477477
478478-- | A container for the expected responses of an operation.
479479-- The container maps a HTTP response code to the expected response.
@@ -488,7 +488,7 @@ data SwaggerResponses = SwaggerResponses
488488 -- | Any HTTP status code can be used as the property name (one property per HTTP status code).
489489 -- Describes the expected response for those HTTP status codes.
490490 , swaggerResponsesResponses :: HashMap HttpStatusCode SwaggerResponse
491− } deriving (Show)
491+ } deriving (Eq, Show)
492492
493493type HttpStatusCode = Int
494494
@@ -510,7 +510,7 @@ data SwaggerResponse = SwaggerResponse
510510
511511 -- | An example of the response message.
512512 , swaggerResponseExamples :: Maybe SwaggerExample
513− } deriving (Show)
513+ } deriving (Eq, Show)
514514
515515type HeaderName = Text
516516
@@ -533,16 +533,16 @@ data SwaggerHeader = SwaggerHeader
533533 , swaggerHeaderCollectionFormat :: SwaggerItemsCollectionFormat
534534
535535 , swaggerHeaderCommon :: SwaggerSchemaCommon
536− } deriving (Show, Generic)
536+ } deriving (Eq, Show, Generic)
537537
538538data SwaggerExample = SwaggerExample { getSwaggerExample :: Map MediaType Value }
539− deriving (Show)
539+ deriving (Eq, Show)
540540
541541-- | The location of the API key.
542542data SwaggerApiKeyLocation
543543 = SwaggerApiKeyQuery
544544 | SwaggerApiKeyHeader
545− deriving (Show)
545+ deriving (Eq, Show)
546546
547547data SwaggerApiKeyParams = SwaggerApiKeyParams
548548 { -- | The name of the header or query parameter to be used.
@@ -550,7 +550,7 @@ data SwaggerApiKeyParams = SwaggerApiKeyParams
550550
551551 -- | The location of the API key.
552552 , swaggerApiKeyIn :: SwaggerApiKeyLocation
553− } deriving (Show)
553+ } deriving (Eq, Show)
554554
555555-- | The authorization URL to be used for OAuth2 flow. This SHOULD be in the form of a URL.
556556type AuthorizationURL = Text
@@ -563,7 +563,7 @@ data SwaggerOAuth2Flow
563563 | SwaggerOAuth2Password TokenURL
564564 | SwaggerOAuth2Application TokenURL
565565 | SwaggerOAuth2AccessCode AuthorizationURL TokenURL
566− deriving (Show)
566+ deriving (Eq, Show)
567567
568568data SwaggerOAuth2Params = SwaggerOAuth2Params
569569 { -- | The flow used by the OAuth2 security scheme.
@@ -571,13 +571,13 @@ data SwaggerOAuth2Params = SwaggerOAuth2Params
571571
572572 -- | The available scopes for the OAuth2 security scheme.
573573 , swaggerOAuth2Scopes :: HashMap Text Text
574− } deriving (Show, Generic)
574+ } deriving (Eq, Show, Generic)
575575
576576data SwaggerSecuritySchemeType
577577 = SwaggerSecuritySchemeBasic
578578 | SwaggerSecuritySchemeApiKey SwaggerApiKeyParams
579579 | SwaggerSecuritySchemeOAuth2 SwaggerOAuth2Params
580− deriving (Show)
580+ deriving (Eq, Show)
581581
582582data SwaggerSecuritySchemeTypeName
583583 = SwaggerSecuritySchemeTypeBasic
@@ -604,7 +604,7 @@ data SwaggerSecurityScheme = SwaggerSecurityScheme
604604
605605 -- | A short description for security scheme.
606606 , swaggerSecuritySchemeDescription :: Maybe Text
607− } deriving (Show, Generic)
607+ } deriving (Eq, Show, Generic)
608608
609609-- | Lists the required security schemes to execute this operation.
610610-- The object can have multiple security schemes declared in it which are all required
@@ -625,7 +625,7 @@ data SwaggerTag = SwaggerTag
625625
626626 -- | Additional external documentation for this tag.
627627 , swaggerTagExternalDocs :: Maybe SwaggerExternalDocs
628− } deriving (Show)
628+ } deriving (Eq, Show)
629629
630630-- | Allows referencing an external resource for extended documentation.
631631data SwaggerExternalDocs = SwaggerExternalDocs
@@ -635,9 +635,9 @@ data SwaggerExternalDocs = SwaggerExternalDocs
635635
636636 -- | The URL for the target documentation.
637637 , swaggerExternalDocsUrl :: URL
638− } deriving (Show)
638+ } deriving (Eq, Show)
639639
640−newtype URL = URL { getUrl :: Text } deriving (Show, ToJSON, FromJSON)
640+newtype URL = URL { getUrl :: Text } deriving (Eq, Show, ToJSON, FromJSON)
641641
642642-- =======================================================================
643643-- TH derived ToJSON and FromJSON instances