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.
- module Data.Swagger.Schema
- data Swagger = Swagger {
- _info :: Info
- _host :: Maybe Host
- _basePath :: Maybe FilePath
- _schemes :: Maybe [Scheme]
- _consumes :: MimeList
- _produces :: MimeList
- _paths :: Paths
- _definitions :: HashMap Text Schema
- _parameters :: HashMap Text Parameter
- _responses :: HashMap Text Response
- _securityDefinitions :: HashMap Text SecurityScheme
- _security :: [SecurityRequirement]
- _tags :: [Tag]
- _externalDocs :: Maybe ExternalDocs
- data Host = Host {}
- data Scheme
- data Info = Info {}
- data Contact = Contact {}
- data License = License {
- _licenseName :: Text
- _licenseUrl :: Maybe URL
- data Paths = Paths {}
- data PathItem = PathItem {}
- data Tag = Tag {}
- data Operation = Operation {
- _operationTags :: [Text]
- _operationSummary :: Maybe Text
- _operationDescription :: Maybe Text
- _operationExternalDocs :: Maybe ExternalDocs
- _operationOperationId :: Maybe Text
- _operationConsumes :: Maybe MimeList
- _operationProduces :: Maybe MimeList
- _operationParameters :: [Referenced Parameter]
- _operationResponses :: Responses
- _operationSchemes :: Maybe [Scheme]
- _operationDeprecated :: Maybe Bool
- _operationSecurity :: [SecurityRequirement]
- data ParameterType
- data ItemsType
- data SchemaType
- type Format = Text
- data CollectionFormat
- data ItemsCollectionFormat
- data Parameter = Parameter {}
- data ParameterSchema
- data ParameterOtherSchema = ParameterOtherSchema {
- _parameterOtherSchemaIn :: ParameterLocation
- _parameterOtherSchemaType :: ParameterType
- _parameterOtherSchemaFormat :: Maybe Format
- _parameterOtherSchemaAllowEmptyValue :: Maybe Bool
- _parameterOtherSchemaItems :: Maybe Items
- _parameterOtherSchemaCollectionFormat :: Maybe CollectionFormat
- _parameterOtherSchemaCommon :: SchemaCommon
- data ParameterLocation
- type ParamName = Text
- data Items = Items {}
- data Header = Header {}
- data Example = Example {}
- data Schema = Schema {
- _schemaType :: SchemaType
- _schemaFormat :: Maybe Format
- _schemaTitle :: Maybe Text
- _schemaDescription :: Maybe Text
- _schemaRequired :: [ParamName]
- _schemaItems :: Maybe SchemaItems
- _schemaAllOf :: Maybe [Schema]
- _schemaProperties :: HashMap Text (Referenced Schema)
- _schemaAdditionalProperties :: Maybe Schema
- _schemaDiscriminator :: Maybe Text
- _schemaReadOnly :: Maybe Bool
- _schemaXml :: Maybe Xml
- _schemaExternalDocs :: Maybe ExternalDocs
- _schemaExample :: Maybe Value
- _schemaMaxProperties :: Maybe Integer
- _schemaMinProperties :: Maybe Integer
- _schemaSchemaCommon :: SchemaCommon
- data SchemaItems
- data SchemaCommon = SchemaCommon {
- _schemaCommonDefault :: Maybe Value
- _schemaCommonMaximum :: Maybe Scientific
- _schemaCommonExclusiveMaximum :: Maybe Bool
- _schemaCommonMinimum :: Maybe Scientific
- _schemaCommonExclusiveMinimum :: Maybe Bool
- _schemaCommonMaxLength :: Maybe Integer
- _schemaCommonMinLength :: Maybe Integer
- _schemaCommonPattern :: Maybe Text
- _schemaCommonMaxItems :: Maybe Integer
- _schemaCommonMinItems :: Maybe Integer
- _schemaCommonUniqueItems :: Maybe Bool
- _schemaCommonEnum :: Maybe [Value]
- _schemaCommonMultipleOf :: Maybe Scientific
- data Xml = Xml {
- _xmlName :: Maybe Text
- _xmlNamespace :: Maybe Text
- _xmlPrefix :: Maybe Text
- _xmlAttribute :: Maybe Bool
- _xmlWrapped :: Maybe Bool
- data Responses = Responses {}
- data Response = Response {}
- data SecurityScheme = SecurityScheme {}
- data SecuritySchemeType
- newtype SecurityRequirement = SecurityRequirement {}
- data ApiKeyParams = ApiKeyParams {}
- data ApiKeyLocation
- data OAuth2Params = OAuth2Params {}
- data OAuth2Flow
- 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 {}
Documentation
module Data.Swagger.Schema
Swagger specification
This is the root document object for the API specification.
Swagger | |
|
The host (name or ip) serving the API. It MAY include a port.
The transfer protocol of the API.
Info types
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.
Info | |
|
Contact information for the exposed API.
Contact | |
|
License information for the exposed API.
License | |
|
Paths
The available paths and operations for the API.
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 | |
|
Operations
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 | |
|
Describes a single API operation on a path.
Operation | |
|
Types and formats
data ParameterType Source
data SchemaType Source
data CollectionFormat Source
Determines the format of the array.
CollectionCSV | Comma separated values: |
CollectionSSV | Space separated values: |
CollectionTSV | Tab separated values: |
CollectionPipes | Pipe separated values: |
CollectionMulti | Corresponds to multiple parameter instances
instead of multiple values for a single instance |
data ItemsCollectionFormat Source
Determines the format of the nested array.
ItemsCollectionCSV | Comma separated values: |
ItemsCollectionSSV | Space separated values: |
ItemsCollectionTSV | Tab separated values: |
ItemsCollectionPipes | Pipe separated values: |
Parameters
Describes a single operation parameter. A unique parameter is defined by a combination of a name and location.
Parameter | |
|
data ParameterSchema Source
data ParameterOtherSchema Source
ParameterOtherSchema | |
|
data ParameterLocation Source
ParameterQuery | Parameters that are appended to the URL.
For example, in |
ParameterHeader | Custom headers that are expected as part of the request. |
ParameterPath | 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 |
ParameterFormData | Used to describe the payload of an HTTP request when either |
Items | |
|
Header | |
|
Schema
data SchemaItems Source
data SchemaCommon Source
SchemaCommon | |
|
Xml | |
|
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 | |
|
Describes a single response from an API Operation.
Response | |
|
Security
data SecurityScheme Source
SecurityScheme | |
|
data SecuritySchemeType Source
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).
API key
data ApiKeyParams Source
ApiKeyParams | |
|
data ApiKeyLocation Source
The location of the API key.
OAuth2
data OAuth2Params Source
OAuth2Params | |
|
data OAuth2Flow 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 ExternalDocs Source
Allows referencing an external resource for extended documentation.
ExternalDocs | |
|
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.
data Referenced a Source
Eq a => Eq (Referenced a) Source | |
Show a => Show (Referenced a) Source | |
ToJSON a => ToJSON (Referenced a) Source | |
FromJSON a => FromJSON (Referenced a) Source | |
Monoid a => SwaggerMonoid (Referenced a) Source | |
SwaggerMonoid (HashMap Text (Referenced Schema)) Source | |
SwaggerMonoid (HashMap HttpStatusCode (Referenced Response)) Source |
Miscellaneous
MimeList | |
|