@@ -1,3 +1,4 @@
1+{-# LANGUAGE DeriveDataTypeable #-}
1{-# LANGUAGE DeriveGeneric #-}
2{-# LANGUAGE DeriveGeneric #-}
2{-# LANGUAGE DeriveTraversable #-}
3{-# LANGUAGE DeriveTraversable #-}
3{-# LANGUAGE FlexibleContexts #-}
4{-# LANGUAGE FlexibleContexts #-}
@@ -16,6 +17,7 @@ import Control.Monad
16import Data.Aeson
17import Data.Aeson
17import Data.Aeson.TH (deriveJSON)
18import Data.Aeson.TH (deriveJSON)
18import qualified Data.Aeson.Types as JSON
19import qualified Data.Aeson.Types as JSON
20+import Data.Data (Data(..), Typeable, mkConstr, mkDataType, Fixity(..), Constr, DataType, constrIndex)
19import Data.HashMap.Strict (HashMap)
21import Data.HashMap.Strict (HashMap)
20import qualified Data.HashMap.Strict as HashMap
22import qualified Data.HashMap.Strict as HashMap
21import Data.Map (Map)
23import Data.Map (Map)
@@ -91,7 +93,7 @@ data Swagger = Swagger
92 -- | Additional external documentation.
94 -- | Additional external documentation.
93 , _externalDocs :: Maybe ExternalDocs
95 , _externalDocs :: Maybe ExternalDocs
94− } deriving (Eq, Show, Generic)
96+ } deriving (Eq, Show, Generic, Data, Typeable)
96-- | The object provides metadata about the API.
98-- | The object provides metadata about the API.
97-- The metadata can be used by the clients if needed,
99-- The metadata can be used by the clients if needed,
@@ -116,7 +118,7 @@ data Info = Info
116 -- | Provides the version of the application API
118 -- | Provides the version of the application API
117 -- (not to be confused with the specification version).
119 -- (not to be confused with the specification version).
118 , _infoVersion :: Text
120 , _infoVersion :: Text
119− } deriving (Eq, Show, Generic)
121+ } deriving (Eq, Show, Generic, Data, Typeable)
121-- | Contact information for the exposed API.
123-- | Contact information for the exposed API.
122data Contact = Contact
124data Contact = Contact
@@ -128,7 +130,7 @@ data Contact = Contact
129 -- | The email address of the contact person/organization.
131 -- | The email address of the contact person/organization.
130 , _contactEmail :: Maybe Text
132 , _contactEmail :: Maybe Text
131− } deriving (Eq, Show)
133+ } deriving (Eq, Show, Generic, Data, Typeable)
133-- | License information for the exposed API.
135-- | License information for the exposed API.
134data License = License
136data License = License
@@ -137,13 +139,26 @@ data License = License
138 -- | A URL to the license used for the API.
140 -- | A URL to the license used for the API.
139 , _licenseUrl :: Maybe URL
141 , _licenseUrl :: Maybe URL
140− } deriving (Eq, Show)
142+ } deriving (Eq, Show, Generic, Data, Typeable)
142-- | The host (name or ip) serving the API. It MAY include a port.
144-- | The host (name or ip) serving the API. It MAY include a port.
143data Host = Host
145data Host = Host
144 { _hostName :: HostName -- ^ Host name.
146 { _hostName :: HostName -- ^ Host name.
145 , _hostPort :: Maybe PortNumber -- ^ Optional port.
147 , _hostPort :: Maybe PortNumber -- ^ Optional port.
146− } deriving (Eq, Show)
148+ } deriving (Eq, Show, Generic, Typeable)
151+hostConstr = mkConstr hostDataType "Host" [] Prefix
153+hostDataType :: DataType
154+hostDataType = mkDataType "Data.Swagger.Host" [hostConstr]
156+instance Data Host where
157+ gunfold k z c = case constrIndex c of
158+ 1 -> k (k (z (\name mport -> Host name (fromInteger <$> mport))))
159+ _ -> error $ "Data.Data.gunfold: Constructor " ++ show c ++ " is not of type Host."
160+ toConstr (Host _ _) = hostConstr
161+ dataTypeOf _ = hostDataType
148-- | The transfer protocol of the API.
163-- | The transfer protocol of the API.
149data Scheme
164data Scheme
@@ -151,14 +166,14 @@ data Scheme
154− deriving (Eq, Show)
169+ deriving (Eq, Show, Generic, Data, Typeable)
156-- | The available paths and operations for the API.
171-- | The available paths and operations for the API.
157data Paths = Paths
172data Paths = Paths
158 { -- | Holds the relative paths to the individual endpoints.
173 { -- | Holds the relative paths to the individual endpoints.
159 -- The path is appended to the @'basePath'@ in order to construct the full URL.
174 -- The path is appended to the @'basePath'@ in order to construct the full URL.
160 _pathsMap :: HashMap FilePath PathItem
175 _pathsMap :: HashMap FilePath PathItem
161− } deriving (Eq, Show, Generic)
176+ } deriving (Eq, Show, Generic, Data, Typeable)
163-- | Describes the operations available on a single path.
178-- | Describes the operations available on a single path.
164-- A @'PathItem'@ may be empty, due to ACL constraints.
179-- A @'PathItem'@ may be empty, due to ACL constraints.
@@ -191,7 +206,7 @@ data PathItem = PathItem
191 -- The list MUST NOT include duplicated parameters.
206 -- The list MUST NOT include duplicated parameters.
192 -- A unique parameter is defined by a combination of a name and location.
207 -- A unique parameter is defined by a combination of a name and location.
193 , _pathItemParameters :: [Referenced Param]
208 , _pathItemParameters :: [Referenced Param]
194− } deriving (Eq, Show, Generic)
209+ } deriving (Eq, Show, Generic, Data, Typeable)
196-- | Describes a single API operation on a path.
211-- | Describes a single API operation on a path.
197data Operation = Operation
212data Operation = Operation
@@ -251,10 +266,23 @@ data Operation = Operation
251 -- This definition overrides any declared top-level security.
266 -- This definition overrides any declared top-level security.
252 -- To remove a top-level security declaration, @Just []@ can be used.
267 -- To remove a top-level security declaration, @Just []@ can be used.
253 , _operationSecurity :: [SecurityRequirement]
268 , _operationSecurity :: [SecurityRequirement]
254− } deriving (Eq, Show, Generic)
269+ } deriving (Eq, Show, Generic, Data, Typeable)
256newtype MimeList = MimeList { getMimeList :: [MediaType] }
271newtype MimeList = MimeList { getMimeList :: [MediaType] }
257− deriving (Eq, Show, Monoid)
272+ deriving (Eq, Show, Monoid, Typeable)
274+mimeListConstr :: Constr
275+mimeListConstr = mkConstr mimeListDataType "MimeList" ["getMimeList"] Prefix
277+mimeListDataType :: DataType
278+mimeListDataType = mkDataType "Data.Swagger.MimeList" [mimeListConstr]
280+instance Data MimeList where
281+ gunfold k z c = case constrIndex c of
282+ 1 -> k (z (\xs -> MimeList (map fromString xs)))
283+ _ -> error $ "Data.Data.gunfold: Constructor " ++ show c ++ " is not of type MimeList."
284+ toConstr (MimeList _) = mimeListConstr
285+ dataTypeOf _ = mimeListDataType
259-- | Describes a single operation parameter.
287-- | Describes a single operation parameter.
260-- A unique parameter is defined by a combination of a name and location.
288-- A unique parameter is defined by a combination of a name and location.
@@ -275,12 +303,12 @@ data Param = Param
276 -- | Parameter schema.
304 -- | Parameter schema.
277 , _paramSchema :: ParamAnySchema
305 , _paramSchema :: ParamAnySchema
278− } deriving (Eq, Show, Generic)
306+ } deriving (Eq, Show, Generic, Data, Typeable)
280data ParamAnySchema
308data ParamAnySchema
281 = ParamBody (Referenced Schema)
309 = ParamBody (Referenced Schema)
282 | ParamOther ParamOtherSchema
310 | ParamOther ParamOtherSchema
283− deriving (Eq, Show)
311+ deriving (Eq, Show, Generic, Data, Typeable)
285data ParamOtherSchema = ParamOtherSchema
313data ParamOtherSchema = ParamOtherSchema
286 { -- | The location of the parameter.
314 { -- | The location of the parameter.
@@ -297,7 +325,7 @@ data ParamOtherSchema = ParamOtherSchema
297 , _paramOtherSchemaCollectionFormat :: Maybe (CollectionFormat Param)
325 , _paramOtherSchemaCollectionFormat :: Maybe (CollectionFormat Param)
299 , _paramOtherSchemaParamSchema :: ParamSchema ParamOtherSchema Items
327 , _paramOtherSchemaParamSchema :: ParamSchema ParamOtherSchema Items
300− } deriving (Eq, Show, Generic)
328+ } deriving (Eq, Show, Generic, Data, Typeable)
302data SwaggerType t where
330data SwaggerType t where
303 SwaggerString :: SwaggerType t
331 SwaggerString :: SwaggerType t
@@ -311,6 +339,75 @@ data SwaggerType t where
312deriving instance Eq (SwaggerType t)
340deriving instance Eq (SwaggerType t)
313deriving instance Show (SwaggerType t)
341deriving instance Show (SwaggerType t)
342+deriving instance Typeable (SwaggerType t)
344+swaggerStringConstr :: DataType -> Constr
345+swaggerStringConstr dt = mkConstr dt "SwaggerString" [] Prefix
347+swaggerNumberConstr :: DataType -> Constr
348+swaggerNumberConstr dt = mkConstr dt "SwaggerNumber" [] Prefix
350+swaggerIntegerConstr :: DataType -> Constr
351+swaggerIntegerConstr dt = mkConstr dt "SwaggerInteger" [] Prefix
353+swaggerBooleanConstr :: DataType -> Constr
354+swaggerBooleanConstr dt = mkConstr dt "SwaggerBoolean" [] Prefix
356+swaggerArrayConstr :: DataType -> Constr
357+swaggerArrayConstr dt = mkConstr dt "SwaggerArray" [] Prefix
359+swaggerFileConstr :: DataType -> Constr
360+swaggerFileConstr dt = mkConstr dt "SwaggerFile" [] Prefix
362+swaggerNullConstr :: DataType -> Constr
363+swaggerNullConstr dt = mkConstr dt "SwaggerNull" [] Prefix
365+swaggerObjectConstr :: DataType -> Constr
366+swaggerObjectConstr dt = mkConstr dt "SwaggerObject" [] Prefix
368+swaggerTypeDataType :: [DataType -> Constr] -> DataType
369+swaggerTypeDataType extra = dt
371+ dt = mkDataType "Data.Swagger.SwaggerType" $ map ($ dt) $
372+ [ swaggerStringConstr, swaggerNumberConstr, swaggerIntegerConstr, swaggerBooleanConstr , swaggerArrayConstr ]
375+swaggerTypeToConstr :: Data (SwaggerType t) => SwaggerType t -> Constr
376+swaggerTypeToConstr t = case t of
377+ SwaggerString -> swaggerStringConstr dt
378+ SwaggerNumber -> swaggerNumberConstr dt
379+ SwaggerInteger -> swaggerIntegerConstr dt
380+ SwaggerBoolean -> swaggerBooleanConstr dt
381+ SwaggerArray -> swaggerArrayConstr dt
382+ SwaggerFile -> swaggerFileConstr dt
383+ SwaggerNull -> swaggerNullConstr dt
384+ SwaggerObject -> swaggerObjectConstr dt
388+instance Data (SwaggerType Items) where
389+ gunfold = gunfoldEnum "SwaggerType Items" $ zip [1..]
390+ [SwaggerString, SwaggerNumber, SwaggerInteger, SwaggerBoolean, SwaggerArray]
391+ toConstr = swaggerTypeToConstr
392+ dataTypeOf _ = swaggerTypeDataType []
394+instance Data (SwaggerType Header) where
395+ gunfold = gunfoldEnum "SwaggerType Header" $ zip [1..]
396+ [SwaggerString, SwaggerNumber, SwaggerInteger, SwaggerBoolean, SwaggerArray]
397+ toConstr = swaggerTypeToConstr
398+ dataTypeOf _ = swaggerTypeDataType []
400+instance Data (SwaggerType ParamOtherSchema) where
401+ gunfold = gunfoldEnum "SwaggerType ParamOtherSchema" $ zip [1..]
402+ [SwaggerString, SwaggerNumber, SwaggerInteger, SwaggerBoolean, SwaggerArray, SwaggerFile]
403+ toConstr = swaggerTypeToConstr
404+ dataTypeOf _ = swaggerTypeDataType [swaggerFileConstr]
406+instance Data (SwaggerType Schema) where
407+ gunfold = gunfoldEnum "SwaggerType Schema" $ zip [1, 2, 3, 4, 5, 7, 8]
408+ [SwaggerString, SwaggerNumber, SwaggerInteger, SwaggerBoolean, SwaggerArray, SwaggerNull, SwaggerObject]
409+ toConstr = swaggerTypeToConstr
410+ dataTypeOf _ = swaggerTypeDataType [swaggerNullConstr, swaggerObjectConstr]
315data ParamLocation
412data ParamLocation
316 = -- | Parameters that are appended to the URL.
413 = -- | Parameters that are appended to the URL.
@@ -330,7 +427,7 @@ data ParamLocation
330 -- Form parameters have a different format based on the content-type used
427 -- Form parameters have a different format based on the content-type used
331 -- (for further details, consult <http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4>).
428 -- (for further details, consult <http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4>).
332 | ParamFormData
429 | ParamFormData
333− deriving (Eq, Show)
430+ deriving (Eq, Show, Generic, Data, Typeable)
335type Format = Text
432type Format = Text
@@ -351,6 +448,36 @@ data CollectionFormat t where
352deriving instance Eq (CollectionFormat t)
449deriving instance Eq (CollectionFormat t)
353deriving instance Show (CollectionFormat t)
450deriving instance Show (CollectionFormat t)
451+deriving instance Typeable (CollectionFormat t)
453+collectionCsvConstr :: Constr
454+collectionCsvConstr = mkConstr collectionFormatDataType "CollectionCSV" [] Prefix
456+collectionSsvConstr :: Constr
457+collectionSsvConstr = mkConstr collectionFormatDataType "CollectionSSV" [] Prefix
459+collectionTsvConstr :: Constr
460+collectionTsvConstr = mkConstr collectionFormatDataType "CollectionTSV" [] Prefix
462+collectionPipesConstr :: Constr
463+collectionPipesConstr = mkConstr collectionFormatDataType "CollectionPipes" [] Prefix
465+collectionFormatDataType :: DataType
466+collectionFormatDataType = mkDataType "Data.Swagger.CollectionFormat"
467+ [ collectionCsvConstr, collectionSsvConstr, collectionTsvConstr, collectionPipesConstr ]
469+instance {-# OVERLAPPABLE #-} Data t => Data (CollectionFormat t) where
470+ gunfold = gunfoldEnum "CollectionFormat" $ zip [1..]
471+ [ CollectionCSV, CollectionSSV, CollectionTSV, CollectionPipes ]
473+ toConstr CollectionCSV = collectionCsvConstr
474+ toConstr CollectionSSV = collectionSsvConstr
475+ toConstr CollectionTSV = collectionTsvConstr
476+ toConstr CollectionPipes = collectionPipesConstr
478+ dataTypeOf _ = collectionFormatDataType
480+deriving instance {-# OVERLAPPING #-} Data (CollectionFormat Param)
355type ParamName = Text
482type ParamName = Text
@@ -373,12 +500,12 @@ data Schema = Schema
373 , _schemaMinProperties :: Maybe Integer
500 , _schemaMinProperties :: Maybe Integer
375 , _schemaParamSchema :: ParamSchema Schema SchemaItems
502 , _schemaParamSchema :: ParamSchema Schema SchemaItems
376− } deriving (Eq, Show, Generic)
503+ } deriving (Eq, Show, Generic, Data, Typeable)
378data SchemaItems
505data SchemaItems
379 = SchemaItemsObject (Referenced Schema)
506 = SchemaItemsObject (Referenced Schema)
380 | SchemaItemsArray [Referenced Schema]
507 | SchemaItemsArray [Referenced Schema]
381− deriving (Eq, Show)
508+ deriving (Eq, Show, Generic, Data, Typeable)
383data ParamSchema t items = ParamSchema
510data ParamSchema t items = ParamSchema
384 { -- | Declares the value of the parameter that the server will use if none is provided,
511 { -- | Declares the value of the parameter that the server will use if none is provided,
@@ -403,7 +530,9 @@ data ParamSchema t items = ParamSchema
403 , _paramSchemaUniqueItems :: Maybe Bool
530 , _paramSchemaUniqueItems :: Maybe Bool
404 , _paramSchemaEnum :: Maybe [Value]
531 , _paramSchemaEnum :: Maybe [Value]
405 , _paramSchemaMultipleOf :: Maybe Scientific
532 , _paramSchemaMultipleOf :: Maybe Scientific
406− } deriving (Eq, Show, Generic)
533+ } deriving (Eq, Show, Generic, Typeable)
535+deriving instance (Data t, Data (SwaggerType t), Data i) => Data (ParamSchema t i)
408data Xml = Xml
537data Xml = Xml
409 { -- | Replaces the name of the element/attribute used for the described schema property.
538 { -- | Replaces the name of the element/attribute used for the described schema property.
@@ -431,7 +560,7 @@ data Xml = Xml
431 -- Default value is @False@.
560 -- Default value is @False@.
432 -- The definition takes effect only when defined alongside type being array (outside the items).
561 -- The definition takes effect only when defined alongside type being array (outside the items).
433 , _xmlWrapped :: Maybe Bool
562 , _xmlWrapped :: Maybe Bool
434− } deriving (Eq, Show, Generic)
563+ } deriving (Eq, Show, Generic, Data, Typeable)
436data Items = Items
565data Items = Items
437 { -- | Determines the format of the array if type array is used.
566 { -- | Determines the format of the array if type array is used.
@@ -439,7 +568,7 @@ data Items = Items
439 _itemsCollectionFormat :: Maybe (CollectionFormat Items)
568 _itemsCollectionFormat :: Maybe (CollectionFormat Items)
441 , _itemsParamSchema :: ParamSchema Items Items
570 , _itemsParamSchema :: ParamSchema Items Items
442− } deriving (Eq, Show, Generic)
571+ } deriving (Eq, Show, Generic, Data, Typeable)
444-- | A container for the expected responses of an operation.
573-- | A container for the expected responses of an operation.
445-- The container maps a HTTP response code to the expected response.
574-- The container maps a HTTP response code to the expected response.
@@ -454,7 +583,7 @@ data Responses = Responses
454 -- | Any HTTP status code can be used as the property name (one property per HTTP status code).
583 -- | Any HTTP status code can be used as the property name (one property per HTTP status code).
455 -- Describes the expected response for those HTTP status codes.
584 -- Describes the expected response for those HTTP status codes.
456 , _responsesResponses :: HashMap HttpStatusCode (Referenced Response)
585 , _responsesResponses :: HashMap HttpStatusCode (Referenced Response)
457− } deriving (Eq, Show, Generic)
586+ } deriving (Eq, Show, Generic, Data, Typeable)
459type HttpStatusCode = Int
588type HttpStatusCode = Int
@@ -476,7 +605,7 @@ data Response = Response
477 -- | An example of the response message.
606 -- | An example of the response message.
478 , _responseExamples :: Maybe Example
607 , _responseExamples :: Maybe Example
479− } deriving (Eq, Show, Generic)
608+ } deriving (Eq, Show, Generic, Data, Typeable)
481type HeaderName = Text
610type HeaderName = Text
@@ -489,16 +618,29 @@ data Header = Header
489 , _headerCollectionFormat :: Maybe (CollectionFormat Items)
618 , _headerCollectionFormat :: Maybe (CollectionFormat Items)
491 , _headerParamSchema :: ParamSchema Header Items
620 , _headerParamSchema :: ParamSchema Header Items
492− } deriving (Eq, Show, Generic)
621+ } deriving (Eq, Show, Generic, Data, Typeable)
494data Example = Example { getExample :: Map MediaType Value }
623data Example = Example { getExample :: Map MediaType Value }
495− deriving (Eq, Show)
624+ deriving (Eq, Show, Generic, Typeable)
626+exampleConstr :: Constr
627+exampleConstr = mkConstr exampleDataType "Example" ["getExample"] Prefix
629+exampleDataType :: DataType
630+exampleDataType = mkDataType "Data.Swagger.Example" [exampleConstr]
632+instance Data Example where
633+ gunfold k z c = case constrIndex c of
634+ 1 -> k (z (\m -> Example (Map.mapKeys fromString m)))
635+ _ -> error $ "Data.Data.gunfold: Constructor " ++ show c ++ " is not of type Example."
636+ toConstr (Example _) = exampleConstr
637+ dataTypeOf _ = exampleDataType
497-- | The location of the API key.
639-- | The location of the API key.
498data ApiKeyLocation
640data ApiKeyLocation
499 = ApiKeyQuery
641 = ApiKeyQuery
500 | ApiKeyHeader
642 | ApiKeyHeader
501− deriving (Eq, Show)
643+ deriving (Eq, Show, Generic, Data, Typeable)
503data ApiKeyParams = ApiKeyParams
645data ApiKeyParams = ApiKeyParams
504 { -- | The name of the header or query parameter to be used.
646 { -- | The name of the header or query parameter to be used.
@@ -506,7 +648,7 @@ data ApiKeyParams = ApiKeyParams
507 -- | The location of the API key.
649 -- | The location of the API key.
508 , _apiKeyIn :: ApiKeyLocation
650 , _apiKeyIn :: ApiKeyLocation
509− } deriving (Eq, Show)
651+ } deriving (Eq, Show, Generic, Data, Typeable)
511-- | The authorization URL to be used for OAuth2 flow. This SHOULD be in the form of a URL.
653-- | The authorization URL to be used for OAuth2 flow. This SHOULD be in the form of a URL.
512type AuthorizationURL = Text
654type AuthorizationURL = Text
@@ -519,7 +661,7 @@ data OAuth2Flow
519 | OAuth2Password TokenURL
661 | OAuth2Password TokenURL
520 | OAuth2Application TokenURL
662 | OAuth2Application TokenURL
521 | OAuth2AccessCode AuthorizationURL TokenURL
663 | OAuth2AccessCode AuthorizationURL TokenURL
522− deriving (Eq, Show)
664+ deriving (Eq, Show, Generic, Data, Typeable)
524data OAuth2Params = OAuth2Params
666data OAuth2Params = OAuth2Params
525 { -- | The flow used by the OAuth2 security scheme.
667 { -- | The flow used by the OAuth2 security scheme.
@@ -527,13 +669,13 @@ data OAuth2Params = OAuth2Params
528 -- | The available scopes for the OAuth2 security scheme.
670 -- | The available scopes for the OAuth2 security scheme.
529 , _oauth2Scopes :: HashMap Text Text
671 , _oauth2Scopes :: HashMap Text Text
530− } deriving (Eq, Show, Generic)
672+ } deriving (Eq, Show, Generic, Data, Typeable)
532data SecuritySchemeType
674data SecuritySchemeType
533 = SecuritySchemeBasic
675 = SecuritySchemeBasic
534 | SecuritySchemeApiKey ApiKeyParams
676 | SecuritySchemeApiKey ApiKeyParams
535 | SecuritySchemeOAuth2 OAuth2Params
677 | SecuritySchemeOAuth2 OAuth2Params
536− deriving (Eq, Show)
678+ deriving (Eq, Show, Generic, Data, Typeable)
538data SecurityScheme = SecurityScheme
680data SecurityScheme = SecurityScheme
539 { -- | The type of the security scheme.
681 { -- | The type of the security scheme.
@@ -541,14 +683,14 @@ data SecurityScheme = SecurityScheme
542 -- | A short description for security scheme.
684 -- | A short description for security scheme.
543 , _securitySchemeDescription :: Maybe Text
685 , _securitySchemeDescription :: Maybe Text
544− } deriving (Eq, Show, Generic)
686+ } deriving (Eq, Show, Generic, Data, Typeable)
546-- | Lists the required security schemes to execute this operation.
688-- | Lists the required security schemes to execute this operation.
547-- The object can have multiple security schemes declared in it which are all required
689-- The object can have multiple security schemes declared in it which are all required
548-- (that is, there is a logical AND between the schemes).
690-- (that is, there is a logical AND between the schemes).
549newtype SecurityRequirement = SecurityRequirement
691newtype SecurityRequirement = SecurityRequirement
550 { getSecurityRequirement :: HashMap Text [Text]
692 { getSecurityRequirement :: HashMap Text [Text]
551− } deriving (Eq, Read, Show, Monoid, ToJSON, FromJSON)
693+ } deriving (Eq, Read, Show, Monoid, ToJSON, FromJSON, Data, Typeable)
553-- | Allows adding meta data to a single tag that is used by @Operation@.
695-- | Allows adding meta data to a single tag that is used by @Operation@.
554-- It is not mandatory to have a @Tag@ per tag used there.
696-- It is not mandatory to have a @Tag@ per tag used there.
@@ -562,7 +704,7 @@ data Tag = Tag
563 -- | Additional external documentation for this tag.
705 -- | Additional external documentation for this tag.
564 , _tagExternalDocs :: Maybe ExternalDocs
706 , _tagExternalDocs :: Maybe ExternalDocs
565− } deriving (Eq, Show)
707+ } deriving (Eq, Show, Generic, Data, Typeable)
567-- | Allows referencing an external resource for extended documentation.
709-- | Allows referencing an external resource for extended documentation.
568data ExternalDocs = ExternalDocs
710data ExternalDocs = ExternalDocs
@@ -572,19 +714,19 @@ data ExternalDocs = ExternalDocs
573 -- | The URL for the target documentation.
715 -- | The URL for the target documentation.
574 , _externalDocsUrl :: URL
716 , _externalDocsUrl :: URL
575− } deriving (Eq, Show, Generic)
717+ } deriving (Eq, Show, Generic, Data, Typeable)
577-- | A simple object to allow referencing other definitions in the specification.
719-- | A simple object to allow referencing other definitions in the specification.
578-- It can be used to reference parameters and responses that are defined at the top level for reuse.
720-- It can be used to reference parameters and responses that are defined at the top level for reuse.
579newtype Reference = Reference { getReference :: Text }
721newtype Reference = Reference { getReference :: Text }
580− deriving (Eq, Show)
722+ deriving (Eq, Show, Data, Typeable)
582data Referenced a
724data Referenced a
583 = Ref Reference
725 = Ref Reference
584 | Inline a
726 | Inline a
585− deriving (Eq, Show)
727+ deriving (Eq, Show, Data, Typeable)
587−newtype URL = URL { getUrl :: Text } deriving (Eq, Show, ToJSON, FromJSON)
729+newtype URL = URL { getUrl :: Text } deriving (Eq, Show, ToJSON, FromJSON, Data, Typeable)
589-- =======================================================================
731-- =======================================================================
590-- Monoid instances
732-- Monoid instances