/** * Custom extensions can use arbitrary type as the value, * e.g. a string, an object or an array. */ export declare type ExtensionValue = any; /** * While the Swagger Specification tries to accommodate most use cases, * additional data can be added to extend the specification at certain points. * * The extensions properties are always prefixed by "x-" and can have any valid * JSON format value. * * The extensions may or may not be supported by the available tooling, but * those may be extended as well to add requested support (if tools are internal * or open-sourced). */ export interface Extensible { [extension: string]: ExtensionValue; } /** * This is the root document object for the API specification. *
Specification:
* https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swagger-object
*/
export interface OpenApiSpec extends Extensible {
/**
* Specifies the Swagger Specification version being used.
* It can be used by the Swagger UI and other clients to interpret
* the API listing. The value MUST be "2.0".
*/
swagger: '2.0';
/**
* Provides metadata about the API.
* The metadata can be used by the clients if needed.
*/
info: InfoObject;
/**
* The host (name or ip) serving the API.
* This MUST be the host only and does not include the scheme nor sub-paths.
* It MAY include a port. If the host is not included,
* the host serving the documentation is to be used (including the port).
* The host does not support
* [path templating](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#pathTemplating).
*/
host?: string;
/**
* The base path on which the API is served, which is relative to the host.
* If it is not included, the API is served directly under the host.
* The value MUST start with a leading slash (/).
* The basePath does not support
* [path templating](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#pathTemplating).
*/
basePath: string;
/**
* The transfer protocol of the API. Values MUST be from the list: "http",
* "https", "ws", "wss". If the schemes is not included, the default scheme
* to be used is the one used to access the Swagger definition itself.
*/
schemes?: Array Specification:
* https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#infoObject
*/
export interface InfoObject extends Extensible {
/**
* The title of the application.
*/
title: string;
/**
* A short description of the application.
* [GFM syntax](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown)
* can be used for rich text representation.
*/
description?: string;
/**
* The Terms of Service for the API.
*/
termsOfService?: string;
/**
* The contact information for the exposed API.
*/
contact?: ContactObject;
/**
* The license information for the exposed API.
*/
license?: LicenseObject;
/**
* Provides the version of the application API
* (not to be confused with the specification version).
*/
version: string;
}
/**
* Contact information for the exposed API.
*/
export interface ContactObject extends Extensible {
/**
* The identifying name of the contact person/organization.
*/
name?: string;
/**
*The URL pointing to the contact information. MUST be in the format of a URL.
*/
url?: string;
/**
* The email address of the contact person/organization. MUST be in the format
* of an email address.
*/
email?: string;
}
/**
* License information for the exposed API.
*/
export interface LicenseObject extends Extensible {
/**
* The license name used for the API.
*/
name: string;
/**
* A URL to the license used for the API. MUST be in the format of a URL.
*/
url?: string;
}
/**
* Allows referencing an external resource for extended documentation.
*/
export interface ExternalDocumentationObject extends Extensible {
/**
* A short description of the target documentation. GFM syntax can be used for
* rich text representation.
*/
description?: string;
/**
* The URL for the target documentation. Value MUST be in the format of a URL.
*/
url: string;
}
/**
* Allows adding meta data to a single tag that is used by the Operation Object.
* It is not mandatory to have a Tag Object per tag used there.
*/
export interface TagObject extends Extensible {
/**
* The name of the tag.
*/
name: string;
/**
* A short description for the tag. GFM syntax can be used for rich text
* representation.
*/
description?: string;
/**
* Additional external documentation for this tag.
*/
externalDocs?: ExternalDocumentationObject;
}
/**
* Allows the definition of a security scheme that can be used by the
* operations. Supported schemes are basic authentication, an API key (either
* as a header or as a query parameter) and OAuth2's common flows (implicit,
* password, application and access code).
*/
export interface SecuritySchemeObject extends Extensible {
/**
* The type of the security scheme. Valid values are "basic", "apiKey" or
* "oauth2".
*/
type: 'basic' | 'apiKey' | 'oauth2';
/**
* A short description for security scheme.
*/
description?: string;
/**
* The name of the header or query parameter to be used.
*/
name?: string;
/**
* The location of the API key. Valid values are "query" or "header".
*/
in?: 'query' | 'header';
/**
* The flow used by the OAuth2 security scheme. Valid values are "implicit",
* "password", "application" or "accessCode".
*/
flow?: 'implicit' | 'password' | 'application' | 'accessCode';
/**
* ("implicit", "accessCode") Required. The authorization URL to be used for
* this flow. This SHOULD be in the form of a URL.
*/
authorizationUrl?: string;
/**
* ("password", "application", "accessCode") Required. The token URL to be
* used for this flow. This SHOULD be in the form of a URL.
*/
tokenUrl?: string;
/**
* The available scopes for the OAuth2 security scheme.
*/
scopes?: ScopesObject;
}
/**
* Maps names to a given type of values
*/
export interface MapObject Specification:
* https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#paths-object
*/
export interface PathsObject extends MapObject Specification:
* https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#pathItemObject
*/
export interface PathItemObject extends Extensible {
/**
* Allows for an external definition of this path item. The referenced
* structure MUST be in the format of a Path Item Object. If there are
* conflicts between the referenced definition and this Path Item's
* definition, the behavior is undefined.
*/
$ref?: string;
/**
* A definition of a GET operation on this path.
*/
get?: OperationObject;
/**
* A definition of a PUT operation on this path.
*/
put?: OperationObject;
/**
* A definition of a POST operation on this path.
*/
post?: OperationObject;
/**
* A definition of a DELETE operation on this path.
*/
delete?: OperationObject;
/**
* A definition of a OPTIONS operation on this path.
*/
options?: OperationObject;
/**
* A definition of a HEAD operation on this path.
*/
head?: OperationObject;
/**
* A definition of a PATCH operation on this path.
*/
patch?: OperationObject;
/**
* A list of parameters that are applicable for all the operations described
* under this path. These parameters can be overridden at the operation level,
* but cannot be removed there. The list MUST NOT include duplicated
* parameters. A unique parameter is defined by a combination of a name and
* location. The list can use the Reference Object to link to parameters that
* are defined at the Swagger Object's parameters. There can be one "body"
* parameter at most.
*/
parameters?: Array Specification:
* https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#operationObject
*/
export interface OperationObject extends Extensible {
/**
* IBM/LoopBack extension: The name of the controller method implementing
* this operation.
*/
'x-operation-name'?: string;
/**
* A list of parameters that are applicable for this operation.
* If a parameter is already defined at the Path Item,
* the new definition will override it, but can never remove it.
* The list MUST NOT include duplicated parameters.
* A unique parameter is defined by a combination of a name and location.
* The list can use the Reference Object to link to parameters that are
* defined at the Swagger Object's parameters.
* There can be one "body" parameter at most.
*/
parameters?: Array Specification:
* https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameterObject
*/
export interface ParameterObject extends SimpleType, Extensible {
/**
* The name of the parameter. Parameter names are case sensitive.
* - If `in` is "path", the `name` field MUST correspond to the associated
* path segment from the `path` field in the Paths Object.
* See [Path Templating](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#pathTemplating)
* for further information.
* - For all other cases, the `name` corresponds to the parameter name used
* based on the `in` property.
*/
name: string;
/**
* The location of the parameter.
* Possible values are "query", "header", "path", "formData" or "body".
*/
in: ParameterLocation;
/**
* A brief description of the parameter. This could contain examples of use.
* [GFM syntax](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown)
* can be used for rich text representation.
*/
description?: string;
/**
* Determines whether this parameter is mandatory.
* If the parameter is `in` "path", this property is required and
* its value MUST be `true`. Otherwise, the property MAY be included
* and its default value is `false`.
*/
required?: boolean;
/**
* _If `in` is any value other than "body":_, the valid properties are
* inherited from `SimpleType`.
*/
/**
* _If in is "body":_
* The schema defining the type used for the body parameter.
*/
schema?: SchemaObject;
}
/**
* The location of a parameter.
* Possible values are "query", "header", "path", "formData" or "body".
* Specification:
* https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameterIn
*/
export declare type ParameterLocation = 'query' | 'header' | 'path' | 'formData' | 'body';
/**
* 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.
* The Reference Object is a [JSON Reference](http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-02)
* that uses a [JSON Pointer](https://tools.ietf.org/html/rfc6901) as its value.
* For this specification, only canonical dereferencing is supported.
* Specification:
* https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#referenceObject
* **Example**
* ```json
* {
* "$ref": "#/definitions/Pet"
* }
* ```
*/
export interface ReferenceObject {
/**
* The reference string.
*/
$ref: string;
}
/**
* 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.
* The `default` can be used as the default response object for all
* HTTP codes that are not covered individually by the specification.
* The `ResponsesObject` MUST contain at least one response code,
* and it SHOULD be the response for a successful operation call.
* Specification:
* https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#responsesObject
*/
export interface ResponsesObject extends MapObject Specification:
* https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#responseObject
*/
export interface ResponseObject extends Extensible {
/**
* A short description of the response.
* [GFM syntax](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown)
* can be used for rich text representation.
*/
description: string;
/**
* A definition of the response structure.
* It can be a primitive, an array or an object.
* If this field does not exist, it means no content is returned
* as part of the response. As an extension to the `SchemaObject`,
* its root type value may also be "file".
* This SHOULD be accompanied by a relevant `produces` mime-type.
*/
schema: SchemaObject;
/**
* A list of headers that are sent with the response.
*/
headers?: HeadersObject;
/**
* An example of the response message.
*/
examples?: ExampleObject;
}
/**
* Allows sharing examples for operation responses.
*/
export interface ExampleObject extends MapObject Specification:
* https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject
*/
export interface SchemaObject extends Extensible {
/**
* The following properties are taken directly from the JSON Schema
* definition and follow the same specifications:
*/
$ref?: string;
format?: string;
title?: string;
description?: string;
default?: ExtensionValue;
multipleOf?: number;
maximum?: number;
exclusiveMaximum?: number;
minimum?: number;
exclusiveMinimum?: number;
maxLength?: number;
minLength?: number;
pattern?: string;
maxItems?: number;
minItems?: number;
uniqueItems?: boolean;
maxProperties?: number;
minProperties?: number;
required?: Array