Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Swagger
Contents
Description
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.
- data Swagger = Swagger {
- _swaggerInfo :: SwaggerInfo
- _swaggerHost :: Maybe SwaggerHost
- _swaggerBasePath :: Maybe FilePath
- _swaggerSchemes :: Maybe [SwaggerScheme]
- _swaggerConsumes :: SwaggerMimeList
- _swaggerProduces :: SwaggerMimeList
- _swaggerPaths :: SwaggerPaths
- _swaggerDefinitions :: HashMap Text SwaggerSchema
- _swaggerParameters :: HashMap Text SwaggerParameter
- _swaggerResponses :: HashMap Text SwaggerResponse
- _swaggerSecurityDefinitions :: HashMap Text SwaggerSecurityScheme
- _swaggerSecurity :: [SwaggerSecurityRequirement]
- _swaggerTags :: [SwaggerTag]
- _swaggerExternalDocs :: Maybe SwaggerExternalDocs
- data SwaggerHost = SwaggerHost {}
- data SwaggerScheme
- data SwaggerInfo = SwaggerInfo {}
- data SwaggerContact = SwaggerContact {}
- data SwaggerLicense = SwaggerLicense {}
- data SwaggerPaths = SwaggerPaths {}
- data SwaggerPathItem = SwaggerPathItem {
- _swaggerPathItemGet :: Maybe SwaggerOperation
- _swaggerPathItemPut :: Maybe SwaggerOperation
- _swaggerPathItemPost :: Maybe SwaggerOperation
- _swaggerPathItemDelete :: Maybe SwaggerOperation
- _swaggerPathItemOptions :: Maybe SwaggerOperation
- _swaggerPathItemHead :: Maybe SwaggerOperation
- _swaggerPathItemPatch :: Maybe SwaggerOperation
- _swaggerPathItemParameters :: [SwaggerReferenced SwaggerParameter]
- data SwaggerTag = SwaggerTag {}
- data SwaggerOperation = SwaggerOperation {
- _swaggerOperationTags :: [Text]
- _swaggerOperationSummary :: Maybe Text
- _swaggerOperationDescription :: Maybe Text
- _swaggerOperationExternalDocs :: Maybe SwaggerExternalDocs
- _swaggerOperationOperationId :: Maybe Text
- _swaggerOperationConsumes :: Maybe SwaggerMimeList
- _swaggerOperationProduces :: Maybe SwaggerMimeList
- _swaggerOperationParameters :: [SwaggerReferenced SwaggerParameter]
- _swaggerOperationResponses :: SwaggerResponses
- _swaggerOperationSchemes :: Maybe [SwaggerScheme]
- _swaggerOperationDeprecated :: Maybe Bool
- _swaggerOperationSecurity :: [SwaggerSecurityRequirement]
- data SwaggerParameterType
- data SwaggerItemsType
- data SwaggerSchemaType
- type SwaggerFormat = Text
- data SwaggerCollectionFormat
- data SwaggerItemsCollectionFormat
- data SwaggerParameter = SwaggerParameter {}
- data SwaggerParameterSchema
- data SwaggerParameterOtherSchema = SwaggerParameterOtherSchema {
- _swaggerParameterOtherSchemaIn :: SwaggerParameterLocation
- _swaggerParameterOtherSchemaType :: SwaggerParameterType
- _swaggerParameterOtherSchemaFormat :: Maybe SwaggerFormat
- _swaggerParameterOtherSchemaAllowEmptyValue :: Maybe Bool
- _swaggerParameterOtherSchemaItems :: Maybe SwaggerItems
- _swaggerParameterOtherSchemaCollectionFormat :: Maybe SwaggerCollectionFormat
- _swaggerParameterOtherSchemaCommon :: SwaggerSchemaCommon
- data SwaggerParameterLocation
- type SwaggerParamName = Text
- data SwaggerItems = SwaggerItems {}
- data SwaggerHeader = SwaggerHeader {}
- data SwaggerExample = SwaggerExample {}
- data SwaggerSchema = SwaggerSchema {
- _swaggerSchemaType :: SwaggerSchemaType
- _swaggerSchemaFormat :: Maybe SwaggerFormat
- _swaggerSchemaTitle :: Maybe Text
- _swaggerSchemaDescription :: Maybe Text
- _swaggerSchemaRequired :: [SwaggerParamName]
- _swaggerSchemaItems :: Maybe SwaggerSchemaItems
- _swaggerSchemaAllOf :: Maybe [SwaggerSchema]
- _swaggerSchemaProperties :: HashMap Text (SwaggerReferenced SwaggerSchema)
- _swaggerSchemaAdditionalProperties :: Maybe SwaggerSchema
- _swaggerSchemaDiscriminator :: Maybe Text
- _swaggerSchemaReadOnly :: Maybe Bool
- _swaggerSchemaXml :: Maybe SwaggerXml
- _swaggerSchemaExternalDocs :: Maybe SwaggerExternalDocs
- _swaggerSchemaExample :: Maybe Value
- _swaggerSchemaMaxProperties :: Maybe Integer
- _swaggerSchemaMinProperties :: Maybe Integer
- _swaggerSchemaCommon :: SwaggerSchemaCommon
- data SwaggerSchemaItems
- data SwaggerSchemaCommon = SwaggerSchemaCommon {
- _swaggerSchemaDefault :: Maybe Value
- _swaggerSchemaMaximum :: Maybe Integer
- _swaggerSchemaExclusiveMaximum :: Maybe Bool
- _swaggerSchemaMinimum :: Maybe Integer
- _swaggerSchemaExclusiveMinimum :: Maybe Bool
- _swaggerSchemaMaxLength :: Maybe Integer
- _swaggerSchemaMinLength :: Maybe Integer
- _swaggerSchemaPattern :: Maybe Text
- _swaggerSchemaMaxItems :: Maybe Integer
- _swaggerSchemaMinItems :: Maybe Integer
- _swaggerSchemaUniqueItems :: Maybe Bool
- _swaggerSchemaEnum :: Maybe [Value]
- _swaggerSchemaMultipleOf :: Maybe Integer
- data SwaggerXml = SwaggerXml {}
- data SwaggerResponses = SwaggerResponses {}
- data SwaggerResponse = SwaggerResponse {}
- data SwaggerSecurityScheme = SwaggerSecurityScheme {}
- data SwaggerSecuritySchemeType
- newtype SwaggerSecurityRequirement = SwaggerSecurityRequirement {}
- data SwaggerApiKeyParams = SwaggerApiKeyParams {}
- data SwaggerApiKeyLocation
- data SwaggerOAuth2Params = SwaggerOAuth2Params {}
- data SwaggerOAuth2Flow
- type AuthorizationURL = Text
- type TokenURL = Text
- data SwaggerExternalDocs = SwaggerExternalDocs {}
- newtype SwaggerReference = SwaggerReference {}
- data SwaggerReferenced a
- newtype SwaggerMimeList = SwaggerMimeList {}
- newtype URL = URL {}
Swagger specification
This is the root document object for the API specification.
Constructors
Swagger | |
Fields
|
data SwaggerHost Source
The host (name or ip) serving the API. It MAY include a port.
Constructors
SwaggerHost | |
Fields
|
data SwaggerScheme Source
The transfer protocol of the API.
Info types
data SwaggerInfo Source
The object provides metadata about the API. The metadata can be used by the clients if needed, and can be presented in the Swagger-UI for convenience.
Constructors
SwaggerInfo | |
Fields
|
data SwaggerContact Source
Contact information for the exposed API.
Constructors
SwaggerContact | |
Fields
|
data SwaggerLicense Source
License information for the exposed API.
Constructors
SwaggerLicense | |
Fields
|
Paths
data SwaggerPaths Source
The available paths and operations for the API.
Constructors
SwaggerPaths | |
Fields
|
data SwaggerPathItem Source
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.SwaggerPathItem
Constructors
SwaggerPathItem | |
Fields
|
Instances
Operations
data SwaggerTag Source
Allows adding meta data to a single tag that is used by SwaggerOperation
.
It is not mandatory to have a SwaggerTag
per tag used there.
Constructors
SwaggerTag | |
Fields
|
data SwaggerOperation Source
Describes a single API operation on a path.
Constructors
SwaggerOperation | |
Fields
|
Instances
Types and formats
data SwaggerItemsType Source
data SwaggerSchemaType Source
type SwaggerFormat = Text Source
data SwaggerCollectionFormat Source
Determines the format of the array.
Constructors
SwaggerCollectionCSV | Comma separated values: |
SwaggerCollectionSSV | Space separated values: |
SwaggerCollectionTSV | Tab separated values: |
SwaggerCollectionPipes | Pipe separated values: |
SwaggerCollectionMulti | Corresponds to multiple parameter instances
instead of multiple values for a single instance |
data SwaggerItemsCollectionFormat Source
Determines the format of the nested array.
Constructors
SwaggerItemsCollectionCSV | Comma separated values: |
SwaggerItemsCollectionSSV | Space separated values: |
SwaggerItemsCollectionTSV | Tab separated values: |
SwaggerItemsCollectionPipes | Pipe separated values: |
Parameters
data SwaggerParameter Source
Describes a single operation parameter. A unique parameter is defined by a combination of a name and location.
Constructors
SwaggerParameter | |
Fields
|
Instances
data SwaggerParameterOtherSchema Source
Constructors
SwaggerParameterOtherSchema | |
Fields
|
Instances
data SwaggerParameterLocation Source
Constructors
SwaggerParameterQuery | Parameters that are appended to the URL.
For example, in |
SwaggerParameterHeader | Custom headers that are expected as part of the request. |
SwaggerParameterPath | 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 |
SwaggerParameterFormData | Used to describe the payload of an HTTP request when either |
type SwaggerParamName = Text Source
data SwaggerItems Source
Constructors
SwaggerItems | |
Fields
|
data SwaggerHeader Source
Constructors
SwaggerHeader | |
Fields
|
Instances
data SwaggerExample Source
Constructors
SwaggerExample | |
Fields |
Schema
data SwaggerSchema Source
Constructors
Instances
data SwaggerSchemaItems Source
data SwaggerSchemaCommon Source
Constructors
SwaggerSchemaCommon | |
Fields
|
Instances
data SwaggerXml Source
Constructors
SwaggerXml | |
Fields
|
Responses
data SwaggerResponses Source
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.
Constructors
SwaggerResponses | |
Fields
|
data SwaggerResponse Source
Describes a single response from an API Operation.
Constructors
SwaggerResponse | |
Fields
|
Instances
Security
data SwaggerSecurityScheme Source
Constructors
SwaggerSecurityScheme | |
Fields
|
Instances
newtype SwaggerSecurityRequirement 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).
Constructors
SwaggerSecurityRequirement | |
Fields |
API key
data SwaggerApiKeyParams Source
Constructors
SwaggerApiKeyParams | |
Fields
|
data SwaggerApiKeyLocation Source
The location of the API key.
Constructors
SwaggerApiKeyQuery | |
SwaggerApiKeyHeader |
OAuth2
data SwaggerOAuth2Params Source
Constructors
SwaggerOAuth2Params | |
Fields
|
data SwaggerOAuth2Flow Source
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 SwaggerExternalDocs Source
Allows referencing an external resource for extended documentation.
Constructors
SwaggerExternalDocs | |
Fields
|
Instances
References
newtype SwaggerReference Source
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.
Constructors
SwaggerReference | |
Fields |
data SwaggerReferenced a Source
Constructors
SwaggerRef SwaggerReference | |
SwaggerInline a |
Instances
Eq a => Eq (SwaggerReferenced a) Source | |
Show a => Show (SwaggerReferenced a) Source | |
ToJSON a => ToJSON (SwaggerReferenced a) Source | |
FromJSON a => FromJSON (SwaggerReferenced a) Source | |
Monoid a => SwaggerMonoid (SwaggerReferenced a) Source | |
SwaggerMonoid (HashMap Text (SwaggerReferenced SwaggerSchema)) Source | |
SwaggerMonoid (HashMap HttpStatusCode (SwaggerReferenced SwaggerResponse)) Source |
Miscellaneous
newtype SwaggerMimeList Source
Constructors
SwaggerMimeList | |
Fields |