Contact information for the exposed API.
An object to hold data types that can be consumed and produced by operations. These data types can be primitives, arrays or models.
Allows sharing examples for operation responses.
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).
Allows referencing an external resource for extended documentation.
| Name | Type | Description |
|---|---|---|
| description |
string
|
A short description of the header. |
Lists the headers that can be sent as part of a response.
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.
Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#infoObject
| Name | Type | Description |
|---|---|---|
| contact |
ContactObject
|
The contact information for the exposed API. |
| description |
|
A short description of the application. GFM syntax can be used for rich text representation. |
| license |
LicenseObject
|
The license information for the exposed API. |
| termsOfService |
|
The Terms of Service for the API. |
| title |
string
|
The title of the application. |
| version |
string
|
Provides the version of the application API (not to be confused with the specification version). |
A limited subset of JSON-Schema's items object. It is used by parameter
definitions that are not located in "body". Please note it only differs
from SimpleType with parameter types excluding file.
| Name | Type | Description |
|---|---|---|
| type |
ItemType
|
A limited subset of JSON-Schema's items object. It is used by parameter
definitions that are not located in "body". Please note it only differs
from SimpleType with parameter types excluding |
License information for the exposed API.
| Name | Type | Description |
|---|---|---|
| name |
string
|
The license name used for the API. |
| url |
|
A URL to the license used for the API. MUST be in the format of a URL. |
Maps names to a given type of values
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
| Name | Type | Description |
|---|---|---|
| basePath |
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. |
| consumes |
Array
|
A list of MIME types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under Mime Types. |
| definitions |
DefinitionsObject
|
An object to hold data types produced and consumed by operations. |
| externalDocs |
ExternalDocumentationObject
|
Additional external documentation. |
| host |
|
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. |
| info |
InfoObject
|
Provides metadata about the API. The metadata can be used by the clients if needed. |
| parameters |
ParametersDefinitionsObject
|
An object to hold parameters that can be used across operations. This property does not define global parameters for all operations. |
| paths |
PathsObject
|
The available paths and operations for the API. |
| produces |
Array
|
A list of MIME types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under Mime Types. |
| responses |
ResponsesDefinitionsObject
|
An object to hold responses that can be used across operations. This property does not define global responses for all operations. |
| schemes |
Array
|
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. |
| security |
Array
|
A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition. |
| securityDefinitions |
SecurityDefinitionsObject
|
Security scheme definitions that can be used across the specification. |
| swagger |
|
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". |
| tags |
Array
|
A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the Operation Object must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique. |
Describes a single API operation on a path.
Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#operationObject
| Name | Type | Description |
|---|---|---|
| consumes |
Array
|
A list of MIME types the operation can consume. This overrides the consumes definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under Mime Types. |
| deprecated |
|
Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is false. |
| description |
|
A verbose explanation of the operation behavior. GFM syntax can be used for rich text representation. |
| externalDocs |
ExternalDocumentationObject
|
Additional external documentation for this operation. |
| operationId |
|
Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions. |
| parameters |
Array
|
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. |
| produces |
Array
|
A list of MIME types the operation can produce. This overrides the produces definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under Mime Types. |
| responses |
ResponsesObject
|
The list of possible responses as they are returned from executing this operation. |
| schemes |
Array
|
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. |
| security |
SecurityRequirementObject
|
A declaration of which security schemes are applied for this operation. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used. |
| summary |
|
A short summary of what the operation does. For maximum readability in the swagger-ui, this field SHOULD be less than 120 characters. |
| tags |
Array
|
A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. |
| x-operation-name |
|
IBM/LoopBack extension: The name of the controller method implementing this operation. |
Describes a single operation parameter.
Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameterObject
| Name | Type | Description |
|---|---|---|
| description |
|
A brief description of the parameter. This could contain examples of use. GFM syntax can be used for rich text representation. |
| in |
ParameterLocation
|
The location of the parameter. Possible values are "query", "header", "path", "formData" or "body". |
| name |
string
|
The name of the parameter. Parameter names are case sensitive.
|
| required |
|
Determines whether this parameter is mandatory.
If the parameter is |
| schema |
SchemaObject
|
If in is "body": The schema defining the type used for the body parameter. |
An object to hold parameters to be reused across operations. Parameter definitions can be referenced to the ones defined here.
This does not define global operation parameters.
Describes the operations available on a single path. A Path Item 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.
Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#pathItemObject
| Name | Type | Description |
|---|---|---|
| $ref |
|
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. |
| delete |
OperationObject
|
A definition of a DELETE operation on this path. |
| get |
OperationObject
|
A definition of a GET operation on this path. |
| head |
OperationObject
|
A definition of a HEAD operation on this path. |
| options |
OperationObject
|
A definition of a OPTIONS operation on this path. |
| parameters |
Array
|
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. |
| patch |
OperationObject
|
A definition of a PATCH operation on this path. |
| post |
OperationObject
|
A definition of a POST operation on this path. |
| put |
OperationObject
|
A definition of a PUT operation on this path. |
Holds the relative paths to the individual endpoints. The path is appended to the basePath in order to construct the full URL. The Paths may be empty, due to ACL constraints.
Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#paths-object
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 that uses a JSON Pointer 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
{
"$ref": "#/definitions/Pet"
}
| Name | Type | Description |
|---|---|---|
| $ref |
string
|
The reference string. |
Describes a single response from an API Operation.
Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#responseObject
| Name | Type | Description |
|---|---|---|
| description |
string
|
A short description of the response. GFM syntax can be used for rich text representation. |
| examples |
ExampleObject
|
An example of the response message. |
| headers |
HeadersObject
|
A list of headers that are sent with the response. |
| schema |
SchemaObject
|
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 |
An object to hold responses to be reused across operations. Response definitions can be referenced to the ones defined here.
This does not define global operation 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.
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
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation.
Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject
| Name | Type | Description |
|---|---|---|
| $ref |
|
The following properties are taken directly from the JSON Schema definition and follow the same specifications: |
| additionalProperties |
SchemaObject
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| allOf |
Array
|
The following properties are taken from the JSON Schema definition but their definitions were adjusted to the Swagger Specification. Their definition is the same as the one from JSON Schema, only where the original definition references the JSON Schema definition, the Schema Object definition is used instead. |
| default |
ExtensionValue
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| description |
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| discriminator |
|
Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between other schema that inherit this schema. The property name used MUST be defined at this schema and it MUST be in the required property list. When used, the value MUST be the name of this schema or any schema that inherits it. |
| enum |
Array
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| example |
ExtensionValue
|
A free-form property to include an example of an instance for this schema. |
| exclusiveMaximum |
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| exclusiveMinimum |
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| externalDocs |
ExternalDocumentationObject
|
Additional external documentation for this schema. |
| format |
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| items |
SchemaObject
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| maxItems |
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| maxLength |
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| maxProperties |
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| maximum |
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| minItems |
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| minLength |
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| minProperties |
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| minimum |
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| multipleOf |
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| pattern |
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| properties |
MapObject
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| readOnly |
|
Relevant only for Schema "properties" definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but MUST NOT be sent as part of the request. Properties marked as readOnly being true SHOULD NOT be in the required list of the defined schema. Default value is false. |
| required |
Array
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| title |
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| type |
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| uniqueItems |
|
The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation. Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject |
| xml |
XMLObject
|
This MAY be used only on properties schemas. It has no effect on root schemas. Adds Additional metadata to describe the XML representation format of this property. |
Lists the available scopes for an OAuth2 security scheme.
A declaration of the security schemes available to be used in the specification. This does not enforce the security schemes on the operations and only serves to provide the relevant details for each scheme.
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). The name used for each property MUST correspond to a security scheme declared in the Security Definitions.
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).
| Name | Type | Description |
|---|---|---|
| authorizationUrl |
|
("implicit", "accessCode") Required. The authorization URL to be used for this flow. This SHOULD be in the form of a URL. |
| description |
|
A short description for security scheme. |
| flow |
|
The flow used by the OAuth2 security scheme. Valid values are "implicit", "password", "application" or "accessCode". |
| in |
|
The location of the API key. Valid values are "query" or "header". |
| name |
|
The name of the header or query parameter to be used. |
| scopes |
ScopesObject
|
The available scopes for the OAuth2 security scheme. |
| tokenUrl |
|
("password", "application", "accessCode") Required. The token URL to be used for this flow. This SHOULD be in the form of a URL. |
| type |
|
The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2". |
Simple type - primitive types or array of such types. It is used by parameter definitions that are not located in "body".
| Name | Type | Description |
|---|---|---|
| allowEmptyValue |
|
Sets the ability to pass empty-valued parameters. This is valid only for either query or formData parameters and allows you to send a parameter with a name only or an empty value. Default value is false. |
| collectionFormat |
|
Determines the format of the array if type array is used. Possible values are:
Default value is csv. |
| default |
ExtensionValue
|
Declares the value of the parameter that the server will use if none is provided, for example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request. (Note: "default" has no meaning for required parameters.) See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2. Unlike JSON Schema this value MUST conform to the defined type for this parameter. |
| enum |
Array
|
|
| exclusiveMaximum |
|
|
| exclusiveMinimum |
|
|
| format |
|
The extending format for the previously mentioned type. See Data Type Formats for further details. |
| items |
ItemsObject
|
Required if type is "array". Describes the type of items in the array. |
| maxItems |
|
|
| maxLength |
|
|
| maximum |
|
|
| minItems |
|
|
| minLength |
|
|
| minimum |
|
|
| multipleOf |
|
|
| pattern |
|
|
| type |
ParameterType
|
The type of the parameter. Since the parameter is not located at
the request body, it is limited to simple types (that is, not an object).
The value MUST be one of "string", "number", "integer", "boolean",
"array" or "file". If type is "file", the |
| uniqueItems |
|
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.
| Name | Type | Description |
|---|---|---|
| description |
|
A short description for the tag. GFM syntax can be used for rich text representation. |
| externalDocs |
ExternalDocumentationObject
|
Additional external documentation for this tag. |
| name |
string
|
The name of the tag. |
A metadata object that allows for more fine-tuned XML model definitions.
When using arrays, XML element names are not inferred (for singular/plural forms) and the name property should be used to add that information. See examples for expected behavior.
Create an empty OpenApiSpec object that's still a valid Swagger document.