Interface: InfoObject

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

Properties
Name Type Description
description string

A short description of the application. GFM syntax can be used for rich text representation.

termsOfService string

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).

Interface: OpenApiSpec

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

Properties
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.

host string

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.

paths PathsObject

The available paths and operations for the API.

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".

Interface: OperationObject

Describes a single API operation on a path.

Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#operationObject

Properties
Name Type Description
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.

responses ResponsesObject

The list of possible responses as they are returned from executing this operation.

x-operation-name string

IBM/LoopBack extension: The name of the controller method implementing this operation.

Interface: ParameterObject

Properties
Name Type Description
description string

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.

  • 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 for further information.
  • For all other cases, the name corresponds to the parameter name used based on the in property.

required boolean

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.

schema SchemaObject

If in is "body": The schema defining the type used for the body parameter.

type ParameterTypeValue

If in is any value other than "body": 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 consumes MUST be either "multipart/form-data", " application/x-www-form-urlencoded" or both and the parameter MUST be in "formData".

Interface: PathItemObject

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

Properties
Name Type Description
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.

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.

Interface: PathsObject

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

Interface: ReferenceObject

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"
}

Properties
Name Type Description
$ref string

The reference string.

Interface: ResponseObject

Describes a single response from an API Operation.

Specification: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#responseObject

Properties
Name Type Description
description string

A short description of the response. GFM syntax can be used for rich text representation.

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 SchemaObject, its root type value may also be "file". This SHOULD be accompanied by a relevant produces mime-type.

Interface: ResponsesObject

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

Properties
Name Type Description
default

The documentation of responses other than the ones declared for specific HTTP response codes. It can be used to cover undeclared responses. Reference Object can be used to link to a response that is defined at the Swagger Object's responses section.

Interface: SchemaItem

Definition of an array item type as per JSON Schema Specification.

Properties
Name Type Description
additionalProperties boolean

Definition of an array item type as per JSON Schema Specification.

type string

Definition of an array item type as per JSON Schema Specification.

Interface: 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

Properties
Name Type Description
items SchemaItem

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 string

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

ExtensionValue = any

createEmptyApiSpec() : OpenApiSpec

Create an empty OpenApiSpec object that's still a valid Swagger document.