Maintainer | Nickolay Kudasov <nickolay@getshoptv.com> |
---|---|
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Swaggerâ„¢ is a project used to describe and document RESTful APIs.
The Swagger specification defines a set of files required to describe such an API. These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various languages. Additional utilities can also take advantage of the resulting files, such as testing tools.
Synopsis
- module Data.OpenApi.Lens
- module Data.OpenApi.Operation
- module Data.OpenApi.ParamSchema
- module Data.OpenApi.Schema
- module Data.OpenApi.Schema.Validation
- data OpenApi = OpenApi { }
- data Server = Server { }
- data ServerVariable = ServerVariable { }
-
data
Components
=
Components
{
- _componentsSchemas :: Definitions Schema
- _componentsResponses :: Definitions Response
- _componentsParameters :: Definitions Param
- _componentsExamples :: Definitions Example
- _componentsRequestBodies :: Definitions RequestBody
- _componentsHeaders :: Definitions Header
- _componentsSecuritySchemes :: SecurityDefinitions
- _componentsLinks :: Definitions Link
- _componentsCallbacks :: Definitions Callback
-
data
Info
=
Info
{
- _infoTitle :: Text
- _infoDescription :: Maybe Text
- _infoTermsOfService :: Maybe Text
- _infoContact :: Maybe Contact
- _infoLicense :: Maybe License
- _infoVersion :: Text
-
data
Contact
=
Contact
{
- _contactName :: Maybe Text
- _contactUrl :: Maybe URL
- _contactEmail :: Maybe Text
-
data
License
=
License
{
- _licenseName :: Text
- _licenseUrl :: Maybe URL
-
data
PathItem
=
PathItem
{
- _pathItemSummary :: Maybe Text
- _pathItemDescription :: Maybe Text
- _pathItemGet :: Maybe Operation
- _pathItemPut :: Maybe Operation
- _pathItemPost :: Maybe Operation
- _pathItemDelete :: Maybe Operation
- _pathItemOptions :: Maybe Operation
- _pathItemHead :: Maybe Operation
- _pathItemPatch :: Maybe Operation
- _pathItemTrace :: Maybe Operation
- _pathItemServers :: [ Server ]
- _pathItemParameters :: [ Referenced Param ]
-
data
Operation
=
Operation
{
- _operationTags :: InsOrdHashSet TagName
- _operationSummary :: Maybe Text
- _operationDescription :: Maybe Text
- _operationExternalDocs :: Maybe ExternalDocs
- _operationOperationId :: Maybe Text
- _operationParameters :: [ Referenced Param ]
- _operationRequestBody :: Maybe ( Referenced RequestBody )
- _operationResponses :: Responses
- _operationCallbacks :: InsOrdHashMap Text ( Referenced Callback )
- _operationDeprecated :: Maybe Bool
- _operationSecurity :: [ SecurityRequirement ]
- _operationServers :: [ Server ]
- data Tag = Tag { }
- type TagName = Text
- data OpenApiType where
- type Format = Text
- type Definitions = InsOrdHashMap Text
- data Style
-
data
Param
=
Param
{
- _paramName :: Text
- _paramDescription :: Maybe Text
- _paramRequired :: Maybe Bool
- _paramDeprecated :: Maybe Bool
- _paramIn :: ParamLocation
- _paramAllowEmptyValue :: Maybe Bool
- _paramAllowReserved :: Maybe Bool
- _paramSchema :: Maybe ( Referenced Schema )
- _paramStyle :: Maybe Style
- _paramExplode :: Maybe Bool
- _paramExample :: Maybe Value
- _paramExamples :: InsOrdHashMap Text ( Referenced Example )
-
data
ParamLocation
- = ParamQuery
- | ParamHeader
- | ParamPath
- | ParamCookie
- type ParamName = Text
-
data
Header
=
Header
{
- _headerDescription :: Maybe HeaderName
- _headerRequired :: Maybe Bool
- _headerDeprecated :: Maybe Bool
- _headerAllowEmptyValue :: Maybe Bool
- _headerExplode :: Maybe Bool
- _headerExample :: Maybe Value
- _headerExamples :: InsOrdHashMap Text ( Referenced Example )
- _headerSchema :: Maybe ( Referenced Schema )
- type HeaderName = Text
- data Example = Example { }
- data RequestBody = RequestBody { }
- data MediaTypeObject = MediaTypeObject { }
- data Encoding = Encoding { }
-
data
Schema
=
Schema
{
- _schemaTitle :: Maybe Text
- _schemaDescription :: Maybe Text
- _schemaRequired :: [ ParamName ]
- _schemaNullable :: Maybe Bool
- _schemaAllOf :: Maybe [ Referenced Schema ]
- _schemaOneOf :: Maybe [ Referenced Schema ]
- _schemaNot :: Maybe ( Referenced Schema )
- _schemaAnyOf :: Maybe [ Referenced Schema ]
- _schemaProperties :: InsOrdHashMap Text ( Referenced Schema )
- _schemaAdditionalProperties :: Maybe AdditionalProperties
- _schemaDiscriminator :: Maybe Discriminator
- _schemaReadOnly :: Maybe Bool
- _schemaWriteOnly :: Maybe Bool
- _schemaXml :: Maybe Xml
- _schemaExternalDocs :: Maybe ExternalDocs
- _schemaExample :: Maybe Value
- _schemaDeprecated :: Maybe Bool
- _schemaMaxProperties :: Maybe Integer
- _schemaMinProperties :: Maybe Integer
- _schemaDefault :: Maybe Value
- _schemaType :: Maybe OpenApiType
- _schemaFormat :: Maybe Format
- _schemaItems :: Maybe OpenApiItems
- _schemaMaximum :: Maybe Scientific
- _schemaExclusiveMaximum :: Maybe Bool
- _schemaMinimum :: Maybe Scientific
- _schemaExclusiveMinimum :: Maybe Bool
- _schemaMaxLength :: Maybe Integer
- _schemaMinLength :: Maybe Integer
- _schemaPattern :: Maybe Pattern
- _schemaMaxItems :: Maybe Integer
- _schemaMinItems :: Maybe Integer
- _schemaUniqueItems :: Maybe Bool
- _schemaEnum :: Maybe [ Value ]
- _schemaMultipleOf :: Maybe Scientific
- data NamedSchema = NamedSchema { }
-
data
OpenApiItems
where
- OpenApiItemsObject :: Referenced Schema -> OpenApiItems
- OpenApiItemsArray :: [ Referenced Schema ] -> OpenApiItems
-
data
Xml
=
Xml
{
- _xmlName :: Maybe Text
- _xmlNamespace :: Maybe Text
- _xmlPrefix :: Maybe Text
- _xmlAttribute :: Maybe Bool
- _xmlWrapped :: Maybe Bool
- type Pattern = Text
- data AdditionalProperties
- data Discriminator = Discriminator { }
- data Responses = Responses { }
- data Response = Response { }
- type HttpStatusCode = Int
- data Link = Link { }
- newtype Callback = Callback ( InsOrdHashMap Text PathItem )
- data SecurityScheme = SecurityScheme { }
- data SecuritySchemeType
- data HttpSchemeType
- newtype SecurityDefinitions = SecurityDefinitions ( Definitions SecurityScheme )
- newtype SecurityRequirement = SecurityRequirement { }
- data ApiKeyParams = ApiKeyParams { }
- data ApiKeyLocation
- data OAuth2Flows = OAuth2Flows { }
-
data
OAuth2Flow
p =
OAuth2Flow
{
- _oAuth2Params :: p
- _oAath2RefreshUrl :: Maybe URL
- _oAuth2Scopes :: InsOrdHashMap Text Text
- newtype OAuth2ImplicitFlow = OAuth2ImplicitFlow { }
- newtype OAuth2PasswordFlow = OAuth2PasswordFlow { }
- newtype OAuth2ClientCredentialsFlow = OAuth2ClientCredentialsFlow { }
- data OAuth2AuthorizationCodeFlow = OAuth2AuthorizationCodeFlow { }
- type AuthorizationURL = Text
- type TokenURL = Text
- data ExternalDocs = ExternalDocs { }
-
newtype
Reference
=
Reference
{
- getReference :: Text
- data Referenced a
-
newtype
MimeList
=
MimeList
{
- getMimeList :: [ MediaType ]
- newtype URL = URL { }
How to use this library
This section explains how to use this library to work with Swagger specification.
Monoid
instances
Monoid
Virtually all types representing Swagger specification have
instances.
The
Monoid
type class provides two methods —
Monoid
and
mempty
.
mappend
In this library you can use
for a default/empty value. For instance:
mempty
>>>
BSL.putStrLn $ encodePretty (mempty :: OpenApi)
{ "components": {}, "info": { "title": "", "version": "" }, "openapi": "3.0.0", "paths": {} }
As you can see some spec properties (e.g.
"version"
) are there even when the spec is empty.
That is because these properties are actually required ones.
You should always override the default (empty) value for these properties, although it is not strictly necessary:
>>>
BSL.putStrLn $ encodePretty mempty { _infoTitle = "Todo API", _infoVersion = "1.0" }
{ "title": "Todo API", "version": "1.0" }
You can merge two values using
or its infix version
mappend
(
:
<>
)
>>>
BSL.putStrLn $ encodePretty $ mempty { _infoTitle = "Todo API" } <> mempty { _infoVersion = "1.0" }
{ "title": "Todo API", "version": "1.0" }
Lenses and prisms
Note: if you're working with the optics library, take a look at Data.OpenApi.Optics .
Since
has a fairly complex structure, lenses and prisms are used
to work comfortably with it. In combination with
Swagger
instances, lenses
make it fairly simple to construct/modify any part of the specification:
Monoid
>>>
:{
BSL.putStrLn $ encodePretty $ (mempty :: OpenApi) & components . schemas .~ IOHM.fromList [ ("User", mempty & type_ ?~ OpenApiString) ] & paths .~ IOHM.fromList [ ("/user", mempty & get ?~ (mempty & at 200 ?~ ("OK" & _Inline.content.at "application/json" ?~ (mempty & schema ?~ Ref (Reference "User"))) & at 404 ?~ "User info not found")) ] :} { "components": { "schemas": { "User": { "type": "string" } } }, "info": { "title": "", "version": "" }, "openapi": "3.0.0", "paths": { "/user": { "get": { "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } }, "description": "OK" }, "404": { "description": "User info not found" } } } } } }
In the snippet above we declare an API with a single path
/user
. This path provides method
GET
which produces
application/json
output. It should respond with code
200
and body specified
by schema
User
which is defined in
property of swagger specification.
Alternatively it may respond with code
definitions
404
meaning that user info is not found.
For convenience,
swagger2
uses
classy field lenses
. It means that
field accessor names can be overloaded for different types. One such
common field is
. Many components of a Swagger specification
can have descriptions, and you can use the same name for them:
description
>>>
BSL.putStrLn $ encodePretty $ (mempty :: Response) & description .~ "No content"
{ "description": "No content" }>>>
:{
BSL.putStrLn $ encodePretty $ (mempty :: Schema) & type_ ?~ OpenApiBoolean & description ?~ "To be or not to be" :} { "description": "To be or not to be", "type": "boolean" }
Additionally, to simplify working with
, both
Response
and
Operation
have direct access to it via
Responses
. Example:
at
code
>>>
:{
BSL.putStrLn $ encodePretty $ (mempty :: Operation) & at 404 ?~ "Not found" :} { "responses": { "404": { "description": "Not found" } } }
You might've noticed that
has an extra underscore in its name
compared to, say,
type_
field accessor.
This is because
description
type
is a keyword in Haskell.
A few other field accessors are modified in this way:
Schema specification
and
ParamSchema
are the two core types for data model specification.
Schema
specifies all the common properties, available for every data schema.
The
ParamSchema
t
t
parameter imposes some restrictions on
type
and
items
properties (see
and
OpenApiType
).
OpenApiItems
is used for request and response bodies and allows specifying objects
with properties in addition to what
Schema
provides.
ParamSchema
In most cases you will have a Haskell data type for which you would like to
define a corresponding schema. To facilitate this use case
swagger2
provides two classes for schema encoding.
Both these classes provide means to encode
types
as Swagger
schemas
.
is intended to be used for primitive API endpoint parameters,
such as query parameters, headers and URL path pieces.
Its corresponding value-encoding class is
ToParamSchema
(from
ToHttpApiData
http-api-data
package).
is used for request and response bodies and mostly differ from
primitive parameters by allowing objects/mappings in addition to primitive types and arrays.
Its corresponding value-encoding class is
ToSchema
(from
ToJSON
aeson
package).
While lenses and prisms make it easy to define schemas, it might be that you don't need to:
and
ToSchema
classes both have default
ToParamSchema
-based implementations!
Generic
default implementation is also aligned with
ToSchema
default implementation with
the only difference being for sum encoding.
ToJSON
defaults sum encoding to
ToJSON
,
while
defaultTaggedObject
defaults to something which corresponds to
ToSchema
. This is due to
ObjectWithSingleField
behavior being hard to specify in Swagger.
defaultTaggedObject
Here's an example showing
–
ToJSON
correspondance:
ToSchema
>>>
data Person = Person { name :: String, age :: Integer } deriving Generic
>>>
instance ToJSON Person
>>>
instance ToSchema Person
>>>
BSL.putStrLn $ encodePretty (Person "David" 28)
{ "age": 28, "name": "David" }>>>
BSL.putStrLn $ encodePretty $ toSchema (Proxy :: Proxy Person)
{ "properties": { "age": { "type": "integer" }, "name": { "type": "string" } }, "required": [ "name", "age" ], "type": "object" }
This package implements OpenAPI 3.0 spec, which supports
oneOf
in schemas, allowing any sum types
to be faithfully represented. All sum encodings supported by
aeson
are supported here as well, with
an exception of
TwoElemArray
, since OpenAPI spec does not support heterogeneous arrays.
An example with
TaggedObject
encoding:
>>>
data Error = ErrorNoUser { userId :: Int } | ErrorAccessDenied { requiredPermission :: String } deriving Generic
>>>
instance ToJSON Error
>>>
instance ToSchema Error
>>>
BSL.putStrLn $ encodePretty $ toSchema (Proxy :: Proxy Error)
{ "oneOf": [ { "properties": { "tag": { "enum": [ "ErrorNoUser" ], "type": "string" }, "userId": { "maximum": 9223372036854775807, "minimum": -9223372036854775808, "type": "integer" } }, "required": [ "userId", "tag" ], "type": "object" }, { "properties": { "requiredPermission": { "type": "string" }, "tag": { "enum": [ "ErrorAccessDenied" ], "type": "string" } }, "required": [ "requiredPermission", "tag" ], "type": "object" } ] }
Manipulation
Sometimes you have to work with an imported or generated
.
For instance,
http://hackage.haskell.org/package/servant-swagger
generates basic
Swagger
for a type-level servant API.
Swagger
Lenses and prisms can be used to manipulate such specification to add additional information, tags, extra responses, etc.
To facilitate common needs,
Data.OpenApi.Operation
module provides useful helpers.
Validation
While
and
ToParamSchema
provide means to easily obtain schemas for Haskell types,
there is no static mechanism to ensure those instances correspond to the
ToSchema
or
ToHttpApiData
instances.
ToJSON
Data.OpenApi.Schema.Validation
addresses
/
ToJSON
validation.
ToSchema
Re-exports
module Data.OpenApi.Lens
module Data.OpenApi.Operation
module Data.OpenApi.ParamSchema
module Data.OpenApi.Schema
Swagger specification
This is the root document object for the API specification.
OpenApi | |
|
Instances
An object representing a Server.
Server | |
|
Instances
data ServerVariable Source #
ServerVariable | |
|
Instances
data Components Source #
Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.
Instances
Info types
The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.
Info | |
|
Instances
Contact information for the exposed API.
Contact | |
|
Instances
License information for the exposed API.
License | |
|
Instances
Eq License Source # | |
Data License Source # | |
Defined in Data.OpenApi.Internal gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> License -> c License Source # gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c License Source # toConstr :: License -> Constr Source # dataTypeOf :: License -> DataType Source # dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c License ) Source # dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c License ) Source # gmapT :: ( forall b. Data b => b -> b) -> License -> License Source # gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> License -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> License -> r Source # gmapQ :: ( forall d. Data d => d -> u) -> License -> [u] Source # gmapQi :: Int -> ( forall d. Data d => d -> u) -> License -> u Source # gmapM :: Monad m => ( forall d. Data d => d -> m d) -> License -> m License Source # gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> License -> m License Source # gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> License -> m License Source # |
|
Show License Source # | |
IsString License Source # | |
Defined in Data.OpenApi.Internal fromString :: String -> License Source # |
|
Generic License Source # | |
ToJSON License Source # | |
FromJSON License Source # | |
HasName License Text Source # | |
(k ~ A_Lens , a ~ Text , b ~ Text ) => LabelOptic "name" k License License a b Source # | |
Defined in Data.OpenApi.Optics |
|
(k ~ A_Lens , a ~ Maybe URL , b ~ Maybe URL ) => LabelOptic "url" k License License a b Source # | |
Defined in Data.OpenApi.Optics |
|
HasUrl License ( Maybe URL ) Source # | |
HasLicense Info ( Maybe License ) Source # | |
type Rep License Source # | |
Defined in Data.OpenApi.Internal
type
Rep
License
=
D1
('
MetaData
"License" "Data.OpenApi.Internal" "openapi3-3.2.3-DDms5mjbCFD41v1R6d21dC" '
False
) (
C1
('
MetaCons
"License" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"_licenseName") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
Text
)
:*:
S1
('
MetaSel
('
Just
"_licenseUrl") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
(
Maybe
URL
))))
|
PathItem
Describes the operations available on a single path.
A
may be empty, due to ACL constraints.
The path itself is still exposed to the documentation viewer
but they will not know which operations and parameters are available.
PathItem
PathItem | |
|
Instances
Operations
Describes a single API operation on a path.
Operation | |
|
Instances
Allows adding meta data to a single tag that is used by
Operation
.
It is not mandatory to have a
Tag
per tag used there.
Tag | |
|
Instances
Types and formats
data OpenApiType where Source #
Instances
type Definitions = InsOrdHashMap Text Source #
A list of definitions that can be used in references.
In order to support common ways of serializing simple parameters, a set of style values are defined.
StyleMatrix |
Path-style parameters defined by RFC6570 . |
StyleLabel |
Label style parameters defined by RFC6570 . |
StyleForm |
Form style parameters defined by
RFC6570
.
This option replaces
|
StyleSimple |
Simple style parameters defined by
RFC6570
.
This option replaces
|
StyleSpaceDelimited |
Space separated array values.
This option replaces
|
StylePipeDelimited |
Pipe separated array values.
This option replaces
|
StyleDeepObject |
Provides a simple way of rendering nested objects using form parameters. |
Instances
Eq Style Source # | |
Data Style Source # | |
Defined in Data.OpenApi.Internal gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> Style -> c Style Source # gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c Style Source # toConstr :: Style -> Constr Source # dataTypeOf :: Style -> DataType Source # dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c Style ) Source # dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c Style ) Source # gmapT :: ( forall b. Data b => b -> b) -> Style -> Style Source # gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> Style -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> Style -> r Source # gmapQ :: ( forall d. Data d => d -> u) -> Style -> [u] Source # gmapQi :: Int -> ( forall d. Data d => d -> u) -> Style -> u Source # gmapM :: Monad m => ( forall d. Data d => d -> m d) -> Style -> m Style Source # gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> Style -> m Style Source # gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> Style -> m Style Source # |
|
Show Style Source # | |
Generic Style Source # | |
ToJSON Style Source # | |
FromJSON Style Source # | |
HasStyle Param ( Maybe Style ) Source # | |
HasStyle Encoding ( Maybe Style ) Source # | |
type Rep Style Source # | |
Defined in Data.OpenApi.Internal
type
Rep
Style
=
D1
('
MetaData
"Style" "Data.OpenApi.Internal" "openapi3-3.2.3-DDms5mjbCFD41v1R6d21dC" '
False
) ((
C1
('
MetaCons
"StyleMatrix" '
PrefixI
'
False
) (
U1
::
Type
->
Type
)
:+:
(
C1
('
MetaCons
"StyleLabel" '
PrefixI
'
False
) (
U1
::
Type
->
Type
)
:+:
C1
('
MetaCons
"StyleForm" '
PrefixI
'
False
) (
U1
::
Type
->
Type
)))
:+:
((
C1
('
MetaCons
"StyleSimple" '
PrefixI
'
False
) (
U1
::
Type
->
Type
)
:+:
C1
('
MetaCons
"StyleSpaceDelimited" '
PrefixI
'
False
) (
U1
::
Type
->
Type
))
:+:
(
C1
('
MetaCons
"StylePipeDelimited" '
PrefixI
'
False
) (
U1
::
Type
->
Type
)
:+:
C1
('
MetaCons
"StyleDeepObject" '
PrefixI
'
False
) (
U1
::
Type
->
Type
))))
|
Parameters
Describes a single operation parameter. A unique parameter is defined by a combination of a name and location.
Param | |
|
Instances
data ParamLocation Source #
ParamQuery |
Parameters that are appended to the URL.
For example, in
|
ParamHeader |
Custom headers that are expected as part of the request. |
ParamPath |
Used together with Path Templating, where the parameter value is actually part of the operation's URL.
This does not include the host or base path of the API.
For example, in
|
ParamCookie |
Used to pass a specific cookie value to the API. |
Instances
Header fields have the same meaning as for
Param
.
Style is always treated as
StyleSimple
, as it is the only value allowed for headers.
Header | |
|
Instances
type HeaderName = Text Source #
Example | |
|
Instances
data RequestBody Source #
Describes a single request body.
RequestBody | |
|
Instances
data MediaTypeObject Source #
Each Media Type Object provides schema and examples for the media type identified by its key.
MediaTypeObject | |
|
Instances
Encoding | |
|
Instances
Schemas
Instances
data NamedSchema Source #
A
with an optional name.
This name can be used in references.
Schema
Instances
data OpenApiItems where Source #
Items for
schemas.
OpenApiArray
Warning : OpenAPI 3.0 does not support tuple arrays. However, OpenAPI 3.1 will, as it will incorporate Json Schema mostly verbatim.
should be used to specify homogenous array
OpenApiItemsObject
s.
Schema
should be used to specify tuple
OpenApiItemsArray
s.
Schema
OpenApiItemsObject :: Referenced Schema -> OpenApiItems | |
OpenApiItemsArray :: [ Referenced Schema ] -> OpenApiItems |
Instances
Xml | |
|
Instances
Eq Xml Source # | |
Data Xml Source # | |
Defined in Data.OpenApi.Internal gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> Xml -> c Xml Source # gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c Xml Source # toConstr :: Xml -> Constr Source # dataTypeOf :: Xml -> DataType Source # dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c Xml ) Source # dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c Xml ) Source # gmapT :: ( forall b. Data b => b -> b) -> Xml -> Xml Source # gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> Xml -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> Xml -> r Source # gmapQ :: ( forall d. Data d => d -> u) -> Xml -> [u] Source # gmapQi :: Int -> ( forall d. Data d => d -> u) -> Xml -> u Source # gmapM :: Monad m => ( forall d. Data d => d -> m d) -> Xml -> m Xml Source # gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> Xml -> m Xml Source # gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> Xml -> m Xml Source # |
|
Show Xml Source # | |
Generic Xml Source # | |
ToJSON Xml Source # | |
FromJSON Xml Source # | |
(k ~ A_Lens , a ~ Maybe Bool , b ~ Maybe Bool ) => LabelOptic "attribute" k Xml Xml a b Source # | |
Defined in Data.OpenApi.Optics |
|
(k ~ A_Lens , a ~ Maybe Text , b ~ Maybe Text ) => LabelOptic "name" k Xml Xml a b Source # | |
Defined in Data.OpenApi.Optics |
|
(k ~ A_Lens , a ~ Maybe Text , b ~ Maybe Text ) => LabelOptic "namespace" k Xml Xml a b Source # | |
Defined in Data.OpenApi.Optics |
|
(k ~ A_Lens , a ~ Maybe Text , b ~ Maybe Text ) => LabelOptic "prefix" k Xml Xml a b Source # | |
Defined in Data.OpenApi.Optics |
|
(k ~ A_Lens , a ~ Maybe Bool , b ~ Maybe Bool ) => LabelOptic "wrapped" k Xml Xml a b Source # | |
Defined in Data.OpenApi.Optics |
|
HasName Xml ( Maybe Text ) Source # | |
HasXml Schema ( Maybe Xml ) Source # | |
HasWrapped Xml ( Maybe Bool ) Source # | |
HasPrefix Xml ( Maybe Text ) Source # | |
HasNamespace Xml ( Maybe Text ) Source # | |
HasAttribute Xml ( Maybe Bool ) Source # | |
type Rep Xml Source # | |
Defined in Data.OpenApi.Internal
type
Rep
Xml
=
D1
('
MetaData
"Xml" "Data.OpenApi.Internal" "openapi3-3.2.3-DDms5mjbCFD41v1R6d21dC" '
False
) (
C1
('
MetaCons
"Xml" '
PrefixI
'
True
) ((
S1
('
MetaSel
('
Just
"_xmlName") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
(
Maybe
Text
))
:*:
S1
('
MetaSel
('
Just
"_xmlNamespace") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
(
Maybe
Text
)))
:*:
(
S1
('
MetaSel
('
Just
"_xmlPrefix") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
(
Maybe
Text
))
:*:
(
S1
('
MetaSel
('
Just
"_xmlAttribute") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
(
Maybe
Bool
))
:*:
S1
('
MetaSel
('
Just
"_xmlWrapped") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
(
Maybe
Bool
))))))
|
data AdditionalProperties Source #
Instances
data Discriminator Source #
Discriminator | |
|
Instances
Responses
A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. It is not expected from the documentation to necessarily cover all possible HTTP response codes, since they may not be known in advance. However, it is expected from the documentation to cover a successful operation response and any known errors.
Responses | |
|
Instances
Describes a single response from an API Operation.
Response | |
|
Instances
type HttpStatusCode = Int Source #
The Link object represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.
Link | |
|
Instances
A map of possible out-of band callbacks related to the parent operation.
Each value in the map is a
PathItem
Object that describes a set of requests that
may be initiated by the API provider and the expected responses.
The key value used to identify the path item object is an expression, evaluated at runtime,
that identifies a URL to use for the callback operation.
Instances
Security
data SecurityScheme Source #
SecurityScheme | |
|
Instances
data SecuritySchemeType Source #
>>>
BSL.putStrLn $ encodePretty (SecuritySchemeHttp (HttpSchemeBearer Nothing))
{ "scheme": "bearer", "type": "http" }
>>>
BSL.putStrLn $ encodePretty (SecuritySchemeHttp (HttpSchemeBearer (Just "jwt")))
{ "bearerFormat": "jwt", "scheme": "bearer", "type": "http" }
>>>
BSL.putStrLn $ encodePretty (SecuritySchemeHttp HttpSchemeBasic)
{ "scheme": "basic", "type": "http" }
>>>
BSL.putStrLn $ encodePretty (SecuritySchemeHttp (HttpSchemeCustom "CANARY"))
{ "scheme": "CANARY", "type": "http" }
>>>
BSL.putStrLn $ encodePretty (SecuritySchemeApiKey (ApiKeyParams "id" ApiKeyCookie))
{ "in": "cookie", "name": "id", "type": "apiKey" }
SecuritySchemeHttp HttpSchemeType | |
SecuritySchemeApiKey ApiKeyParams | |
SecuritySchemeOAuth2 OAuth2Flows | |
SecuritySchemeOpenIdConnect URL |
Instances
data HttpSchemeType Source #
Instances
newtype SecurityDefinitions Source #
Instances
newtype SecurityRequirement Source #
Lists the required security schemes to execute this operation. The object can have multiple security schemes declared in it which are all required (that is, there is a logical AND between the schemes).
Instances
API key
data ApiKeyParams Source #
ApiKeyParams | |
|
Instances
data ApiKeyLocation Source #
The location of the API key.
Instances
OAuth2
data OAuth2Flows Source #
OAuth2Flows | |
|
Instances
data OAuth2Flow p Source #
OAuth2Flow | |
|
Instances
newtype OAuth2ImplicitFlow Source #
Instances
newtype OAuth2PasswordFlow Source #
Instances
newtype OAuth2ClientCredentialsFlow Source #
Instances
data OAuth2AuthorizationCodeFlow Source #
Instances
type AuthorizationURL = Text Source #
The authorization URL to be used for OAuth2 flow. This SHOULD be in the form of a URL.
The token URL to be used for OAuth2 flow. This SHOULD be in the form of a URL.
External documentation
data ExternalDocs Source #
Allows referencing an external resource for extended documentation.
ExternalDocs | |
|
Instances
References
A simple object to allow referencing other definitions in the specification. It can be used to reference parameters and responses that are defined at the top level for reuse.
Instances
Eq Reference Source # | |
Data Reference Source # | |
Defined in Data.OpenApi.Internal gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> Reference -> c Reference Source # gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c Reference Source # toConstr :: Reference -> Constr Source # dataTypeOf :: Reference -> DataType Source # dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c Reference ) Source # dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c Reference ) Source # gmapT :: ( forall b. Data b => b -> b) -> Reference -> Reference Source # gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> Reference -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> Reference -> r Source # gmapQ :: ( forall d. Data d => d -> u) -> Reference -> [u] Source # gmapQi :: Int -> ( forall d. Data d => d -> u) -> Reference -> u Source # gmapM :: Monad m => ( forall d. Data d => d -> m d) -> Reference -> m Reference Source # gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> Reference -> m Reference Source # gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> Reference -> m Reference Source # |
|
Show Reference Source # | |
ToJSON Reference Source # | |
FromJSON Reference Source # | |
data Referenced a Source #
Instances
Miscellaneous
MimeList | |
|
Instances
Eq MimeList Source # | |
Data MimeList Source # | |
Defined in Data.OpenApi.Internal gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> MimeList -> c MimeList Source # gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c MimeList Source # toConstr :: MimeList -> Constr Source # dataTypeOf :: MimeList -> DataType Source # dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c MimeList ) Source # dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c MimeList ) Source # gmapT :: ( forall b. Data b => b -> b) -> MimeList -> MimeList Source # gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> MimeList -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> MimeList -> r Source # gmapQ :: ( forall d. Data d => d -> u) -> MimeList -> [u] Source # gmapQi :: Int -> ( forall d. Data d => d -> u) -> MimeList -> u Source # gmapM :: Monad m => ( forall d. Data d => d -> m d) -> MimeList -> m MimeList Source # gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> MimeList -> m MimeList Source # gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> MimeList -> m MimeList Source # |
|
Show MimeList Source # | |
Semigroup MimeList Source # | |
Monoid MimeList Source # | |
ToJSON MimeList Source # | |
FromJSON MimeList Source # | |
AesonDefaultValue MimeList Source # | |
Defined in Data.OpenApi.Internal |
|
SwaggerMonoid MimeList Source # | |
Defined in Data.OpenApi.Internal |
Instances
Eq URL Source # | |
Data URL Source # | |
Defined in Data.OpenApi.Internal gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> URL -> c URL Source # gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c URL Source # toConstr :: URL -> Constr Source # dataTypeOf :: URL -> DataType Source # dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c URL ) Source # dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c URL ) Source # gmapT :: ( forall b. Data b => b -> b) -> URL -> URL Source # gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> URL -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> URL -> r Source # gmapQ :: ( forall d. Data d => d -> u) -> URL -> [u] Source # gmapQi :: Int -> ( forall d. Data d => d -> u) -> URL -> u Source # gmapM :: Monad m => ( forall d. Data d => d -> m d) -> URL -> m URL Source # gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> URL -> m URL Source # gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> URL -> m URL Source # |
|
Ord URL Source # | |
Show URL Source # | |
Hashable URL Source # | |
ToJSON URL Source # | |
FromJSON URL Source # | |
SwaggerMonoid URL Source # | |
Defined in Data.OpenApi.Internal swaggerMempty :: URL Source # |
|
HasUrl ExternalDocs URL Source # | |
Defined in Data.OpenApi.Lens |
|
HasUrl License ( Maybe URL ) Source # | |
HasUrl Contact ( Maybe URL ) Source # | |
HasExternalValue Example ( Maybe URL ) Source # | |
Defined in Data.OpenApi.Lens |