@loopback/openapi-spec
Advanced tools
Comparing version 4.0.0-alpha.8 to 4.0.0-alpha.9
@@ -7,2 +7,16 @@ /** | ||
/** | ||
* 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. | ||
@@ -12,3 +26,3 @@ * <p>Specification: | ||
*/ | ||
export interface OpenApiSpec { | ||
export interface OpenApiSpec extends Extensible { | ||
/** | ||
@@ -43,6 +57,60 @@ * Specifies the Swagger Specification version being used. | ||
/** | ||
* 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<string>; | ||
/** | ||
* 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. | ||
*/ | ||
consumes?: Array<string>; | ||
/** | ||
* 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. | ||
*/ | ||
produces?: Array<string>; | ||
/** | ||
* The available paths and operations for the API. | ||
*/ | ||
paths: PathsObject; | ||
[extension: string]: ExtensionValue; | ||
/** | ||
* An object to hold parameters that can be used across operations. This | ||
* property does not define global parameters for all operations. | ||
*/ | ||
parameters?: ParametersDefinitionsObject; | ||
/** | ||
* An object to hold responses that can be used across operations. This | ||
* property does not define global responses for all operations. | ||
*/ | ||
responses?: ResponsesDefinitionsObject; | ||
/** | ||
* An object to hold data types produced and consumed by operations. | ||
*/ | ||
definitions?: DefinitionsObject; | ||
/** | ||
* Security scheme definitions that can be used across the specification. | ||
*/ | ||
securityDefinitions?: SecurityDefinitionsObject; | ||
/** | ||
* 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. | ||
*/ | ||
security?: Array<SecurityRequirementObject>; | ||
/** | ||
* 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. | ||
*/ | ||
tags?: Array<TagObject>; | ||
/** | ||
* Additional external documentation. | ||
*/ | ||
externalDocs?: ExternalDocumentationObject; | ||
} | ||
@@ -56,3 +124,3 @@ /** | ||
*/ | ||
export interface InfoObject { | ||
export interface InfoObject extends Extensible { | ||
/** | ||
@@ -73,2 +141,10 @@ * The title of the application. | ||
/** | ||
* 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 | ||
@@ -80,2 +156,192 @@ * (not to be confused with the specification version). | ||
/** | ||
* 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<T> { | ||
/** | ||
* Maps between a name and object | ||
*/ | ||
[name: string]: T; | ||
} | ||
/** | ||
* Lists the available scopes for an OAuth2 security scheme. | ||
*/ | ||
export interface ScopesObject extends MapObject<string>, Extensible { | ||
/** | ||
* Maps between a name of a scope to a short description of it (as the value | ||
* of the property). | ||
*/ | ||
[name: string]: string; | ||
} | ||
/** | ||
* 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. | ||
*/ | ||
export interface SecurityDefinitionsObject extends MapObject<SecuritySchemeObject> { | ||
/** | ||
* A single security scheme definition, mapping a "name" to the scheme it | ||
* defines. | ||
*/ | ||
[name: string]: SecuritySchemeObject; | ||
} | ||
/** | ||
* 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. | ||
*/ | ||
export interface SecurityRequirementObject extends MapObject<Array<string>> { | ||
/** | ||
* Each name must correspond to a security scheme which is declared in the | ||
* Security Definitions. If the security scheme is of type "oauth2", then the | ||
* value is a list of scope names required for the execution. For other | ||
* security scheme types, the array MUST be empty. | ||
*/ | ||
[name: string]: Array<string>; | ||
} | ||
/** | ||
* An object to hold data types that can be consumed and produced by operations. | ||
* These data types can be primitives, arrays or models. | ||
*/ | ||
export interface DefinitionsObject extends MapObject<SchemaObject> { | ||
/** | ||
* A single definition, mapping a "name" to the schema it defines. | ||
*/ | ||
[name: string]: SchemaObject; | ||
} | ||
/** | ||
* 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. | ||
*/ | ||
export interface ParametersDefinitionsObject extends MapObject<ParameterObject> { | ||
/** | ||
* A single parameter definition, mapping a "name" to the parameter it | ||
* defines. | ||
*/ | ||
[name: string]: ParameterObject; | ||
} | ||
/** | ||
* 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. | ||
*/ | ||
export interface ResponsesDefinitionsObject extends MapObject<ResponseObject> { | ||
/** | ||
* A single response definition, mapping a "name" to the response it defines. | ||
*/ | ||
[name: string]: ResponseObject; | ||
} | ||
/** | ||
* Holds the relative paths to the individual endpoints. | ||
@@ -87,3 +353,3 @@ * The path is appended to the basePath in order to construct the full URL. | ||
*/ | ||
export interface PathsObject { | ||
export interface PathsObject extends MapObject<PathItemObject | ExtensionValue> { | ||
[httpPathOrSwaggerExtension: string]: PathItemObject | ExtensionValue; | ||
@@ -99,32 +365,48 @@ } | ||
*/ | ||
export interface 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; | ||
get?: OperationObject; | ||
/** | ||
* A definition of a PUT operation on this path. | ||
*/ | ||
put: OperationObject; | ||
put?: OperationObject; | ||
/** | ||
* A definition of a POST operation on this path. | ||
*/ | ||
post: OperationObject; | ||
post?: OperationObject; | ||
/** | ||
* A definition of a DELETE operation on this path. | ||
*/ | ||
delete: OperationObject; | ||
delete?: OperationObject; | ||
/** | ||
* A definition of a OPTIONS operation on this path. | ||
*/ | ||
options: OperationObject; | ||
options?: OperationObject; | ||
/** | ||
* A definition of a HEAD operation on this path. | ||
*/ | ||
head: OperationObject; | ||
head?: OperationObject; | ||
/** | ||
* A definition of a PATCH operation on this path. | ||
*/ | ||
patch: OperationObject; | ||
[extension: string]: ExtensionValue; | ||
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<ParameterObject | ReferenceObject>; | ||
} | ||
@@ -136,3 +418,3 @@ /** | ||
*/ | ||
export interface OperationObject { | ||
export interface OperationObject extends Extensible { | ||
/** | ||
@@ -159,6 +441,179 @@ * IBM/LoopBack extension: The name of the controller method implementing | ||
responses: ResponsesObject; | ||
[extension: string]: ExtensionValue; | ||
/** | ||
* A list of tags for API documentation control. Tags can be used for logical | ||
* grouping of operations by resources or any other qualifier. | ||
*/ | ||
tags?: Array<string>; | ||
/** | ||
* A short summary of what the operation does. For maximum readability in the | ||
* swagger-ui, this field SHOULD be less than 120 characters. | ||
*/ | ||
summary?: string; | ||
/** | ||
* A verbose explanation of the operation behavior. GFM syntax can be used for | ||
* rich text representation. | ||
*/ | ||
description?: string; | ||
/** | ||
* Additional external documentation for this operation. | ||
*/ | ||
externalDocs?: ExternalDocumentationObject; | ||
/** | ||
* 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. | ||
*/ | ||
operationId?: string; | ||
/** | ||
* 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. | ||
*/ | ||
consumes?: Array<string>; | ||
/** | ||
* 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. | ||
*/ | ||
produces?: Array<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<string>; | ||
/** | ||
* Declares this operation to be deprecated. Usage of the declared operation | ||
* should be refrained. Default value is false. | ||
*/ | ||
deprecated?: boolean; | ||
/** | ||
* 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. | ||
*/ | ||
security?: SecurityRequirementObject; | ||
} | ||
export declare type ParameterTypeValue = 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'file'; | ||
export declare type ParameterType = 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'file'; | ||
/** | ||
* Simple type - primitive types or array of such types. It is used by parameter | ||
* definitions that are not located in "body". | ||
*/ | ||
export interface SimpleType { | ||
/** | ||
* 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". | ||
*/ | ||
type?: ParameterType; | ||
/** | ||
* The extending format for the previously mentioned type. See | ||
* [Data Type Formats](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#dataTypeFormat) | ||
* for further details. | ||
*/ | ||
format?: string; | ||
/** | ||
* 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. | ||
*/ | ||
allowEmptyValue?: boolean; | ||
/** | ||
* Required if type is "array". Describes the type of items in the array. | ||
*/ | ||
items?: ItemsObject; | ||
/** | ||
* Determines the format of the array if type array is used. Possible values | ||
* are: | ||
* - csv: comma separated values foo,bar. | ||
* - ssv: space separated values foo bar. | ||
* - tsv: tab separated values foo\tbar. | ||
* - pipes: pipe separated values foo|bar. | ||
* - multi: corresponds to multiple parameter instances instead of multiple | ||
* values for a single instance foo=bar&foo=baz. This is valid only for | ||
* parameters in "query" or "formData". | ||
* | ||
* Default value is csv. | ||
*/ | ||
collectionFormat?: string; | ||
/** | ||
* 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. | ||
*/ | ||
'default'?: ExtensionValue; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. | ||
*/ | ||
maximum?: number; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. | ||
*/ | ||
exclusiveMaximum?: number; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. | ||
*/ | ||
minimum?: number; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. | ||
*/ | ||
exclusiveMinimum?: number; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1. | ||
*/ | ||
maxLength?: number; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2. | ||
*/ | ||
minLength?: number; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. | ||
*/ | ||
pattern?: string; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2. | ||
*/ | ||
maxItems?: number; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3. | ||
*/ | ||
minItems?: number; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4. | ||
*/ | ||
uniqueItems?: boolean; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1. | ||
*/ | ||
enum?: Array<ExtensionValue>; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1. | ||
*/ | ||
multipleOf?: number; | ||
} | ||
/** | ||
* The internal type of the array. The value MUST be one of "string", | ||
* "number", "integer", "boolean", or "array". Files and models are not | ||
* allowed. | ||
*/ | ||
export declare type ItemType = 'string' | 'number' | 'integer' | 'boolean' | 'array'; | ||
/** | ||
* 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`. | ||
*/ | ||
export interface ItemsObject extends SimpleType { | ||
type: ItemType; | ||
} | ||
/** | ||
* Describes a single operation parameter. | ||
@@ -168,3 +623,3 @@ * <p>Specification: | ||
*/ | ||
export interface ParameterObject { | ||
export interface ParameterObject extends SimpleType, Extensible { | ||
/** | ||
@@ -199,11 +654,5 @@ * The name of the parameter. Parameter names are case sensitive. | ||
/** | ||
* _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". | ||
* _If `in` is any value other than "body":_, the valid properties are | ||
* inherited from `SimpleType`. | ||
*/ | ||
type?: ParameterTypeValue; | ||
/** | ||
@@ -214,3 +663,2 @@ * _If in is "body":_ | ||
schema?: SchemaObject; | ||
[extension: string]: ExtensionValue; | ||
} | ||
@@ -260,3 +708,3 @@ /** | ||
*/ | ||
export interface ResponsesObject { | ||
export interface ResponsesObject extends MapObject<ResponseObject | ReferenceObject | undefined>, Extensible { | ||
/** | ||
@@ -268,4 +716,3 @@ * The documentation of responses other than the ones declared for specific | ||
*/ | ||
default?: ResponseObject | ReferenceObject; | ||
[httpStatusCodeOrSwaggerExtension: string]: ResponseObject | ReferenceObject | ExtensionValue; | ||
'default'?: ResponseObject | ReferenceObject; | ||
} | ||
@@ -277,3 +724,3 @@ /** | ||
*/ | ||
export interface ResponseObject { | ||
export interface ResponseObject extends Extensible { | ||
/** | ||
@@ -294,5 +741,39 @@ * A short description of the response. | ||
schema: SchemaObject; | ||
[extension: string]: ExtensionValue; | ||
/** | ||
* 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<ExtensionValue> { | ||
/** | ||
* The name of the property MUST be one of the Operation produces values | ||
* (either implicit or inherited). The value SHOULD be an example of what | ||
* such a response would look like. | ||
*/ | ||
[mimeType: string]: ExtensionValue; | ||
} | ||
/** | ||
* Lists the headers that can be sent as part of a response. | ||
*/ | ||
export interface HeadersObject extends MapObject<HeaderObject> { | ||
/** | ||
* The name of the property corresponds to the name of the header. The value | ||
* describes the type of the header. | ||
*/ | ||
[name: string]: HeaderObject; | ||
} | ||
export interface HeaderObject extends ItemsObject, Extensible { | ||
/** | ||
* A short description of the header. | ||
*/ | ||
description: string; | ||
} | ||
/** | ||
* The Schema Object allows the definition of input and output data types. | ||
@@ -306,15 +787,110 @@ * These types can be objects, but also primitives and arrays. | ||
*/ | ||
export interface SchemaObject { | ||
type: string; | ||
items?: SchemaItem; | ||
[extension: string]: ExtensionValue; | ||
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<string>; | ||
enum?: Array<ExtensionValue>; | ||
type?: string; | ||
/** | ||
* 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. | ||
*/ | ||
allOf?: Array<SchemaObject>; | ||
properties?: MapObject<SchemaObject>; | ||
additionalProperties?: SchemaObject; | ||
items?: SchemaObject; | ||
/** | ||
* Other than the JSON Schema subset fields, the following fields may be used | ||
* for further schema documentation. | ||
*/ | ||
/** | ||
* 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. | ||
*/ | ||
discriminator?: string; | ||
/** | ||
* 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. | ||
*/ | ||
readOnly?: boolean; | ||
/** | ||
* 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. | ||
*/ | ||
xml?: XMLObject; | ||
/** | ||
* Additional external documentation for this schema. | ||
*/ | ||
externalDocs?: ExternalDocumentationObject; | ||
/** | ||
* A free-form property to include an example of an instance for this schema. | ||
*/ | ||
example?: ExtensionValue; | ||
} | ||
/** | ||
* Definition of an array item type as per | ||
* [JSON Schema Specification](http://json-schema.org/). | ||
* 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. | ||
*/ | ||
export interface SchemaItem { | ||
type: string; | ||
additionalProperties: boolean; | ||
[extension: string]: ExtensionValue; | ||
export interface XMLObject extends Extensible { | ||
/** | ||
* Replaces the name of the element/attribute used for the described schema | ||
* property. When defined within the Items Object (items), it will affect the | ||
* name of the individual XML elements within the list. When defined alongside | ||
* type being array (outside the items), it will affect the wrapping element | ||
* and only if wrapped is true. If wrapped is false, it will be ignored. | ||
*/ | ||
name?: string; | ||
/** | ||
* The URL of the namespace definition. Value SHOULD be in the form of a URL. | ||
*/ | ||
namespace?: string; | ||
/** | ||
* The prefix to be used for the name. | ||
*/ | ||
prefix?: string; | ||
/** | ||
* Declares whether the property definition translates to an attribute | ||
* instead of an element. Default value is false. | ||
*/ | ||
attribute?: boolean; | ||
/** | ||
* MAY be used only for an array definition. Signifies whether the array is | ||
* wrapped (for example, <books><book/><book/></books>) or unwrapped | ||
* (<book/><book/>). Default value is false. The definition takes effect | ||
* only when defined alongside type being array (outside the items). | ||
*/ | ||
wrapped?: boolean; | ||
} | ||
@@ -321,0 +897,0 @@ /** |
@@ -7,2 +7,16 @@ /** | ||
/** | ||
* 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. | ||
@@ -12,3 +26,3 @@ * <p>Specification: | ||
*/ | ||
export interface OpenApiSpec { | ||
export interface OpenApiSpec extends Extensible { | ||
/** | ||
@@ -43,6 +57,60 @@ * Specifies the Swagger Specification version being used. | ||
/** | ||
* 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<string>; | ||
/** | ||
* 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. | ||
*/ | ||
consumes?: Array<string>; | ||
/** | ||
* 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. | ||
*/ | ||
produces?: Array<string>; | ||
/** | ||
* The available paths and operations for the API. | ||
*/ | ||
paths: PathsObject; | ||
[extension: string]: ExtensionValue; | ||
/** | ||
* An object to hold parameters that can be used across operations. This | ||
* property does not define global parameters for all operations. | ||
*/ | ||
parameters?: ParametersDefinitionsObject; | ||
/** | ||
* An object to hold responses that can be used across operations. This | ||
* property does not define global responses for all operations. | ||
*/ | ||
responses?: ResponsesDefinitionsObject; | ||
/** | ||
* An object to hold data types produced and consumed by operations. | ||
*/ | ||
definitions?: DefinitionsObject; | ||
/** | ||
* Security scheme definitions that can be used across the specification. | ||
*/ | ||
securityDefinitions?: SecurityDefinitionsObject; | ||
/** | ||
* 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. | ||
*/ | ||
security?: Array<SecurityRequirementObject>; | ||
/** | ||
* 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. | ||
*/ | ||
tags?: Array<TagObject>; | ||
/** | ||
* Additional external documentation. | ||
*/ | ||
externalDocs?: ExternalDocumentationObject; | ||
} | ||
@@ -56,3 +124,3 @@ /** | ||
*/ | ||
export interface InfoObject { | ||
export interface InfoObject extends Extensible { | ||
/** | ||
@@ -73,2 +141,10 @@ * The title of the application. | ||
/** | ||
* 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 | ||
@@ -80,2 +156,192 @@ * (not to be confused with the specification version). | ||
/** | ||
* 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<T> { | ||
/** | ||
* Maps between a name and object | ||
*/ | ||
[name: string]: T; | ||
} | ||
/** | ||
* Lists the available scopes for an OAuth2 security scheme. | ||
*/ | ||
export interface ScopesObject extends MapObject<string>, Extensible { | ||
/** | ||
* Maps between a name of a scope to a short description of it (as the value | ||
* of the property). | ||
*/ | ||
[name: string]: string; | ||
} | ||
/** | ||
* 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. | ||
*/ | ||
export interface SecurityDefinitionsObject extends MapObject<SecuritySchemeObject> { | ||
/** | ||
* A single security scheme definition, mapping a "name" to the scheme it | ||
* defines. | ||
*/ | ||
[name: string]: SecuritySchemeObject; | ||
} | ||
/** | ||
* 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. | ||
*/ | ||
export interface SecurityRequirementObject extends MapObject<Array<string>> { | ||
/** | ||
* Each name must correspond to a security scheme which is declared in the | ||
* Security Definitions. If the security scheme is of type "oauth2", then the | ||
* value is a list of scope names required for the execution. For other | ||
* security scheme types, the array MUST be empty. | ||
*/ | ||
[name: string]: Array<string>; | ||
} | ||
/** | ||
* An object to hold data types that can be consumed and produced by operations. | ||
* These data types can be primitives, arrays or models. | ||
*/ | ||
export interface DefinitionsObject extends MapObject<SchemaObject> { | ||
/** | ||
* A single definition, mapping a "name" to the schema it defines. | ||
*/ | ||
[name: string]: SchemaObject; | ||
} | ||
/** | ||
* 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. | ||
*/ | ||
export interface ParametersDefinitionsObject extends MapObject<ParameterObject> { | ||
/** | ||
* A single parameter definition, mapping a "name" to the parameter it | ||
* defines. | ||
*/ | ||
[name: string]: ParameterObject; | ||
} | ||
/** | ||
* 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. | ||
*/ | ||
export interface ResponsesDefinitionsObject extends MapObject<ResponseObject> { | ||
/** | ||
* A single response definition, mapping a "name" to the response it defines. | ||
*/ | ||
[name: string]: ResponseObject; | ||
} | ||
/** | ||
* Holds the relative paths to the individual endpoints. | ||
@@ -87,3 +353,3 @@ * The path is appended to the basePath in order to construct the full URL. | ||
*/ | ||
export interface PathsObject { | ||
export interface PathsObject extends MapObject<PathItemObject | ExtensionValue> { | ||
[httpPathOrSwaggerExtension: string]: PathItemObject | ExtensionValue; | ||
@@ -99,32 +365,48 @@ } | ||
*/ | ||
export interface 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; | ||
get?: OperationObject; | ||
/** | ||
* A definition of a PUT operation on this path. | ||
*/ | ||
put: OperationObject; | ||
put?: OperationObject; | ||
/** | ||
* A definition of a POST operation on this path. | ||
*/ | ||
post: OperationObject; | ||
post?: OperationObject; | ||
/** | ||
* A definition of a DELETE operation on this path. | ||
*/ | ||
delete: OperationObject; | ||
delete?: OperationObject; | ||
/** | ||
* A definition of a OPTIONS operation on this path. | ||
*/ | ||
options: OperationObject; | ||
options?: OperationObject; | ||
/** | ||
* A definition of a HEAD operation on this path. | ||
*/ | ||
head: OperationObject; | ||
head?: OperationObject; | ||
/** | ||
* A definition of a PATCH operation on this path. | ||
*/ | ||
patch: OperationObject; | ||
[extension: string]: ExtensionValue; | ||
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<ParameterObject | ReferenceObject>; | ||
} | ||
@@ -136,3 +418,3 @@ /** | ||
*/ | ||
export interface OperationObject { | ||
export interface OperationObject extends Extensible { | ||
/** | ||
@@ -159,6 +441,179 @@ * IBM/LoopBack extension: The name of the controller method implementing | ||
responses: ResponsesObject; | ||
[extension: string]: ExtensionValue; | ||
/** | ||
* A list of tags for API documentation control. Tags can be used for logical | ||
* grouping of operations by resources or any other qualifier. | ||
*/ | ||
tags?: Array<string>; | ||
/** | ||
* A short summary of what the operation does. For maximum readability in the | ||
* swagger-ui, this field SHOULD be less than 120 characters. | ||
*/ | ||
summary?: string; | ||
/** | ||
* A verbose explanation of the operation behavior. GFM syntax can be used for | ||
* rich text representation. | ||
*/ | ||
description?: string; | ||
/** | ||
* Additional external documentation for this operation. | ||
*/ | ||
externalDocs?: ExternalDocumentationObject; | ||
/** | ||
* 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. | ||
*/ | ||
operationId?: string; | ||
/** | ||
* 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. | ||
*/ | ||
consumes?: Array<string>; | ||
/** | ||
* 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. | ||
*/ | ||
produces?: Array<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<string>; | ||
/** | ||
* Declares this operation to be deprecated. Usage of the declared operation | ||
* should be refrained. Default value is false. | ||
*/ | ||
deprecated?: boolean; | ||
/** | ||
* 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. | ||
*/ | ||
security?: SecurityRequirementObject; | ||
} | ||
export declare type ParameterTypeValue = 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'file'; | ||
export declare type ParameterType = 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'file'; | ||
/** | ||
* Simple type - primitive types or array of such types. It is used by parameter | ||
* definitions that are not located in "body". | ||
*/ | ||
export interface SimpleType { | ||
/** | ||
* 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". | ||
*/ | ||
type?: ParameterType; | ||
/** | ||
* The extending format for the previously mentioned type. See | ||
* [Data Type Formats](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#dataTypeFormat) | ||
* for further details. | ||
*/ | ||
format?: string; | ||
/** | ||
* 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. | ||
*/ | ||
allowEmptyValue?: boolean; | ||
/** | ||
* Required if type is "array". Describes the type of items in the array. | ||
*/ | ||
items?: ItemsObject; | ||
/** | ||
* Determines the format of the array if type array is used. Possible values | ||
* are: | ||
* - csv: comma separated values foo,bar. | ||
* - ssv: space separated values foo bar. | ||
* - tsv: tab separated values foo\tbar. | ||
* - pipes: pipe separated values foo|bar. | ||
* - multi: corresponds to multiple parameter instances instead of multiple | ||
* values for a single instance foo=bar&foo=baz. This is valid only for | ||
* parameters in "query" or "formData". | ||
* | ||
* Default value is csv. | ||
*/ | ||
collectionFormat?: string; | ||
/** | ||
* 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. | ||
*/ | ||
'default'?: ExtensionValue; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. | ||
*/ | ||
maximum?: number; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. | ||
*/ | ||
exclusiveMaximum?: number; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. | ||
*/ | ||
minimum?: number; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. | ||
*/ | ||
exclusiveMinimum?: number; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1. | ||
*/ | ||
maxLength?: number; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2. | ||
*/ | ||
minLength?: number; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. | ||
*/ | ||
pattern?: string; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2. | ||
*/ | ||
maxItems?: number; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3. | ||
*/ | ||
minItems?: number; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4. | ||
*/ | ||
uniqueItems?: boolean; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1. | ||
*/ | ||
enum?: Array<ExtensionValue>; | ||
/** | ||
* See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1. | ||
*/ | ||
multipleOf?: number; | ||
} | ||
/** | ||
* The internal type of the array. The value MUST be one of "string", | ||
* "number", "integer", "boolean", or "array". Files and models are not | ||
* allowed. | ||
*/ | ||
export declare type ItemType = 'string' | 'number' | 'integer' | 'boolean' | 'array'; | ||
/** | ||
* 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`. | ||
*/ | ||
export interface ItemsObject extends SimpleType { | ||
type: ItemType; | ||
} | ||
/** | ||
* Describes a single operation parameter. | ||
@@ -168,3 +623,3 @@ * <p>Specification: | ||
*/ | ||
export interface ParameterObject { | ||
export interface ParameterObject extends SimpleType, Extensible { | ||
/** | ||
@@ -199,11 +654,5 @@ * The name of the parameter. Parameter names are case sensitive. | ||
/** | ||
* _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". | ||
* _If `in` is any value other than "body":_, the valid properties are | ||
* inherited from `SimpleType`. | ||
*/ | ||
type?: ParameterTypeValue; | ||
/** | ||
@@ -214,3 +663,2 @@ * _If in is "body":_ | ||
schema?: SchemaObject; | ||
[extension: string]: ExtensionValue; | ||
} | ||
@@ -260,3 +708,3 @@ /** | ||
*/ | ||
export interface ResponsesObject { | ||
export interface ResponsesObject extends MapObject<ResponseObject | ReferenceObject | undefined>, Extensible { | ||
/** | ||
@@ -268,4 +716,3 @@ * The documentation of responses other than the ones declared for specific | ||
*/ | ||
default?: ResponseObject | ReferenceObject; | ||
[httpStatusCodeOrSwaggerExtension: string]: ResponseObject | ReferenceObject | ExtensionValue; | ||
'default'?: ResponseObject | ReferenceObject; | ||
} | ||
@@ -277,3 +724,3 @@ /** | ||
*/ | ||
export interface ResponseObject { | ||
export interface ResponseObject extends Extensible { | ||
/** | ||
@@ -294,5 +741,39 @@ * A short description of the response. | ||
schema: SchemaObject; | ||
[extension: string]: ExtensionValue; | ||
/** | ||
* 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<ExtensionValue> { | ||
/** | ||
* The name of the property MUST be one of the Operation produces values | ||
* (either implicit or inherited). The value SHOULD be an example of what | ||
* such a response would look like. | ||
*/ | ||
[mimeType: string]: ExtensionValue; | ||
} | ||
/** | ||
* Lists the headers that can be sent as part of a response. | ||
*/ | ||
export interface HeadersObject extends MapObject<HeaderObject> { | ||
/** | ||
* The name of the property corresponds to the name of the header. The value | ||
* describes the type of the header. | ||
*/ | ||
[name: string]: HeaderObject; | ||
} | ||
export interface HeaderObject extends ItemsObject, Extensible { | ||
/** | ||
* A short description of the header. | ||
*/ | ||
description: string; | ||
} | ||
/** | ||
* The Schema Object allows the definition of input and output data types. | ||
@@ -306,15 +787,110 @@ * These types can be objects, but also primitives and arrays. | ||
*/ | ||
export interface SchemaObject { | ||
type: string; | ||
items?: SchemaItem; | ||
[extension: string]: ExtensionValue; | ||
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<string>; | ||
enum?: Array<ExtensionValue>; | ||
type?: string; | ||
/** | ||
* 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. | ||
*/ | ||
allOf?: Array<SchemaObject>; | ||
properties?: MapObject<SchemaObject>; | ||
additionalProperties?: SchemaObject; | ||
items?: SchemaObject; | ||
/** | ||
* Other than the JSON Schema subset fields, the following fields may be used | ||
* for further schema documentation. | ||
*/ | ||
/** | ||
* 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. | ||
*/ | ||
discriminator?: string; | ||
/** | ||
* 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. | ||
*/ | ||
readOnly?: boolean; | ||
/** | ||
* 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. | ||
*/ | ||
xml?: XMLObject; | ||
/** | ||
* Additional external documentation for this schema. | ||
*/ | ||
externalDocs?: ExternalDocumentationObject; | ||
/** | ||
* A free-form property to include an example of an instance for this schema. | ||
*/ | ||
example?: ExtensionValue; | ||
} | ||
/** | ||
* Definition of an array item type as per | ||
* [JSON Schema Specification](http://json-schema.org/). | ||
* 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. | ||
*/ | ||
export interface SchemaItem { | ||
type: string; | ||
additionalProperties: boolean; | ||
[extension: string]: ExtensionValue; | ||
export interface XMLObject extends Extensible { | ||
/** | ||
* Replaces the name of the element/attribute used for the described schema | ||
* property. When defined within the Items Object (items), it will affect the | ||
* name of the individual XML elements within the list. When defined alongside | ||
* type being array (outside the items), it will affect the wrapping element | ||
* and only if wrapped is true. If wrapped is false, it will be ignored. | ||
*/ | ||
name?: string; | ||
/** | ||
* The URL of the namespace definition. Value SHOULD be in the form of a URL. | ||
*/ | ||
namespace?: string; | ||
/** | ||
* The prefix to be used for the name. | ||
*/ | ||
prefix?: string; | ||
/** | ||
* Declares whether the property definition translates to an attribute | ||
* instead of an element. Default value is false. | ||
*/ | ||
attribute?: boolean; | ||
/** | ||
* MAY be used only for an array definition. Signifies whether the array is | ||
* wrapped (for example, <books><book/><book/></books>) or unwrapped | ||
* (<book/><book/>). Default value is false. The definition takes effect | ||
* only when defined alongside type being array (outside the items). | ||
*/ | ||
wrapped?: boolean; | ||
} | ||
@@ -321,0 +897,0 @@ /** |
{ | ||
"name": "@loopback/openapi-spec", | ||
"version": "4.0.0-alpha.8", | ||
"version": "4.0.0-alpha.9", | ||
"description": "TypeScript type definitions for OpenAPI Spec/Swagger documents.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
646808
5241