From 76ff290114edc654fdc073ab09f2697979249ae6 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 16 Feb 2021 20:30:46 +0000 Subject: [PATCH 01/34] workflows: update used actions --- .github/workflows/convert-examples-to-json.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/convert-examples-to-json.yaml b/.github/workflows/convert-examples-to-json.yaml index 2ed4ca865e..5c06c2634d 100644 --- a/.github/workflows/convert-examples-to-json.yaml +++ b/.github/workflows/convert-examples-to-json.yaml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 # checkout repo content + - uses: actions/checkout@v2 # checkout repo content - name: Install dependencies run: npm i @@ -36,10 +36,9 @@ jobs: git --no-pager -c color.diff=always diff --staged - name: Create Pull Request - uses: peter-evans/create-pull-request@v1 + uses: peter-evans/create-pull-request@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - branch-suffix: none branch: update-json-examples title: Update JSON example files commit-message: Update JSON example files From 8c878174aba0a0744f1e199ae09de88d3d8f1a01 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 16 Feb 2021 20:32:47 +0000 Subject: [PATCH 02/34] . From 24a1c48509b0211bb274cf8134c2a5aade33a51c Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Thu, 30 Nov 2017 18:48:56 +0000 Subject: [PATCH 03/34] bikeshed rendering (WIP) --- bikeshed/3.0.0.bs | 4083 ++++++++++++++++++++++++++ bikeshed/3.0.0.md | 3389 +++++++++++++++++++++ bikeshed/build.sh | 5 + bikeshed/heading.bs | 62 + bikeshed/input.bs | 4249 +++++++++++++++++++++++++++ bikeshed/md2bs.js | 93 + bikeshed/oas_3.0.0.err | 3 + bikeshed/oas_3.0.0.html | 5684 ++++++++++++++++++++++++++++++++++++ bikeshed/style-finish.html | 1 + bikeshed/style-start.html | 4 + bikeshed/syntax-github.css | 99 + package.json | 5 +- 12 files changed, 17676 insertions(+), 1 deletion(-) create mode 100644 bikeshed/3.0.0.bs create mode 100644 bikeshed/3.0.0.md create mode 100644 bikeshed/build.sh create mode 100644 bikeshed/heading.bs create mode 100644 bikeshed/input.bs create mode 100644 bikeshed/md2bs.js create mode 100644 bikeshed/oas_3.0.0.err create mode 100644 bikeshed/oas_3.0.0.html create mode 100644 bikeshed/style-finish.html create mode 100644 bikeshed/style-start.html create mode 100644 bikeshed/syntax-github.css diff --git a/bikeshed/3.0.0.bs b/bikeshed/3.0.0.bs new file mode 100644 index 0000000000..d667e09442 --- /dev/null +++ b/bikeshed/3.0.0.bs @@ -0,0 +1,4083 @@ +

OpenAPI Specification

+

Version 3.0.0

+

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [[!rfc2119]] [[!rfc8174]] when, and only when, they appear in all capitals, as shown here.

+

This document is licensed under The Apache License, Version 2.0.

+

Introduction

+

The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.

+

An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.

+

Definitions

+

OpenAPI Document

+A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification. +

Path Templating

+Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. +

Media Types

+Media type definitions are spread across several resources. +The media type definitions SHOULD be in compliance with [[!rfc6838]]. +

Some examples of possible media type definitions:

+

+  text/plain; charset=utf-8
+  application/json
+  application/vnd.github+json
+  application/vnd.github.v3+json
+  application/vnd.github.v3.raw+json
+  application/vnd.github.v3.text+json
+  application/vnd.github.v3.html+json
+  application/vnd.github.v3.full+json
+  application/vnd.github.v3.diff
+  application/vnd.github.v3.patch
+
+

HTTP Status Codes

+The HTTP Status Codes are used to indicate the status of the executed operation. +The available status codes are defined by [[!rfc7231]]section-6) and registered status codes are listed in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). +

Specification

+

Versions

+

The OpenAPI Specification is versioned using Semantic Versioning 2.0.0 (semver) and follows the semver specification.

+

The major.minor portion of the semver (for example 3.0) SHALL designate the OAS feature set. Typically, .patch versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between 3.0.0 and 3.0.1 for example.

+

Subsequent minor version releases of the OpenAPI Specification (incrementing the minor version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical 3.1.0 specification SHOULD be usable with tooling designed for 3.0.0.

+

An OpenAPI document compatible with OAS 3.*.* contains a required openapi field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named swagger and value "2.0".)

+

Format

+

An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format.

+

For example, if a field has an array value, the JSON array representation will be used:

+

+{
+   "field": [ 1, 2, 3 ]
+}
+
+

All field names in the specification are case sensitive.

+

The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name.

+

Patterned fields MUST have unique names within the containing object.

+

In order to preserve the ability to round-trip between YAML and JSON formats, YAML version 1.2 is RECOMMENDED along with some additional constraints:

+ +

Note: While APIs may be defined by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML.

+

Document Structure

+

An OpenAPI document MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the user. In the latter case, $ref fields MUST be used in the specification to reference those parts as follows from the JSON Schema definitions.

+

It is RECOMMENDED that the root OpenAPI document be named: openapi.json or openapi.yaml.

+

Data Types

+

Primitive data types in the OAS are based on the types supported by the JSON Schema Specification Wright Draft 00. +Note that integer as a type is also supported and is defined as a JSON number without a fraction or exponent part. +null is not supported as a type (see nullable for an alternative solution). +Models are defined using the Schema Object, which is an extended subset of JSON Schema Specification Wright Draft 00.

+

Primitives have an optional modifier property: format. +OAS uses several known formats to define in fine detail the data type being used. +However, to support documentation needs, the format property is an open string-valued property, and can have any value. +Formats such as "email", "uuid", and so on, MAY be used even though undefined by this specification. +Types that are not accompanied by a format property follow the type definition in the JSON Schema. Tools that do not recognize a specific format MAY default back to the type alone, as if the format is not specified.

+

The formats defined by the OAS are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Common NametypeformatComments
integerintegerint32signed 32 bits
longintegerint64signed 64 bits
floatnumberfloat
doublenumberdouble
stringstring
bytestringbytebase64 encoded characters
binarystringbinaryany sequence of octets
booleanboolean
datestringdateAs defined by full-date - [!rfc3339]
dateTimestringdate-timeAs defined by date-time - [!rfc3339]
passwordstringpasswordA hint to UIs to obscure input.
+

Rich Text Formatting

+Throughout the specification `description` fields are noted as supporting CommonMark markdown formatting. +Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by [CommonMark 0.27](http://spec.commonmark.org/0.27/). Tooling MAY choose to ignore some CommonMark features to address security concerns. +

Relative References in URLs

+

Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [[!rfc3986]]section-4.2). +Relative references are resolved using the URLs defined in the Server Object as a Base URI.

+

Relative references used in $ref are processed as per JSON Reference, using the URL of the current document as the base URI. See also the Reference Object.

+

Schema

+

In the following description, if a field is not explicitly REQUIRED or described with a MUST or SHALL, it can be considered OPTIONAL.

+

OpenAPI Object

+

This is the root document object of the OpenAPI document.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
openapistringREQUIRED. This string MUST be the semantic version number of the OpenAPI Specification version that the OpenAPI document uses. The openapi field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is not related to the API info.version string.
infoInfo ObjectREQUIRED. Provides metadata about the API. The metadata MAY be used by tooling as required.
servers[Server Object]An array of Server Objects, which provide connectivity information to a target server. If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url value of /.
pathsPaths ObjectREQUIRED. The available paths and operations for the API.
componentsComponents ObjectAn element to hold various schemas for the specification.
security[Security Requirement Object]A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition.
tags[Tag Object]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.
externalDocsExternal Documentation ObjectAdditional external documentation.
+

This object MAY be extended with Specification Extensions.

+

Info Object

+

The object provides metadata about the API. +The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
titlestringREQUIRED. The title of the application.
descriptionstringA short description of the application. CommonMark syntax MAY be used for rich text representation.
termsOfServicestringA URL to the Terms of Service for the API. MUST be in the format of a URL.
contactContact ObjectThe contact information for the exposed API.
licenseLicense ObjectThe license information for the exposed API.
versionstringREQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version).
+

This object MAY be extended with Specification Extensions.

+
Info Object Example:
+

+{
+  "title": "Sample Pet Store App",
+  "description": "This is a sample server for a pet store.",
+  "termsOfService": "http://example.com/terms/",
+  "contact": {
+    "name": "API Support",
+    "url": "http://www.example.com/support",
+    "email": "support@example.com"
+  },
+  "license": {
+    "name": "Apache 2.0",
+    "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
+  },
+  "version": "1.0.1"
+}
+
+

+title: Sample Pet Store App
+description: This is a sample server for a pet store.
+termsOfService: http://example.com/terms/
+contact:
+  name: API Support
+  url: http://www.example.com/support
+  email: support@example.com
+license:
+  name: Apache 2.0
+  url: http://www.apache.org/licenses/LICENSE-2.0.html
+version: 1.0.1
+
+

Contact Object

+

Contact information for the exposed API.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
namestringThe identifying name of the contact person/organization.
urlstringThe URL pointing to the contact information. MUST be in the format of a URL.
emailstringThe email address of the contact person/organization. MUST be in the format of an email address.
+

This object MAY be extended with Specification Extensions.

+
Contact Object Example:
+

+{
+  "name": "API Support",
+  "url": "http://www.example.com/support",
+  "email": "support@example.com"
+}
+
+

+name: API Support
+url: http://www.example.com/support
+email: support@example.com
+
+

License Object

+

License information for the exposed API.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
namestringREQUIRED. The license name used for the API.
urlstringA URL to the license used for the API. MUST be in the format of a URL.
+

This object MAY be extended with Specification Extensions.

+
License Object Example:
+

+{
+  "name": "Apache 2.0",
+  "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
+}
+
+

+name: Apache 2.0
+url: http://www.apache.org/licenses/LICENSE-2.0.html
+
+

Server Object

+

An object representing a Server.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
urlstringREQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in {brackets}.
descriptionstringAn optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation.
variablesMap[string, Server Variable Object]A map between a variable name and its value. The value is used for substitution in the server’s URL template.
+

This object MAY be extended with Specification Extensions.

+
Server Object Example
+

A single server would be described as:

+

+{
+  "url": "https://development.gigantic-server.com/v1",
+  "description": "Development server"
+}
+
+

+url: https://development.gigantic-server.com/v1
+description: Development server
+
+

The following shows how multiple servers can be described, for example, at the OpenAPI Object’s servers:

+

+{
+  "servers": [
+    {
+      "url": "https://development.gigantic-server.com/v1",
+      "description": "Development server"
+    },
+    {
+      "url": "https://staging.gigantic-server.com/v1",
+      "description": "Staging server"
+    },
+    {
+      "url": "https://api.gigantic-server.com/v1",
+      "description": "Production server"
+    }
+  ]
+}
+
+

+servers:
+- url: https://development.gigantic-server.com/v1
+  description: Development server
+- url: https://staging.gigantic-server.com/v1
+  description: Staging server
+- url: https://api.gigantic-server.com/v1
+  description: Production server
+
+

The following shows how variables can be used for a server configuration:

+

+{
+  "servers": [
+    {
+      "url": "https://{username}.gigantic-server.com:{port}/{basePath}",
+      "description": "The production API server",
+      "variables": {
+        "username": {
+          "default": "demo",
+          "description": "this value is assigned by the service provider, in this example `gigantic-server.com`"
+        },
+        "port": {
+          "enum": [
+            "8443",
+            "443"
+          ],
+          "default": "8443"
+        },
+        "basePath": {
+          "default": "v2"
+        }
+      }
+    }
+  ]
+}
+
+

+servers:
+- url: https://{username}.gigantic-server.com:{port}/{basePath}
+  description: The production API server
+  variables:
+    username:
+      # note! no enum here means it is an open value
+      default: demo
+      description: this value is assigned by the service provider, in this example `gigantic-server.com`
+    port:
+      enum:
+        - '8443'
+        - '443'
+      default: '8443'
+    basePath:
+      # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2`
+      default: v2
+
+

Server Variable Object

+

An object representing a Server Variable for server URL template substitution.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
enum[string]An enumeration of string values to be used if the substitution options are from a limited set.
defaultstringREQUIRED. The default value to use for substitution, and to send, if an alternate value is not supplied. Unlike the Schema Object’s default, this value MUST be provided by the consumer.
descriptionstringAn optional description for the server variable. CommonMark syntax MAY be used for rich text representation.
+

This object MAY be extended with Specification Extensions.

+

Components Object

+

Holds a set of reusable objects for different aspects of the OAS. +All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
schemasMap[string, Schema Object | Reference Object]An object to hold reusable Schema Objects.
responsesMap[string, Response Object | Reference Object]An object to hold reusable Response Objects.
parametersMap[string, Parameter Object | Reference Object]An object to hold reusable Parameter Objects.
examplesMap[string, Example Object | Reference Object]An object to hold reusable Example Objects.
requestBodiesMap[string, Request Body Object | Reference Object]An object to hold reusable Request Body Objects.
headersMap[string, Header Object | Reference Object]An object to hold reusable Header Objects.
securitySchemesMap[string, Security Scheme Object | Reference Object]An object to hold reusable Security Scheme Objects.
linksMap[string, Link Object | Reference Object]An object to hold reusable Link Objects.
callbacksMap[string, Callback Object | Reference Object]An object to hold reusable Callback Objects.
+

This object MAY be extended with Specification Extensions.

+

All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9\.\-_]+$.

+

Field Name Examples:

+

+User
+User_1
+User_Name
+user-name
+my.org.User
+
+
Components Object Example
+

+"components": {
+  "schemas": {
+    "Category": {
+      "type": "object",
+      "properties": {
+        "id": {
+          "type": "integer",
+          "format": "int64"
+        },
+        "name": {
+          "type": "string"
+        }
+      }
+    },
+    "Tag": {
+      "type": "object",
+      "properties": {
+        "id": {
+          "type": "integer",
+          "format": "int64"
+        },
+        "name": {
+          "type": "string"
+        }
+      }
+    }
+  },
+  "parameters": {
+    "skipParam": {
+      "name": "skip",
+      "in": "query",
+      "description": "number of items to skip",
+      "required": true,
+      "schema": {
+        "type": "integer",
+        "format": "int32"
+      }
+    },
+    "limitParam": {
+      "name": "limit",
+      "in": "query",
+      "description": "max records to return",
+      "required": true,
+      "schema" : {
+        "type": "integer",
+        "format": "int32"
+      }
+    }
+  },
+  "responses": {
+    "NotFound": {
+      "description": "Entity not found."
+    },
+    "IllegalInput": {
+      "description": "Illegal input for operation."
+    },
+    "GeneralError": {
+      "description": "General Error",
+      "content": {
+        "application/json": {
+          "schema": {
+            "$ref": "#/components/schemas/GeneralError"
+          }
+        }
+      }
+    }
+  },
+  "securitySchemes": {
+    "api_key": {
+      "type": "apiKey",
+      "name": "api_key",
+      "in": "header"
+    },
+    "petstore_auth": {
+      "type": "oauth2",
+      "flows": {
+        "implicit": {
+          "authorizationUrl": "http://example.org/api/oauth/dialog",
+          "scopes": {
+            "write:pets": "modify pets in your account",
+            "read:pets": "read your pets"
+          }
+        }
+      }
+    }
+  }
+}
+
+

+components:
+  schemas:
+    Category:
+      type: object
+      properties:
+        id:
+          type: integer
+          format: int64
+        name:
+          type: string
+    Tag:
+      type: object
+      properties:
+        id:
+          type: integer
+          format: int64
+        name:
+          type: string
+  parameters:
+    skipParam:
+      name: skip
+      in: query
+      description: number of items to skip
+      required: true
+      schema:
+        type: integer
+        format: int32
+    limitParam:
+      name: limit
+      in: query
+      description: max records to return
+      required: true
+      schema:
+        type: integer
+        format: int32
+  responses:
+    NotFound:
+      description: Entity not found.
+    IllegalInput:
+      description: Illegal input for operation.
+    GeneralError:
+      description: General Error
+      content:
+        application/json:
+          schema:
+            $ref: '#/components/schemas/GeneralError'
+  securitySchemes:
+    api_key:
+      type: apiKey
+      name: api_key
+      in: header
+    petstore_auth:
+      type: oauth2
+      flows: 
+        implicit:
+          authorizationUrl: http://example.org/api/oauth/dialog
+          scopes:
+            write:pets: modify pets in your account
+            read:pets: read your pets
+
+

Paths Object

+

Holds the relative paths to the individual endpoints and their operations. +The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.

+

Patterned Fields

+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
/{path}Path Item ObjectA relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended (no relative URL resolution) to the expanded URL from the Server Object's url field in order to construct the full URL. Path templating is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it’s up to the tooling to decide which one to use.
+

This object MAY be extended with Specification Extensions.

+
Path Templating Matching
+

Assuming the following paths, the concrete definition, /pets/mine, will be matched first if used:

+

+  /pets/{petId}
+  /pets/mine
+
+

The following paths are considered identical and invalid:

+

+  /pets/{petId}
+  /pets/{name}
+
+

The following may lead to ambiguous resolution:

+

+  /{entity}/me
+  /books/{id}
+
+
Paths Object Example
+

+{
+  "/pets": {
+    "get": {
+      "description": "Returns all pets from the system that the user has access to",
+      "responses": {
+        "200": {          
+          "description": "A list of pets.",
+          "content": {
+            "application/json": {
+              "schema": {
+                "type": "array",
+                "items": {
+                  "$ref": "#/components/schemas/pet"
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
+
+

+/pets:
+  get:
+    description: Returns all pets from the system that the user has access to
+    responses:
+      '200':
+        description: A list of pets.
+        content:
+          application/json:
+            schema:
+              type: array
+              items:
+                $ref: '#/components/schemas/pet'
+
+

Path Item Object

+

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.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
$refstringAllows 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.
summarystringAn optional, string summary, intended to apply to all operations in this path.
descriptionstringAn optional, string description, intended to apply to all operations in this path. CommonMark syntax MAY be used for rich text representation.
getOperation ObjectA definition of a GET operation on this path.
putOperation ObjectA definition of a PUT operation on this path.
postOperation ObjectA definition of a POST operation on this path.
deleteOperation ObjectA definition of a DELETE operation on this path.
optionsOperation ObjectA definition of a OPTIONS operation on this path.
headOperation ObjectA definition of a HEAD operation on this path.
patchOperation ObjectA definition of a PATCH operation on this path.
traceOperation ObjectA definition of a TRACE operation on this path.
servers[Server Object]An alternative server array to service all operations in this path.
parameters[Parameter Object | Reference Object]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 OpenAPI Object’s components/parameters.
+

This object MAY be extended with Specification Extensions.

+
Path Item Object Example
+

+{
+  "get": {
+    "description": "Returns pets based on ID",
+    "summary": "Find pets by ID",
+    "operationId": "getPetsById",
+    "responses": {
+      "200": {
+        "description": "pet response",
+        "content": {
+          "*/*": {
+            "schema": {
+              "type": "array",
+              "items": {
+                "$ref": "#/components/schemas/Pet"
+              }
+            }
+          }
+        }
+      },
+      "default": {
+        "description": "error payload",
+        "content": {
+          "text/html": {
+            "schema": {
+              "$ref": "#/components/schemas/ErrorModel"
+            }
+          }
+        }
+      }
+    }
+  },
+  "parameters": [
+    {
+      "name": "id",
+      "in": "path",
+      "description": "ID of pet to use",
+      "required": true,
+      "schema": {
+        "type": "array",
+        "items": {
+          "type": "string"
+        }
+      },
+      "style": "simple"
+    }
+  ]
+}
+
+

+get:
+  description: Returns pets based on ID
+  summary: Find pets by ID
+  operationId: getPetsById
+  responses:
+    '200':
+      description: pet response
+      content:
+        '*/*' :
+          schema:
+            type: array
+            items:
+              $ref: '#/components/schemas/Pet'
+    default:
+      description: error payload
+      content:
+        'text/html':
+          schema:
+            $ref: '#/components/schemas/ErrorModel'
+parameters:
+- name: id
+  in: path
+  description: ID of pet to use
+  required: true
+  schema:
+    type: array
+    style: simple
+    items:
+      type: string  
+
+

Operation Object

+

Describes a single API operation on a path.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
tags[string]A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
summarystringA short summary of what the operation does.
descriptionstringA verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation.
externalDocsExternal Documentation ObjectAdditional external documentation for this operation.
operationIdstringUnique 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[Parameter Object | Reference Object]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 OpenAPI Object’s components/parameters.
requestBodyRequest Body Object | Reference ObjectThe request body applicable for this operation. The requestBody is only supported in HTTP methods where the HTTP 1.1 specification [[!rfc7231]]section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers.
responsesResponses ObjectREQUIRED. The list of possible responses as they are returned from executing this operation.
callbacksMap[string, Callback Object | Reference Object]A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
deprecatedbooleanDeclares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is false.
security[Security Requirement Object]A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used.
servers[Server Object]An alternative server array to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value.
+

This object MAY be extended with Specification Extensions.

+
Operation Object Example
+

+{
+  "tags": [
+    "pet"
+  ],
+  "summary": "Updates a pet in the store with form data",
+  "operationId": "updatePetWithForm",
+  "parameters": [
+    {
+      "name": "petId",
+      "in": "path",
+      "description": "ID of pet that needs to be updated",
+      "required": true,
+      "schema": {
+        "type": "string"
+      }
+    }
+  ],
+  "requestBody": {
+    "content": {
+      "application/x-www-form-urlencoded": {
+        "schema": {
+          "type": "object",
+           "properties": {
+              "name": { 
+                "description": "Updated name of the pet",
+                "type": "string"
+              },
+              "status": {
+                "description": "Updated status of the pet",
+                "type": "string"
+             }
+           },
+        "required": ["status"] 
+        }
+      }
+    }
+  },
+  "responses": {
+    "200": {
+      "description": "Pet updated.",
+      "content": {
+        "application/json": {},
+        "application/xml": {}
+      }
+    },
+    "405": {
+      "description": "Invalid input",
+      "content": {
+        "application/json": {},
+        "application/xml": {}
+      }
+    }
+  },
+  "security": [
+    {
+      "petstore_auth": [
+        "write:pets",
+        "read:pets"
+      ]
+    }
+  ]
+}
+
+

+tags:
+- pet
+summary: Updates a pet in the store with form data
+operationId: updatePetWithForm
+parameters:
+- name: petId
+  in: path
+  description: ID of pet that needs to be updated
+  required: true
+  schema:
+    type: string
+requestBody:
+  content:
+    'application/x-www-form-urlencoded':
+      schema:
+       properties:
+          name: 
+            description: Updated name of the pet
+            type: string
+          status:
+            description: Updated status of the pet
+            type: string
+       required:
+         - status
+responses:
+  '200':
+    description: Pet updated.
+    content: 
+      'application/json': {}
+      'application/xml': {}
+  '405':
+    description: Invalid input
+    content: 
+      'application/json': {}
+      'application/xml': {}
+security:
+- petstore_auth:
+  - write:pets
+  - read:pets
+
+

External Documentation Object

+

Allows referencing an external resource for extended documentation.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
descriptionstringA short description of the target documentation. CommonMark syntax MAY be used for rich text representation.
urlstringREQUIRED. The URL for the target documentation. Value MUST be in the format of a URL.
+

This object MAY be extended with Specification Extensions.

+
External Documentation Object Example
+

+{
+  "description": "Find more info here",
+  "url": "https://example.com"
+}
+
+

+description: Find more info here
+url: https://example.com
+
+

Parameter Object

+

Describes a single operation parameter.

+

A unique parameter is defined by a combination of a name and location.

+

Parameter Locations

+

There are four possible parameter locations specified by the in field:

+
    +
  • path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId.
  • +
  • query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id.
  • +
  • header - Custom headers that are expected as part of the request. Note that [[!rfc7230]]page-22) states header names are case insensitive.
  • +
  • cookie - Used to pass a specific cookie value to the API.
  • +
+
Fixed Fields
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
namestringREQUIRED. 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.
  • If in is "header" and the name field is "Accept", "Content-Type" or "Authorization", the parameter definition SHALL be ignored.
  • For all other cases, the name corresponds to the parameter name used by the in property.
instringREQUIRED. The location of the parameter. Possible values are “query”, “header”, “path” or “cookie”.
descriptionstringA brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
requiredbooleanDetermines whether this parameter is mandatory. If the parameter location is “path”, this property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and its default value is false.
deprecatedbooleanSpecifies that a parameter is deprecated and SHOULD be transitioned out of usage.
allowEmptyValuebooleanSets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored.
+

The rules for serialization of the parameter are specified in one of two ways. +For simpler scenarios, a schema and style can describe the structure and syntax of the parameter.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
stylestringDescribes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form.
explodebooleanWhen this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false.
allowReservedbooleanDetermines whether the parameter value SHOULD allow reserved characters, as defined by [[!rfc3986]]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false.
schemaSchema Object | Reference ObjectThe schema defining the type used for the parameter.
exampleAnyExample of the media type. The example SHOULD match the specified schema and encoding properties if present. The example object is mutually exclusive of the examples object. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.
examplesMap[ string, Example Object | Reference Object]Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The examples object is mutually exclusive of the example object. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema.
+

For more complex scenarios, the content property can define the media type and schema of the parameter. +A parameter MUST contain either a schema property, or a content property, but not both. +When example or examples are provided in conjunction with the schema object, the example MUST follow the prescribed serialization strategy for the parameter.

+ + + + + + + + + + + + + + + +
Field NameTypeDescription
contentMap[string, Media Type Object]A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.
+
Style Values
+

In order to support common ways of serializing simple parameters, a set of style values are defined.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
styletypeinComments
matrixprimitive, array, objectpathPath-style parameters defined by [[!rfc6570]]section-3.2.7)
labelprimitive, array, objectpathLabel style parameters defined by [[!rfc6570]]section-3.2.5)
formprimitive, array, objectquery, cookieForm style parameters defined by [[!rfc6570]]section-3.2.8). This option replaces collectionFormat with a csv (when explode is false) or multi (when explode is true) value from OpenAPI 2.0.
simplearraypath, headerSimple style parameters defined by [[!rfc6570]]section-3.2.2). This option replaces collectionFormat with a csv value from OpenAPI 2.0.
spaceDelimitedarrayquerySpace separated array values. This option replaces collectionFormat equal to ssv from OpenAPI 2.0.
pipeDelimitedarrayqueryPipe separated array values. This option replaces collectionFormat equal to pipes from OpenAPI 2.0.
deepObjectobjectqueryProvides a simple way of rendering nested objects using form parameters.
+
Style Examples
+

Assume a parameter named color has one of the following values:

+

+   string -> "blue"
+   array -> ["blue","black","brown"]
+   object -> { "R": 100, "G": 200, "B": 150 }
+
+

The following table shows examples of rendering differences for each value.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
styleexplodeemptystringarrayobject
matrixfalse;color;color=blue;color=blue,black,brown;color=R,100,G,200,B,150
matrixtrue;color;color=blue;color=blue;color=black;color=brown;R=100;G=200;B=150
labelfalse..blue.blue.black.brown.R.100.G.200.B.150
labeltrue..blue.blue.black.brown.R=100.G=200.B=150
formfalsecolor=color=bluecolor=blue,black,browncolor=R,100,G,200,B,150
formtruecolor=color=bluecolor=blue&color=black&color=brownR=100&G=200&B=150
simplefalsen/ablueblue,black,brownR,100,G,200,B,150
simpletruen/ablueblue,black,brownR=100,G=200,B=150
spaceDelimitedfalsen/an/ablue%20black%20brownR%20100%20G%20200%20B%20150
pipeDelimitedfalsen/an/ablue|black|brownR|100|G|200
deepObjecttruen/an/an/acolor[R]=100&color[G]=200&color[B]=150
+

This object MAY be extended with Specification Extensions.

+
Parameter Object Examples
+

A header parameter with an array of 64 bit integer numbers:

+

+{
+  "name": "token",
+  "in": "header",
+  "description": "token to be passed as a header",
+  "required": true,
+  "schema": {
+    "type": "array",
+    "items": {
+      "type": "integer",
+      "format": "int64"
+    }
+  },
+  "style": "simple"
+}
+
+

+name: token
+in: header
+description: token to be passed as a header
+required: true
+schema:
+  type: array
+  items:
+    type: integer
+    format: int64
+style: simple
+
+

A path parameter of a string value:

+

+{
+  "name": "username",
+  "in": "path",
+  "description": "username to fetch",
+  "required": true,
+  "schema": {
+    "type": "string"
+  }
+}
+
+

+name: username
+in: path
+description: username to fetch
+required: true
+schema:
+  type: string
+
+

An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

+

+{
+  "name": "id",
+  "in": "query",
+  "description": "ID of the object to fetch",
+  "required": false,
+  "schema": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    }
+  },
+  "style": "form",
+  "explode": true
+}
+
+

+name: id
+in: query
+description: ID of the object to fetch
+required: false
+schema:
+  type: array
+  items:
+    type: string
+style: form
+explode: true
+
+

A free-form query parameter, allowing undefined parameters of a specific type:

+

+{
+  "in": "query",
+  "name": "freeForm",
+  "schema": {
+    "type": "object",
+    "additionalProperties": {
+      "type": "integer"
+    },
+  },
+  "style": "form"
+}
+
+

+in: query
+name: freeForm
+schema:
+  type: object
+  additionalProperties:
+    type: integer
+style: form
+
+

A complex parameter using content to define serialization:

+

+{
+  "in": "query",
+  "name": "coordinates",
+  "content": {
+    "application/json": {
+      "schema": {
+        "type": "object",
+        "required": [
+          "lat",
+          "long"
+        ],
+        "properties": {
+          "lat": {
+            "type": "number"
+          },
+          "long": {
+            "type": "number"
+          }
+        }
+      }
+    }
+  }
+}
+
+

+in: query
+name: coordinates
+content:
+  application/json:
+    schema:
+      type: object
+      required:
+        - lat
+        - long
+      properties:
+        lat:
+          type: number
+        long:
+          type: number
+
+

Request Body Object

+

Describes a single request body.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
descriptionstringA brief description of the request body. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
contentMap[string, Media Type Object]REQUIRED. The content of the request body. The key is a media type or [media type range]appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
requiredbooleanDetermines if the request body is required in the request. Defaults to false.
+

This object MAY be extended with Specification Extensions.

+
Request Body Examples
+

A request body with a referenced model definition.

+

+{
+  "description": "user to add to the system",
+  "content": {
+    "application/json": {
+      "schema": {
+        "$ref": "#/components/schemas/User"
+      },
+      "examples": {
+          "user" : {
+            "summary": "User Example", 
+            "externalValue": "http://foo.bar/examples/user-example.json"
+          } 
+        }
+    },
+    "application/xml": {
+      "schema": {
+        "$ref": "#/components/schemas/User"
+      },
+      "examples": {
+          "user" : {
+            "summary": "User example in XML",
+            "externalValue": "http://foo.bar/examples/user-example.xml"
+          }
+        }
+    },
+    "text/plain": {
+      "examples": {
+        "user" : {
+            "summary": "User example in Plain text",
+            "externalValue": "http://foo.bar/examples/user-example.txt" 
+        }
+      } 
+    },
+    "*/*": {
+      "examples": {
+        "user" : {
+            "summary": "User example in other format",
+            "externalValue": "http://foo.bar/examples/user-example.whatever"
+        }
+      }
+    }
+  }
+}
+
+

+description: user to add to the system
+content: 
+  'application/json':
+    schema:
+      $ref: '#/components/schemas/User'
+    examples:
+      user:
+        summary: User Example
+        externalValue: 'http://foo.bar/examples/user-example.json'
+  'application/xml':
+    schema:
+      $ref: '#/components/schemas/User'
+    examples:
+      user:
+        summary: User Example in XML
+        externalValue: 'http://foo.bar/examples/user-example.xml'
+  'text/plain':
+    examples:
+      user:
+        summary: User example in text plain format
+        externalValue: 'http://foo.bar/examples/user-example.txt'
+  '*/*':
+    examples:
+      user: 
+        summary: User example in other format
+        externalValue: 'http://foo.bar/examples/user-example.whatever'
+
+

A body parameter that is an array of string values:

+

+{
+  "description": "user to add to the system",
+  "content": {
+    "text/plain": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "type": "string"
+        }
+      }
+    }
+  }
+}
+
+

+description: user to add to the system
+required: true
+content:
+  text/plain:
+    schema:
+      type: array
+      items:
+        type: string
+
+

Media Type Object

+Each Media Type Object provides schema and examples for the media type identified by its key. +

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
schemaSchema Object | Reference ObjectThe schema defining the type used for the request body.
exampleAnyExample of the media type. The example object SHOULD be in the correct format as specified by the media type. The example object is mutually exclusive of the examples object. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema.
examplesMap[ string, Example Object | Reference Object]Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The examples object is mutually exclusive of the example object. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema.
encodingMap[string, Encoding Object]A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded.
+

This object MAY be extended with Specification Extensions.

+
Media Type Examples
+

+{
+  "application/json": {
+    "schema": {
+         "$ref": "#/components/schemas/Pet"
+    },
+    "examples": {
+      "cat" : {
+        "summary": "An example of a cat",
+        "value": 
+          {
+            "name": "Fluffy",
+            "petType": "Cat",
+            "color": "White",
+            "gender": "male",
+            "breed": "Persian"
+          }
+      },
+      "dog": {
+        "summary": "An example of a dog with a cat's name",
+        "value" :  { 
+          "name": "Puma",
+          "petType": "Dog",
+          "color": "Black",
+          "gender": "Female",
+          "breed": "Mixed"
+        },
+      "frog": {
+          "$ref": "#/components/examples/frog-example"
+        }
+      }
+    }
+  }
+}
+
+

+application/json: 
+  schema:
+    $ref: "#/components/schemas/Pet"
+  examples:
+    cat:
+      summary: An example of a cat
+      value:
+        name: Fluffy
+        petType: Cat
+        color: White
+        gender: male
+        breed: Persian
+    dog:
+      summary: An example of a dog with a cat's name
+      value:
+        name: Puma
+        petType: Dog
+        color: Black
+        gender: Female
+        breed: Mixed
+    frog:
+      $ref: "#/components/examples/frog-example"
+
+
Considerations for File Uploads
+

In contrast with the 2.0 specification, file input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically:

+

+# content transferred with base64 encoding
+schema:
+  type: string
+  format: base64
+
+

+# content transferred in binary (octet-stream):
+schema:
+  type: string
+  format: binary
+
+

These examples apply to either input payloads of file uploads or response payloads.

+

A requestBody for submitting a file in a POST operation may look like the following example:

+

+requestBody:
+  content:
+    application/octet-stream:
+      # any media type is accepted, functionally equivalent to `*/*`
+      schema:
+        # a binary file of any type
+        type: string
+        format: binary
+
+

In addition, specific media types MAY be specified:

+

+# multiple, specific media types may be specified:
+requestBody:
+  content:
+      # a binary file of type png or jpeg
+    'image/jpeg':
+      schema:
+        type: string
+        format: binary
+    'image/png':
+      schema:
+        type: string
+        format: binary        
+
+

To upload multiple files, a multipart media type MUST be used:

+

+requestBody:
+  content:
+    multipart/form-data:
+      schema:
+        properties:
+          # The property name 'file' will be used for all files.
+          file:
+            type: array
+            items:
+              type: string
+              format: binary
+
+
+

Support for x-www-form-urlencoded Request Bodies

+

To submit content using form url encoding via [[!rfc1866]], the following +definition may be used:

+

+requestBody:
+  content:
+    application/x-www-form-urlencoded:
+      schema:
+        type: object
+        properties:
+          id:
+            type: string
+            format: uuid
+          address:
+            # complex types are stringified to support RFC 1866
+            type: object
+            properties: {}
+
+

In this example, the contents in the requestBody MUST be stringified per [[!rfc1866]]) when passed to the server. In addition, the address field complex object will be stringified.

+

When passing complex objects in the application/x-www-form-urlencoded content type, the default serialization strategy of such properties is described in the Encoding Object's style property as form.

+

Special Considerations for multipart Content

+

It is common to use multipart/form-data as a Content-Type when transferring request bodies to operations. In contrast to 2.0, a schema is REQUIRED to define the input parameters to the operation when using multipart content. This supports complex structures as well as supporting mechanisms for multiple file uploads.

+

When passing in multipart types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default Content-Types are defined for multipart:

+
    +
  • If the property is a primitive, or an array of primitive values, the default Content-Type is text/plain
  • +
  • If the property is complex, or an array of complex values, the default Content-Type is application/json
  • +
  • If the property is a type: string with format: binary or format: base64 (aka a file object), the default Content-Type is application/octet-stream
  • +
+

Examples:

+

+requestBody:
+  content:
+    multipart/form-data:
+      schema:
+        type: object
+        properties:
+          id:
+            type: string
+            format: uuid
+          address:
+            # default Content-Type for objects is `application/json`
+            type: object
+            properties: {}
+          profileImage:
+            # default Content-Type for string/binary is `application/octet-stream`
+            type: string
+            format: binary
+          children:
+            # default Content-Type for arrays is based on the `inner` type (text/plain here)
+            type: array
+            items:
+              type: string
+          addresses:
+            # default Content-Type for arrays is based on the `inner` type (object shown, so `application/json` in this example)
+            type: array
+            items:
+              type: '#/components/schemas/Address'
+
+

An encoding attribute is introduced to give you control over the serialization of parts of multipart request bodies. This attribute is only applicable to multipart and application/x-www-form-urlencoded request bodies.

+

Encoding Object

+

A single encoding definition applied to a single schema property.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
contentTypestringThe Content-Type for encoding a specific property. Default value depends on the property type: for string with format being binaryapplication/octet-stream; for other primitive types – text/plain; for object - application/json; for array – the default is defined based on the inner type. The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types.
headersMap[string, Header Object | Reference Object]A map allowing additional information to be provided as headers, for example Content-Disposition. Content-Type is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a multipart.
stylestringDescribes how a specific property value will be serialized depending on its type. See Parameter Object for details on the style property. The behavior follows the same values as query parameters, including default values. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
explodebooleanWhen this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
allowReservedbooleanDetermines whether the parameter value SHOULD allow reserved characters, as defined by [[!rfc3986]]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
+

This object MAY be extended with Specification Extensions.

+
Encoding Object Example
+

+requestBody:
+  content:
+    multipart/mixed:
+      schema:
+        type: object
+        properties:
+          id:
+            # default is text/plain
+            type: string
+            format: uuid
+          address:
+            # default is application/json
+            type: object
+            properties: {}
+          historyMetadata:
+            # need to declare XML format!
+            description: metadata in XML format
+            type: object
+            properties: {}
+          profileImage:
+            # default is application/octet-stream, need to declare an image type only!
+            type: string
+            format: binary
+      encoding:
+        historyMetadata:
+          # require XML Content-Type in utf-8 encoding
+          contentType: application/xml; charset=utf-8
+        profileImage:
+          # only accept png/jpeg
+          contentType: image/png, image/jpeg
+          headers:
+            X-Rate-Limit-Limit:
+              description: The number of allowed requests in the current period
+              schema:
+                type: integer
+
+

Responses Object

+

A container for the expected responses of an operation. +The container maps a HTTP response code to the expected response.

+

The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. +However, documentation is expected to cover a successful operation response and any known errors.

+

The default MAY be used as a default response object for all HTTP codes +that are not covered individually by the specification.

+

The Responses Object MUST contain at least one response code, and it +SHOULD be the response for a successful operation call.

+

Fixed Fields

+ + + + + + + + + + + + + + + +
Field NameTypeDescription
defaultResponse Object | Reference ObjectThe documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. A Reference Object can link to a response that the OpenAPI Object’s components/responses section defines.
+
Patterned Fields
+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
HTTP Status CodeResponse Object | Reference ObjectAny HTTP status code can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A Reference Object can link to a response that is defined in the OpenAPI Object’s components/responses section. This field MUST be enclosed in quotation marks (for example, “200”) for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character X. For example, 2XX represents all response codes between [200-299]. The following range definitions are allowed: 1XX, 2XX, 3XX, 4XX, and 5XX. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code.
+

This object MAY be extended with Specification Extensions.

+
Responses Object Example
+

A 200 response for a successful operation and a default response for others (implying an error):

+

+{
+  "200": {
+    "description": "a pet to be returned",
+    "content": {
+      "application/json": {
+        "schema": {
+          "$ref": "#/components/schemas/Pet"
+        }
+      }
+    }
+  },
+  "default": {
+    "description": "Unexpected error",
+    "content": {
+      "application/json": {
+        "schema": {
+          "$ref": "#/components/schemas/ErrorModel"
+        }
+      }
+    }
+  }
+}
+
+

+'200':
+  description: a pet to be returned
+  content: 
+    application/json:
+      schema:
+        $ref: '#/components/schemas/Pet'
+default:
+  description: Unexpected error
+  content:
+    application/json:
+      schema:
+        $ref: '#/components/schemas/ErrorModel'
+
+

Response Object

+Describes a single response from an API Operation, including design-time, static +`links` to operations based on the response. +

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
descriptionstringREQUIRED. A short description of the response. CommonMark syntax MAY be used for rich text representation.
headersMap[string, Header Object | Reference Object]Maps a header name to its definition. [[!rfc7230]]page-22) states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored.
contentMap[string, Media Type Object]A map containing descriptions of potential response payloads. The key is a media type or [media type range]appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
linksMap[string, Link Object | Reference Object]A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for Component Objects.
+

This object MAY be extended with Specification Extensions.

+
Response Object Examples
+

Response of an array of a complex type:

+

+{
+  "description": "A complex object array response",
+  "content": {
+    "application/json": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/components/schemas/VeryComplexType"
+        }
+      }
+    }
+  }
+}
+
+

+description: A complex object array response
+content: 
+  application/json:
+    schema: 
+      type: array
+      items:
+        $ref: '#/components/schemas/VeryComplexType'
+
+

Response with a string type:

+

+{
+  "description": "A simple string response",
+  "content": {
+    "text/plain": {
+      "schema": {
+        "type": "string"
+      }
+    }
+  }
+
+}
+
+

+description: A simple string response
+representations:
+  text/plain:
+    schema:
+      type: string
+
+

Plain text response with headers:

+

+{
+  "description": "A simple string response",
+  "content": {
+    "text/plain": {
+      "schema": {
+        "type": "string"
+      }
+    }
+  },
+  "headers": {
+    "X-Rate-Limit-Limit": {
+      "description": "The number of allowed requests in the current period",
+      "schema": {
+        "type": "integer"
+      }
+    },
+    "X-Rate-Limit-Remaining": {
+      "description": "The number of remaining requests in the current period",
+      "schema": {
+        "type": "integer"
+      }
+    },
+    "X-Rate-Limit-Reset": {
+      "description": "The number of seconds left in the current period",
+      "schema": {
+        "type": "integer"
+      }
+    }
+  }
+}
+
+

+description: A simple string response
+content:
+  text/plain:
+    schema:
+      type: string
+    example: 'whoa!'
+headers:
+  X-Rate-Limit-Limit:
+    description: The number of allowed requests in the current period
+    schema:
+      type: integer
+  X-Rate-Limit-Remaining:
+    description: The number of remaining requests in the current period
+    schema:
+      type: integer
+  X-Rate-Limit-Reset:
+    description: The number of seconds left in the current period
+    schema:
+      type: integer
+
+

Response with no return value:

+

+{
+  "description": "object created"
+}
+
+

+description: object created
+
+

Callback Object

+

A map of possible out-of band callbacks related to the parent operation. +Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. +The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

+

Patterned Fields

+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
{expression}Path Item ObjectA Path Item Object used to define a callback request and expected responses. A complete example is available.
+

This object MAY be extended with Specification Extensions.

+
Key Expression
+

The key that identifies the Path Item Object is a runtime expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. +A simple example might be $request.body#/url. +However, using a runtime expression the complete HTTP message can be accessed. +This includes accessing any part of a body that a JSON Pointer [[!rfc6901]] can reference.

+

For example, given the following HTTP request:

+

+POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1
+Host: example.org
+Content-Type: application/json
+Content-Length: 187
+
+{
+  "failedUrl" : "http://clientdomain.com/failed",
+  "successUrls" : [
+    "http://clientdomain.com/fast",
+    "http://clientdomain.com/medium",
+    "http://clientdomain.com/slow"
+  ] 
+}
+
+201 Created
+Location: http://example.org/subscription/1
+
+

The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named eventType and a query parameter named queryUrl.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ExpressionValue
$urlhttp://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning
$methodPOST
$request.path.eventTypemyevent
$request.query.queryUrlhttp://clientdomain.com/stillrunning
$request.header.content-Typeapplication/json
$request.body#/failedUrlhttp://clientdomain.com/stillrunning
$request.body#/successUrls/2http://clientdomain.com/medium
$response.header.Locationhttp://example.org/subscription/1
+
Callback Object Example
+

The following example shows a callback to the URL specified by the id and email property in the request body.

+

+myWebhook:
+  'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
+    post:
+      requestBody:
+        description: Callback payload
+        content: 
+          'application/json':
+            schema:
+              $ref: '#/components/schemas/SomePayload'
+      responses:
+        '200':
+          description: webhook successfully processed and no retries will be performed
+
+

Example Object

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
summarystringShort description for the example.
descriptionstringLong description for the example. CommonMark syntax MAY be used for rich text representation.
valueAnyEmbedded literal example. The value field and externalValue field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary.
externalValuestringA URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The value field and externalValue field are mutually exclusive.
+

This object MAY be extended with Specification Extensions.

+

In all cases, the example value is expected to be compatible with the type schema +of its associated value. Tooling implementations MAY choose to +validate compatibility automatically, and reject the example value(s) if incompatible.

+
Example Object Example
+

+# in a model
+schemas:
+  properties:
+    name:
+      type: string
+      examples:
+        name:
+          $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example
+
+# in a request body:
+  requestBody:
+    content:
+      'application/json':
+        schema:
+          $ref: '#/components/schemas/Address'
+        examples: 
+          foo:
+            summary: A foo example
+            value: {"foo": "bar"}
+          bar:
+            summary: A bar example
+            value: {"bar": "baz"}
+      'application/xml':
+        examples: 
+          xmlExample:
+            summary: This is an example in XML
+            externalValue: 'http://example.org/examples/address-example.xml'
+      'text/plain':
+        examples:
+          textExample: 
+            summary: This is a text example
+            externalValue: 'http://foo.bar/examples/address-example.txt' 
+
+
+# in a parameter
+  parameters:
+    - name: 'zipCode'
+      in: 'query'
+      schema:
+        type: 'string'
+        format: 'zip-code'
+        examples:
+          zip-example: 
+            $ref: '#/components/examples/zip-example'
+
+# in a response
+  responses:
+    '200':
+      description: your car appointment has been booked
+      content: 
+        application/json:
+          schema:
+            $ref: '#/components/schemas/SuccessResponse'
+          examples:
+            confirmation-success:
+              $ref: '#/components/examples/confirmation-success'
+
+

Link Object

+

The Link object represents a possible design-time link for a response. +The presence of a link does not guarantee the caller’s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.

+

Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.

+

For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
operationRefstringA relative or absolute reference to an OAS operation. This field is mutually exclusive of the operationId field, and MUST point to an Operation Object. Relative operationRef values MAY be used to locate an existing Operation Object in the OpenAPI definition.
operationIdstringThe name of an existing, resolvable OAS operation, as defined with a unique operationId. This field is mutually exclusive of the operationRef field.
parametersMap[string, Any | {expression}]A map representing parameters to pass to an operation as specified with operationId or identified via operationRef. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id).
requestBodyAny | {expression}A literal value or {expression} to use as a request body when calling the target operation.
descriptionstringA description of the link. CommonMark syntax MAY be used for rich text representation.
serverServer ObjectA server object to be used by the target operation.
+

This object MAY be extended with Specification Extensions.

+

A linked operation MUST be identified using either an operationRef or operationId. +In the case of an operationId, it MUST be unique and resolved in the scope of the OAS document. +Because of the potential for name clashes, the operationRef syntax is preferred +for specifications with external references.

+

Examples

+

Computing a link from a request operation where the $request.path.id is used to pass a request parameter to the linked operation.

+

+paths:
+  /users/{id}:
+    parameters:
+    - name: id
+      in: path
+      required: true
+      description: the user identifier, as userId 
+      schema:
+        type: string
+    get:
+      responses:
+        '200':
+          description: the user being returned
+          content:
+            application/json:
+              schema:
+                type: object
+                properties:
+                  uuid: # the unique user id
+                    type: string
+                    format: uuid
+        links:
+          address:
+            # the target link operationId
+            operationId: getUserAddress
+            parameters:
+              # get the `id` field from the request path parameter named `id`
+              userId: $request.path.id
+  # the path item of the linked operation
+  /users/{userid}/address:
+    parameters:
+    - name: userid
+      in: path
+      required: true
+      description: the user identifier, as userId 
+      schema:
+        type: string
+      # linked operation
+      get:
+        operationId: getUserAddress
+        responses:
+          '200':
+            description: the user's address
+
+

When a runtime expression fails to evaluate, no parameter value is passed to the target operation.

+

Values from the response body can be used to drive a linked operation.

+

+links:
+  address:
+    operationId: getUserAddressByUUID
+    parameters:
+      # get the `id` field from the request path parameter named `id`
+      userUuid: $response.body#/uuid
+
+

Clients follow all links at their discretion. +Neither permissions, nor the capability to make a successful call to that link, is guaranteed +solely by the existence of a relationship.

+

OperationRef Examples

+

As references to operationId MAY NOT be possible (the operationId is an optional +value), references MAY also be made through a relative operationRef:

+

+links:
+  UserRepositories:
+    # returns array of '#/components/schemas/repository'
+    operationRef: '#/paths/~12.0~1repositories~1{username}/get'
+    parameters:
+      username: $response.body#/username
+
+

or an absolute operationRef:

+

+links:
+  UserRepositories:
+    # returns array of '#/components/schemas/repository'
+    operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get'
+    parameters:
+      username: $response.body#/username
+
+

Note that in the use of operationRef, the escaped forward-slash is necessary when +using JSON references.

+
Runtime Expressions
+

Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. +This mechanism is used by Link Objects and Callback Objects.

+

The runtime expression is defined by the following [Advanced Backus-Naur Form] syntax

+

+      expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source )
+      source = ( header-reference | query-reference | path-reference | body-reference )  
+      header-reference = "header." token
+      query-reference = "query." name  
+      path-reference = "path." name
+      body-reference = "body" ["#" fragment]
+      fragment = a JSON Pointer [RFC 6901]  
+      name = *( char )
+      char = as per RFC [7159]section-7)
+      token = as per RFC [7230]section-3.2.6)
+
+

The name identifier is case-sensitive, whereas token is not.

+

The table below provides examples of runtime expressions and examples of their use in a value:

+
Examples
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source Locationexample expressionnotes
HTTP Method$methodThe allowable values for the $method will be those for the HTTP operation.
Requested media type$request.header.accept
Request parameter$request.path.idRequest parameters MUST be declared in the parameters section of the parent operation or they cannot be evaluated. This includes request headers.
Request body property$request.body#/user/uuidIn operations which accept payloads, references may be made to portions of the requestBody or the entire body.
Request URL$url
Response value$response.body#/statusIn operations which return payloads, references may be made to portions of the response body or the entire body.
Response header$response.header.ServerSingle header values only are available
+

Runtime expressions preserve the type of the referenced value. +Expressions can be embedded into string values by surrounding the expression with {} curly braces.

+

Header Object

+

The Header Object follows the structure of the Parameter Object with the following changes:

+
    +
  1. name MUST NOT be specified, it is given in the corresponding headers map.
  2. +
  3. in MUST NOT be specified, it is implicitly in header.
  4. +
  5. All traits that are affected by the location MUST be applicable to a location of header (for example, style).
  6. +
+

Header Object Example

+

A simple header of type integer:

+

+{
+  "description": "The number of allowed requests in the current period",
+  "schema": {
+    "type": "integer"
+  }
+}
+
+

+description: The number of allowed requests in the current period
+schema:
+  type: integer
+
+

Tag Object

+

Adds metadata to a single tag that is used by the Operation Object. +It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
namestringREQUIRED. The name of the tag.
descriptionstringA short description for the tag. CommonMark syntax MAY be used for rich text representation.
externalDocsExternal Documentation ObjectAdditional external documentation for this tag.
+

This object MAY be extended with Specification Extensions.

+
Tag Object Example
+

+{
+	"name": "pet",
+	"description": "Pets operations"
+}
+
+

+name: pet
+description: Pets operations
+
+

Examples Object

+

In an example, a JSON Reference MAY be used, with the +explicit restriction that examples having a JSON format with object named +$ref are not allowed. Therefore, that example, structurally, can be +either a string primitive or an object, similar to additionalProperties.

+

In all cases, the payload is expected to be compatible with the type schema +for the associated value. Tooling implementations MAY choose to +validate compatibility automatically, and reject the example value(s) if they +are incompatible.

+

+# in a model
+schemas:
+  properties:
+    name:
+      type: string
+      example:
+        $ref: http://foo.bar#/examples/name-example
+
+# in a request body, note the plural `examples`
+  requestBody:
+    content:
+      'application/json':
+        schema:
+          $ref: '#/components/schemas/Address'
+        examples:
+          foo:
+            value: {"foo": "bar"}
+          bar:
+            value: {"bar": "baz"}
+      'application/xml':
+        examples:
+          xml:
+            externalValue: 'http://foo.bar/examples/address-example.xml'
+      'text/plain':
+        examples:
+          text:
+            externalValue: 'http://foo.bar/examples/address-example.txt'
+        
+# in a parameter
+  parameters:
+    - name: 'zipCode'
+      in: 'query'
+      schema:
+        type: 'string'
+        format: 'zip-code'
+        example: 
+          $ref: 'http://foo.bar#/examples/zip-example'
+
+# in a response, note the singular `example`:
+  responses:
+    '200':
+      description: your car appointment has been booked
+      content: 
+        application/json:
+          schema:
+            $ref: '#/components/schemas/SuccessResponse'
+          example:
+            $ref: http://foo.bar#/examples/address-example.json
+
+

Reference Object

+

A simple object to allow referencing other components in the specification, internally and externally.

+

The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.

+

For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.

+

Fixed Fields

+ + + + + + + + + + + + + + + +
Field NameTypeDescription
$refstringREQUIRED. The reference string.
+

This object cannot be extended with additional properties and any properties added SHALL be ignored.

+

Reference Object Example

+

+{
+	"$ref": "#/components/schemas/Pet"
+}
+
+

+$ref: '#/components/schemas/Pet'
+
+

Relative Schema Document Example

+

+{
+  "$ref": "Pet.json"
+}
+
+

+$ref: Pet.yaml
+
+
Relative Documents With Embedded Schema Example
+

+{
+  "$ref": "definitions.json#/Pet"
+}
+
+

+$ref: definitions.yaml#/Pet
+
+

Schema Object

+

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 an extended subset of the JSON Schema Specification Wright Draft 00.

+

For more information about the properties, see JSON Schema Core and JSON Schema Validation. +Unless stated otherwise, the property definitions follow the JSON Schema.

+

Properties

+

The following properties are taken directly from the JSON Schema definition and follow the same specifications:

+
    +
  • title
  • +
  • multipleOf
  • +
  • maximum
  • +
  • exclusiveMaximum
  • +
  • minimum
  • +
  • exclusiveMinimum
  • +
  • maxLength
  • +
  • minLength
  • +
  • pattern (This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect)
  • +
  • maxItems
  • +
  • minItems
  • +
  • uniqueItems
  • +
  • maxProperties
  • +
  • minProperties
  • +
  • required
  • +
  • enum
  • +
+

The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification.

+
    +
  • type - Value MUST be a string. Multiple types via an array are not supported.
  • +
  • allOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
  • +
  • oneOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
  • +
  • anyOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
  • +
  • not - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
  • +
  • items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. items MUST be present if the type is array.
  • +
  • properties - Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced).
  • +
  • additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
  • +
  • description - CommonMark syntax MAY be used for rich text representation.
  • +
  • format - See Data Type Formats for further details. While relying on JSON Schema’s defined formats, the OAS offers a few additional predefined formats.
  • +
  • default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if type is string, then default can be "foo" but cannot be 1.
  • +
+

Alternatively, any time a Schema Object can be used, a Reference Object can be used in its place. This allows referencing definitions instead of defining them inline.

+

Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported.

+

Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation:

+
Fixed Fields
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
nullablebooleanAllows sending a null value for the defined schema. Default value is false.
discriminatorDiscriminator ObjectAdds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See Composition and Inheritance for more details.
readOnlybooleanRelevant only for Schema "properties" definitions. Declares the property as “read only”. This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.
writeOnlybooleanRelevant only for Schema "properties" definitions. Declares the property as “write only”. Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as writeOnly being true and is in the required list, the required will take effect on the request only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.
xmlXML ObjectThis MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property.
externalDocsExternal Documentation ObjectAdditional external documentation for this schema.
exampleAnyA free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary.
deprecatedbooleanSpecifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false.
+

This object MAY be extended with Specification Extensions.

+
Composition and Inheritance (Polymorphism)
+

The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. +allOf takes an array of object definitions that are validated independently but together compose a single object.

+

While composition offers model extensibility, it does not imply a hierarchy between the models. +To support polymorphism, the OpenAPI Specification adds the discriminator field. +When used, the discriminator will be the name of the property that decides which schema definition validates the structure of the model. +As such, the discriminator field MUST be a required field. +There are are two ways to define the value of a discriminator for an inheriting instance.

+
    +
  • Use the schema name.
  • +
  • Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name.
  • +
+

As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism.

+
XML Modeling
+

The xml property allows extra definitions when translating the JSON definition to XML. +The XML Object contains additional information about the available options.

+
Schema Object Examples
+
Primitive Sample
+

+{
+  "type": "string",
+  "format": "email"
+}
+
+

+type: string
+format: email
+
+
Simple Model
+

+{
+  "type": "object",
+  "required": [
+    "name"
+  ],
+  "properties": {
+    "name": {
+      "type": "string"
+    },
+    "address": {
+      "$ref": "#/components/schemas/Address"
+    },
+    "age": {
+      "type": "integer",
+      "format": "int32",
+      "minimum": 0
+    }
+  }
+}
+
+

+type: object
+required:
+- name
+properties:
+  name:
+    type: string
+  address:
+    $ref: '#/components/schemas/Address'
+  age:
+    type: integer
+    format: int32
+    minimum: 0
+
+
Model with Map/Dictionary Properties
+

For a simple string to string mapping:

+

+{
+  "type": "object",
+  "additionalProperties": {
+    "type": "string"
+  }
+}
+
+

+type: object
+additionalProperties:
+  type: string
+
+

For a string to model mapping:

+

+{
+  "type": "object",
+  "additionalProperties": {
+    "$ref": "#/components/schemas/ComplexModel"
+  }
+}
+
+

+type: object
+additionalProperties:
+  $ref: '#/components/schemas/ComplexModel'
+
+
Model with Example
+

+{
+  "type": "object",
+  "properties": {
+    "id": {
+      "type": "integer",
+      "format": "int64"
+    },
+    "name": {
+      "type": "string"
+    }
+  },
+  "required": [
+    "name"
+  ],
+  "example": {
+    "name": "Puma",
+    "id": 1
+  }
+}
+
+

+type: object
+properties:
+  id:
+    type: integer
+    format: int64
+  name:
+    type: string
+required:
+- name
+example:
+  name: Puma
+  id: 1
+
+
Models with Composition
+

+{
+  "components": {
+    "schemas": {
+      "ErrorModel": {
+        "type": "object",
+        "required": [
+          "message",
+          "code"
+        ],
+        "properties": {
+          "message": {
+            "type": "string"
+          },
+          "code": {
+            "type": "integer",
+            "minimum": 100,
+            "maximum": 600
+          }
+        }
+      },
+      "ExtendedErrorModel": {
+        "allOf": [
+          {
+            "$ref": "#/components/schemas/ErrorModel"
+          },
+          {
+            "type": "object",
+            "required": [
+              "rootCause"
+            ],
+            "properties": {
+              "rootCause": {
+                "type": "string"
+              }
+            }
+          }
+        ]
+      }
+    }
+  }
+}
+
+

+components:
+  schemas:
+    ErrorModel:
+      type: object
+      required:
+      - message
+      - code
+      properties:
+        message:
+          type: string
+        code:
+          type: integer
+          minimum: 100
+          maximum: 600
+    ExtendedErrorModel:
+      allOf:
+      - $ref: '#/components/schemas/ErrorModel'
+      - type: object
+        required:
+        - rootCause
+        properties:
+          rootCause:
+            type: string
+
+
Models with Polymorphism Support
+

+{
+  "components": {
+    "schemas": {
+      "Pet": {
+        "type": "object",
+        "discriminator": {
+          "propertyName": "petType"
+        },
+        "properties": {
+          "name": {
+            "type": "string"
+          },
+          "petType": {
+            "type": "string"
+          }
+        },
+        "required": [
+          "name",
+          "petType"
+        ]
+      },
+      "Cat": {
+        "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.",
+        "allOf": [
+          {
+            "$ref": "#/components/schemas/Pet"
+          },
+          {
+            "type": "object",
+            "properties": {
+              "huntingSkill": {
+                "type": "string",
+                "description": "The measured skill for hunting",
+                "default": "lazy",
+                "enum": [
+                  "clueless",
+                  "lazy",
+                  "adventurous",
+                  "aggressive"
+                ]
+              }
+            },
+            "required": [
+              "huntingSkill"
+            ]
+          }
+        ]
+      },
+      "Dog": {
+        "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.",
+        "allOf": [
+          {
+            "$ref": "#/components/schemas/Pet"
+          },
+          {
+            "type": "object",
+            "properties": {
+              "packSize": {
+                "type": "integer",
+                "format": "int32",
+                "description": "the size of the pack the dog is from",
+                "default": 0,
+                "minimum": 0
+              }
+            },
+            "required": [
+              "packSize"
+            ]
+          }
+        ]
+      }
+    }
+  }
+}
+
+

+components:
+  schemas:
+    Pet:
+      type: object
+      discriminator:
+        propertyName: petType
+      properties:
+        name:
+          type: string
+        petType:
+          type: string
+      required:
+      - name
+      - petType
+    Cat:  ## "Cat" will be used as the discriminator value
+      description: A representation of a cat
+      allOf:
+      - $ref: '#/components/schemas/Pet'
+      - type: object
+        properties:
+          huntingSkill:
+            type: string
+            description: The measured skill for hunting
+            enum:
+            - clueless
+            - lazy
+            - adventurous
+            - aggressive
+        required:
+        - huntingSkill
+    Dog:  ## "Dog" will be used as the discriminator value
+      description: A representation of a dog
+      allOf:
+      - $ref: '#/components/schemas/Pet'
+      - type: object
+        properties:
+          packSize:
+            type: integer
+            format: int32
+            description: the size of the pack the dog is from
+            default: 0
+            minimum: 0
+        required:
+        - packSize
+
+

Discriminator Object

+

When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

+

When using the discriminator, inline schemas will not be considered.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
propertyNamestringREQUIRED. The name of the property in the payload that will hold the discriminator value.
mappingMap[string, string]An object to hold mappings between payload values and schema names or references.
+

The discriminator attribute is legal only when using one of the composite keywords oneOf, anyOf, allOf.

+

In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:

+

+MyResponseType:
+  oneOf:
+  - $ref: '#/components/schemas/Cat'
+  - $ref: '#/components/schemas/Dog'
+  - $ref: '#/components/schemas/Lizard'
+
+

which means the payload MUST, by validation, match exactly one of the schemas described by Cat, Dog, or Lizard. In this case, a discriminator MAY act as a “hint” to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use:

+

+MyResponseType:
+  oneOf:
+  - $ref: '#/components/schemas/Cat'
+  - $ref: '#/components/schemas/Dog'
+  - $ref: '#/components/schemas/Lizard'
+  discriminator:
+    propertyName: pet_type
+
+

The expectation now is that a property with name pet_type MUST be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload:

+

+{
+  "id": 12345,
+  "pet_type": "Cat"
+}
+
+

Will indicate that the Cat schema be used in conjunction with this payload.

+

In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional mapping definition MAY be used:

+

+MyResponseType:
+  oneOf:
+  - $ref: '#/components/schemas/Cat'
+  - $ref: '#/components/schemas/Dog'
+  - $ref: '#/components/schemas/Lizard'
+  - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json'
+  discriminator:
+    propertyName: pet_type
+    mapping:
+      dog: '#/components/schemas/Dog'
+      monster: 'https://gigantic-server.com/schemas/Monster/schema.json'
+
+

Here the discriminator value of dog will map to the schema #/components/schemas/Dog, rather than the default (implicit) value of Dog. If the discriminator value does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison.

+

When used in conjunction with the anyOf construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload.

+

In both the oneOf and anyOf use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an allOf construct may be used as an alternate schema.

+

For example:

+

+components:
+  schemas:
+    Pet:
+      type: object
+      required:
+      - pet_type
+      properties:
+        pet_type:
+          type: string
+      discriminator:
+        propertyName: pet_type
+        mapping:
+          cachorro: Dog
+    Cat:
+      allOf:
+      - $ref: '#/components/schemas/Pet'
+      - type: object
+        # all other properties specific to a `Cat`
+        properties:
+          name:
+            type: string
+    Dog:
+      allOf:
+      - $ref: '#/components/schemas/Pet'
+      - type: object
+        # all other properties specific to a `Dog`
+        properties:
+          bark:
+            type: string
+    Lizard:
+      allOf:
+      - $ref: '#/components/schemas/Pet'
+      - type: object
+        # all other properties specific to a `Lizard`
+        properties:
+          lovesRocks:
+            type: boolean
+
+

a payload like this:

+

+{
+  "pet_type": "Cat",
+  "name": "misty"
+}
+
+

will indicate that the Cat schema be used. Likewise this schema:

+

+{
+  "pet_type": "cachorro",
+  "bark": "soft"
+}
+
+

will map to Dog because of the definition in the mappings element.

+

XML Object

+

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.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
namestringReplaces the name of the element/attribute used for the described schema property. When defined within 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.
namespacestringThe URI of the namespace definition. Value MUST be in the form of an absolute URI.
prefixstringThe prefix to be used for the name.
attributebooleanDeclares whether the property definition translates to an attribute instead of an element. Default value is false.
wrappedbooleanMAY 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).
+

This object MAY be extended with Specification Extensions.

+
XML Object Examples
+

The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

+
No XML Element
+

Basic string property:

+

+{
+    "animals": {
+        "type": "string"
+    }
+}
+
+

+animals:
+  type: string
+
+

+<animals>...</animals>
+
+

Basic string array property (wrapped is false by default):

+

+{
+    "animals": {
+        "type": "array",
+        "items": {
+            "type": "string"
+        }
+    }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+
+

+<animals>...</animals>
+<animals>...</animals>
+<animals>...</animals>
+
+
XML Name Replacement
+

+{
+  "animals": {
+    "type": "string",
+    "xml": {
+      "name": "animal"
+    }
+  }
+}
+
+

+animals:
+  type: string
+  xml:
+    name: animal
+
+

+<animal>...</animal>
+
+
XML Attribute, Prefix and Namespace
+

In this example, a full model definition is shown.

+

+{
+  "Person": {
+    "type": "object",
+    "properties": {
+      "id": {
+        "type": "integer",
+        "format": "int32",
+        "xml": {
+          "attribute": true
+        }
+      },
+      "name": {
+        "type": "string",
+        "xml": {
+          "namespace": "http://example.com/schema/sample",
+          "prefix": "sample"
+        }
+      }
+    }
+  }
+}
+
+

+Person:
+  type: object
+  properties:
+    id:
+      type: integer
+      format: int32
+      xml:
+        attribute: true
+    name:
+      type: string
+      xml:
+        namespace: http://example.com/schema/sample
+        prefix: sample
+
+

+<Person id="123">
+    <sample:name xmlns:sample="http://example.com/schema/sample">example</sample:name>
+</Person>
+
+
XML Arrays
+

Changing the element names:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+
+

+<animal>value</animal>
+<animal>value</animal>
+
+

The external name property has no effect on the XML:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    },
+    "xml": {
+      "name": "aliens"
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+  xml:
+    name: aliens
+
+

+<animal>value</animal>
+<animal>value</animal>
+
+

Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    },
+    "xml": {
+      "wrapped": true
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+  xml:
+    wrapped: true
+
+

+<animals>
+  <animals>value</animals>
+  <animals>value</animals>
+</animals>
+
+

To overcome the naming problem in the example above, the following definition can be used:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    },
+    "xml": {
+      "wrapped": true
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+  xml:
+    wrapped: true
+
+

+<animals>
+  <animal>value</animal>
+  <animal>value</animal>
+</animals>
+
+

Affecting both internal and external names:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    },
+    "xml": {
+      "name": "aliens",
+      "wrapped": true
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+  xml:
+    name: aliens
+    wrapped: true
+
+

+<aliens>
+  <animal>value</animal>
+  <animal>value</animal>
+</aliens>
+
+

If we change the external element but not the internal ones:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    },
+    "xml": {
+      "name": "aliens",
+      "wrapped": true
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+  xml:
+    name: aliens
+    wrapped: true
+
+

+<aliens>
+  <aliens>value</aliens>
+  <aliens>value</aliens>
+</aliens>
+
+

Security Scheme Object

+

Defines a security scheme that can be used by the operations. +Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [[!rfc6749]], and OpenID Connect Discovery.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeApplies ToDescription
typestringAnyREQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "oauth2", "openIdConnect".
descriptionstringAnyA short description for security scheme. CommonMark syntax MAY be used for rich text representation.
namestringapiKeyREQUIRED. The name of the header, query or cookie parameter to be used.
instringapiKeyREQUIRED. The location of the API key. Valid values are "query", "header" or "cookie".
schemestringhttpREQUIRED. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235]section-5.1).
bearerFormatstringhttp ("bearer")A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes.
flowsOAuth Flows Objectoauth2REQUIRED. An object containing configuration information for the flow types supported.
openIdConnectUrlstringopenIdConnectREQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL.
+

This object MAY be extended with Specification Extensions.

+
Security Scheme Object Example
+
Basic Authentication Sample
+

+{
+  "type": "http",
+  "scheme": "basic"
+}
+
+

+type: http
+scheme: basic
+
+
API Key Sample
+

+{
+  "type": "apiKey",
+  "name": "api_key",
+  "in": "header"
+}
+
+

+type: apiKey
+name: api_key
+in: header
+
+
JWT Bearer Sample
+

+{
+  "type": "http",
+  "scheme": "bearer",
+  "bearerFormat": "JWT",
+}
+
+

+type: http
+scheme: bearer
+bearerFormat: JWT
+
+
Implicit OAuth2 Sample
+

+{
+  "type": "oauth2",
+  "flows": {
+    "implicit": {
+      "authorizationUrl": "https://example.com/api/oauth/dialog",
+      "scopes": {
+        "write:pets": "modify pets in your account",
+        "read:pets": "read your pets"
+      }
+    }
+  }
+}
+
+

+type: oauth2
+flows: 
+  implicit:
+    authorizationUrl: https://example.com/api/oauth/dialog
+    scopes:
+      write:pets: modify pets in your account
+      read:pets: read your pets
+
+

OAuth Flows Object

+

Allows configuration of the supported OAuth Flows.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
implicitOAuth Flow ObjectConfiguration for the OAuth Implicit flow
passwordOAuth Flow ObjectConfiguration for the OAuth Resource Owner Password flow
clientCredentialsOAuth Flow ObjectConfiguration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0.
authorizationCodeOAuth Flow ObjectConfiguration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.
+

This object MAY be extended with Specification Extensions.

+

OAuth Flow Object

+

Configuration details for a supported OAuth Flow

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeApplies ToDescription
authorizationUrlstringoauth2 ("implicit", "authorizationCode")REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL.
tokenUrlstringoauth2 ("password", "clientCredentials", "authorizationCode")REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL.
refreshUrlstringoauth2The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.
scopesMap[string, string]oauth2REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it.
+

This object MAY be extended with Specification Extensions.

+
OAuth Flow Object Examples
+

+{
+  "type": "oauth2",
+  "flows": {
+    "implicit": {
+      "authorizationUrl": "https://example.com/api/oauth/dialog",
+      "scopes": {
+        "write:pets": "modify pets in your account",
+        "read:pets": "read your pets"
+      }
+    },
+    "authorizationCode": {
+      "authorizationUrl": "https://example.com/api/oauth/dialog",
+      "tokenUrl": "https://example.com/api/oauth/token",
+      "scopes": {
+        "write:pets": "modify pets in your account",
+        "read:pets": "read your pets"
+      }
+    }
+  }
+}
+
+

+type: oauth2
+flows: 
+  implicit:
+    authorizationUrl: https://example.com/api/oauth/dialog
+    scopes:
+      write:pets: modify pets in your account
+      read:pets: read your pets
+  authorizationCode:
+    authorizationUrl: https://example.com/api/oauth/dialog
+    tokenUrl: https://example.com/api/oauth/token
+    scopes:
+      write:pets: modify pets in your account
+      read:pets: read your pets 
+
+

Security Requirement Object

+

Lists the required security schemes to execute this operation. +The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.

+

Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. +This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.

+

When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.

+

Patterned Fields

+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
{name}[string]Each name MUST correspond to a security scheme which is declared in the Security Schemes under the Components Object. If the security scheme is of type "oauth2" or "openIdConnect", then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty.
+
Security Requirement Object Examples
+
Non-OAuth2 Security Requirement
+

+{
+  "api_key": []
+}
+
+

+api_key: []
+
+
OAuth2 Security Requirement
+

+{
+  "petstore_auth": [
+    "write:pets",
+    "read:pets"
+  ]
+}
+
+

+petstore_auth:
+- write:pets
+- read:pets
+
+

Specification Extensions

+

While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

+

The extensions properties are implemented as patterned fields that are always prefixed by "x-".

+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
^x-AnyAllows extensions to the OpenAPI Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. 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).

+

Security Filtering

+

Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.

+

The reasoning is to allow an additional layer of access control over the documentation. +While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.

+

Two examples of this:

+
    +
  1. The Paths Object MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication.
  2. +
  3. The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object, so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see.
  4. +
+

Appendix A: Revision History

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VersionDateNotes
3.0.02017-07-26Release of the OpenAPI Specification 3.0.0
3.0.0-rc22017-06-16rc2 of the 3.0 specification
3.0.0-rc12017-04-27rc1 of the 3.0 specification
3.0.0-rc02017-02-28Implementer’s Draft of the 3.0 specification
2.02015-12-31Donation of Swagger 2.0 to the Open API Initiative
2.02014-09-08Release of Swagger 2.0
1.22014-03-14Initial release of the formal document.
1.12012-08-22Release of Swagger 1.1
1.02011-08-10First release of the Swagger Specification
+ diff --git a/bikeshed/3.0.0.md b/bikeshed/3.0.0.md new file mode 100644 index 0000000000..e47f28c13f --- /dev/null +++ b/bikeshed/3.0.0.md @@ -0,0 +1,3389 @@ +# OpenAPI Specification + +#### Version 3.0.0 + +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [BCP 14](https://tools.ietf.org/html/bcp14) [RFC2119](https://tools.ietf.org/html/rfc2119) [RFC8174](https://tools.ietf.org/html/rfc8174) when, and only when, they appear in all capitals, as shown here. + +This document is licensed under [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). + +## Introduction + +The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. + +An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases. + +## Definitions + +##### OpenAPI Document +A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification. + +##### Path Templating +Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. + +##### Media Types +Media type definitions are spread across several resources. +The media type definitions SHOULD be in compliance with [RFC6838](http://tools.ietf.org/html/rfc6838). + +Some examples of possible media type definitions: +``` + text/plain; charset=utf-8 + application/json + application/vnd.github+json + application/vnd.github.v3+json + application/vnd.github.v3.raw+json + application/vnd.github.v3.text+json + application/vnd.github.v3.html+json + application/vnd.github.v3.full+json + application/vnd.github.v3.diff + application/vnd.github.v3.patch +``` +##### HTTP Status Codes +The HTTP Status Codes are used to indicate the status of the executed operation. +The available status codes are defined by [RFC7231](http://tools.ietf.org/html/rfc7231#section-6) and registered status codes are listed in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). + +## Specification + +### Versions + +The OpenAPI Specification is versioned using [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.html) (semver) and follows the semver specification. + +The `major`.`minor` portion of the semver (for example `3.0`) SHALL designate the OAS feature set. Typically, *`.patch`* versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.\* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between `3.0.0` and `3.0.1` for example. + +Subsequent minor version releases of the OpenAPI Specification (incrementing the `minor` version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical `3.1.0` specification SHOULD be usable with tooling designed for `3.0.0`. + +An OpenAPI document compatible with OAS 3.\*.\* contains a required [`openapi`](#oasVersion) field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named [`swagger`](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swaggerObject) and value `"2.0"`.) + +### Format + +An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format. + +For example, if a field has an array value, the JSON array representation will be used: + +```json +{ + "field": [ 1, 2, 3 ] +} +``` +All field names in the specification are **case sensitive**. + +The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. + +Patterned fields MUST have unique names within the containing object. + +In order to preserve the ability to round-trip between YAML and JSON formats, YAML version [1.2](http://www.yaml.org/spec/1.2/spec.html) is RECOMMENDED along with some additional constraints: + +- Tags MUST be limited to those allowed by the [JSON Schema ruleset](http://www.yaml.org/spec/1.2/spec.html#id2803231). +- Keys used in YAML maps MUST be limited to a scalar string, as defined by the [YAML Failsafe schema ruleset](http://yaml.org/spec/1.2/spec.html#id2802346). + +**Note:** While APIs may be defined by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML. + +### Document Structure + +An OpenAPI document MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the user. In the latter case, `$ref` fields MUST be used in the specification to reference those parts as follows from the [JSON Schema](http://json-schema.org) definitions. + +It is RECOMMENDED that the root OpenAPI document be named: `openapi.json` or `openapi.yaml`. + +### Data Types + +Primitive data types in the OAS are based on the types supported by the [JSON Schema Specification Wright Draft 00](https://tools.ietf.org/html/draft-wright-json-schema-00#section-4.2). +Note that `integer` as a type is also supported and is defined as a JSON number without a fraction or exponent part. +`null` is not supported as a type (see [`nullable`](#schemaNullable) for an alternative solution). +Models are defined using the [Schema Object](#schemaObject), which is an extended subset of JSON Schema Specification Wright Draft 00. + +Primitives have an optional modifier property: `format`. +OAS uses several known formats to define in fine detail the data type being used. +However, to support documentation needs, the `format` property is an open `string`-valued property, and can have any value. +Formats such as `"email"`, `"uuid"`, and so on, MAY be used even though undefined by this specification. +Types that are not accompanied by a `format` property follow the type definition in the JSON Schema. Tools that do not recognize a specific `format` MAY default back to the `type` alone, as if the `format` is not specified. + +The formats defined by the OAS are: + +Common Name | [`type`](#dataTypes) | [`format`](#dataTypeFormat) | Comments +----------- | ------ | -------- | -------- +integer | `integer` | `int32` | signed 32 bits +long | `integer` | `int64` | signed 64 bits +float | `number` | `float` | | +double | `number` | `double` | | +string | `string` | | | +byte | `string` | `byte` | base64 encoded characters +binary | `string` | `binary` | any sequence of octets +boolean | `boolean` | | | +date | `string` | `date` | As defined by `full-date` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) +dateTime | `string` | `date-time` | As defined by `date-time` - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) +password | `string` | `password` | A hint to UIs to obscure input. + +### Rich Text Formatting +Throughout the specification `description` fields are noted as supporting CommonMark markdown formatting. +Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by [CommonMark 0.27](http://spec.commonmark.org/0.27/). Tooling MAY choose to ignore some CommonMark features to address security concerns. + +### Relative References in URLs + +Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-4.2). +Relative references are resolved using the URLs defined in the [`Server Object`](#serverObject) as a Base URI. + +Relative references used in `$ref` are processed as per [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03), using the URL of the current document as the base URI. See also the [Reference Object](#referenceObject). + +### Schema + +In the following description, if a field is not explicitly **REQUIRED** or described with a MUST or SHALL, it can be considered OPTIONAL. + +#### OpenAPI Object + +This is the root document object of the [OpenAPI document](#oasDocument). + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +openapi | `string` | **REQUIRED**. This string MUST be the [semantic version number](http://semver.org/spec/v2.0.0.html) of the [OpenAPI Specification version](#versions) that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is *not* related to the API [`info.version`](#infoVersion) string. +info | [Info Object](#infoObject) | **REQUIRED**. Provides metadata about the API. The metadata MAY be used by tooling as required. +servers | [[Server Object](#serverObject)] | An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`. +paths | [Paths Object](#pathsObject) | **REQUIRED**. The available paths and operations for the API. +components | [Components Object](#componentsObject) | An element to hold various schemas for the specification. +security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. +tags | [[Tag Object](#tagObject)] | 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](#operationObject) 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. +externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +#### Info Object + +The object provides metadata about the API. +The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +title | `string` | **REQUIRED**. The title of the application. +description | `string` | A short description of the application. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +termsOfService | `string` | A URL to the Terms of Service for the API. MUST be in the format of a URL. +contact | [Contact Object](#contactObject) | The contact information for the exposed API. +license | [License Object](#licenseObject) | The license information for the exposed API. +version | `string` | **REQUIRED**. The version of the OpenAPI document (which is distinct from the [OpenAPI Specification version](#oasVersion) or the API implementation version). + + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Info Object Example: + +```json +{ + "title": "Sample Pet Store App", + "description": "This is a sample server for a pet store.", + "termsOfService": "http://example.com/terms/", + "contact": { + "name": "API Support", + "url": "http://www.example.com/support", + "email": "support@example.com" + }, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + }, + "version": "1.0.1" +} +``` + +```yaml +title: Sample Pet Store App +description: This is a sample server for a pet store. +termsOfService: http://example.com/terms/ +contact: + name: API Support + url: http://www.example.com/support + email: support@example.com +license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html +version: 1.0.1 +``` + +#### Contact Object + +Contact information for the exposed API. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +name | `string` | The identifying name of the contact person/organization. +url | `string` | The URL pointing to the contact information. MUST be in the format of a URL. +email | `string` | The email address of the contact person/organization. MUST be in the format of an email address. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Contact Object Example: + +```json +{ + "name": "API Support", + "url": "http://www.example.com/support", + "email": "support@example.com" +} +``` + +```yaml +name: API Support +url: http://www.example.com/support +email: support@example.com +``` + +#### License Object + +License information for the exposed API. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +name | `string` | **REQUIRED**. The license name used for the API. +url | `string` | A URL to the license used for the API. MUST be in the format of a URL. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### License Object Example: + +```json +{ + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" +} +``` + +```yaml +name: Apache 2.0 +url: http://www.apache.org/licenses/LICENSE-2.0.html +``` + +#### Server Object + +An object representing a Server. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +url | `string` | **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in `{`brackets`}`. +description | `string` | An optional string describing the host designated by the URL. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +variables | Map[`string`, [Server Variable Object](#serverVariableObject)] | A map between a variable name and its value. The value is used for substitution in the server's URL template. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Server Object Example + +A single server would be described as: + +```json +{ + "url": "https://development.gigantic-server.com/v1", + "description": "Development server" +} +``` + +```yaml +url: https://development.gigantic-server.com/v1 +description: Development server +``` + +The following shows how multiple servers can be described, for example, at the OpenAPI Object's [`servers`](#oasServers): + +```json +{ + "servers": [ + { + "url": "https://development.gigantic-server.com/v1", + "description": "Development server" + }, + { + "url": "https://staging.gigantic-server.com/v1", + "description": "Staging server" + }, + { + "url": "https://api.gigantic-server.com/v1", + "description": "Production server" + } + ] +} +``` + +```yaml +servers: +- url: https://development.gigantic-server.com/v1 + description: Development server +- url: https://staging.gigantic-server.com/v1 + description: Staging server +- url: https://api.gigantic-server.com/v1 + description: Production server +``` + +The following shows how variables can be used for a server configuration: + +```json +{ + "servers": [ + { + "url": "https://{username}.gigantic-server.com:{port}/{basePath}", + "description": "The production API server", + "variables": { + "username": { + "default": "demo", + "description": "this value is assigned by the service provider, in this example `gigantic-server.com`" + }, + "port": { + "enum": [ + "8443", + "443" + ], + "default": "8443" + }, + "basePath": { + "default": "v2" + } + } + } + ] +} +``` + +```yaml +servers: +- url: https://{username}.gigantic-server.com:{port}/{basePath} + description: The production API server + variables: + username: + # note! no enum here means it is an open value + default: demo + description: this value is assigned by the service provider, in this example `gigantic-server.com` + port: + enum: + - '8443' + - '443' + default: '8443' + basePath: + # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2` + default: v2 +``` + + +#### Server Variable Object + +An object representing a Server Variable for server URL template substitution. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +enum | [`string`] | An enumeration of string values to be used if the substitution options are from a limited set. +default | `string` | **REQUIRED**. The default value to use for substitution, and to send, if an alternate value is _not_ supplied. Unlike the [Schema Object's](#schemaObject) `default`, this value MUST be provided by the consumer. +description | `string` | An optional description for the server variable. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +#### Components Object + +Holds a set of reusable objects for different aspects of the OAS. +All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. + + +##### Fixed Fields + +Field Name | Type | Description +---|:---|--- + schemas | Map[`string`, [Schema Object](#schemaObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Schema Objects](#schemaObject). + responses | Map[`string`, [Response Object](#responseObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Response Objects](#responseObject). + parameters | Map[`string`, [Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Parameter Objects](#parameterObject). + examples | Map[`string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Example Objects](#exampleObject). + requestBodies | Map[`string`, [Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Request Body Objects](#requestBodyObject). + headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Header Objects](#headerObject). + securitySchemes| Map[`string`, [Security Scheme Object](#securitySchemeObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Security Scheme Objects](#securitySchemeObject). + links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Link Objects](#linkObject). + callbacks | Map[`string`, [Callback Object](#callbackObject) \| [Reference Object](#referenceObject)] | An object to hold reusable [Callback Objects](#callbackObject). + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +All the fixed fields declared above are objects that MUST use keys that match the regular expression: `^[a-zA-Z0-9\.\-_]+$`. + +Field Name Examples: + +``` +User +User_1 +User_Name +user-name +my.org.User +``` + +##### Components Object Example + +```json +"components": { + "schemas": { + "Category": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + } + }, + "Tag": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + } + } + }, + "parameters": { + "skipParam": { + "name": "skip", + "in": "query", + "description": "number of items to skip", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + }, + "limitParam": { + "name": "limit", + "in": "query", + "description": "max records to return", + "required": true, + "schema" : { + "type": "integer", + "format": "int32" + } + } + }, + "responses": { + "NotFound": { + "description": "Entity not found." + }, + "IllegalInput": { + "description": "Illegal input for operation." + }, + "GeneralError": { + "description": "General Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GeneralError" + } + } + } + } + }, + "securitySchemes": { + "api_key": { + "type": "apiKey", + "name": "api_key", + "in": "header" + }, + "petstore_auth": { + "type": "oauth2", + "flows": { + "implicit": { + "authorizationUrl": "http://example.org/api/oauth/dialog", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + } + } + } +} +``` + +```yaml +components: + schemas: + Category: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + Tag: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + parameters: + skipParam: + name: skip + in: query + description: number of items to skip + required: true + schema: + type: integer + format: int32 + limitParam: + name: limit + in: query + description: max records to return + required: true + schema: + type: integer + format: int32 + responses: + NotFound: + description: Entity not found. + IllegalInput: + description: Illegal input for operation. + GeneralError: + description: General Error + content: + application/json: + schema: + $ref: '#/components/schemas/GeneralError' + securitySchemes: + api_key: + type: apiKey + name: api_key + in: header + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://example.org/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets +``` + + +#### Paths Object + +Holds the relative paths to the individual endpoints and their operations. +The path is appended to the URL from the [`Server Object`](#serverObject) in order to construct the full URL. The Paths MAY be empty, due to [ACL constraints](#securityFiltering). + +##### Patterned Fields + +Field Pattern | Type | Description +---|:---:|--- +/{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a slash. The path is **appended** (no relative URL resolution) to the expanded URL from the [`Server Object`](#serverObject)'s `url` field in order to construct the full URL. [Path templating](#pathTemplating) is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it's up to the tooling to decide which one to use. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Path Templating Matching + +Assuming the following paths, the concrete definition, `/pets/mine`, will be matched first if used: + +``` + /pets/{petId} + /pets/mine +``` + +The following paths are considered identical and invalid: + +``` + /pets/{petId} + /pets/{name} +``` + +The following may lead to ambiguous resolution: + +``` + /{entity}/me + /books/{id} +``` + +##### Paths Object Example + +```json +{ + "/pets": { + "get": { + "description": "Returns all pets from the system that the user has access to", + "responses": { + "200": { + "description": "A list of pets.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/pet" + } + } + } + } + } + } + } + } +} +``` + +```yaml +/pets: + get: + description: Returns all pets from the system that the user has access to + responses: + '200': + description: A list of pets. + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/pet' +``` + +#### Path Item Object + +Describes the operations available on a single path. +A Path Item MAY be empty, due to [ACL constraints](#securityFiltering). +The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +$ref | `string` | Allows for an external definition of this path item. The referenced structure MUST be in the format of a [Path Item Object](#pathItemObject). If there are conflicts between the referenced definition and this Path Item's definition, the behavior is *undefined*. +summary| `string` | An optional, string summary, intended to apply to all operations in this path. +description | `string` | An optional, string description, intended to apply to all operations in this path. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +get | [Operation Object](#operationObject) | A definition of a GET operation on this path. +put | [Operation Object](#operationObject) | A definition of a PUT operation on this path. +post | [Operation Object](#operationObject) | A definition of a POST operation on this path. +delete | [Operation Object](#operationObject) | A definition of a DELETE operation on this path. +options | [Operation Object](#operationObject) | A definition of a OPTIONS operation on this path. +head | [Operation Object](#operationObject) | A definition of a HEAD operation on this path. +patch | [Operation Object](#operationObject) | A definition of a PATCH operation on this path. +trace | [Operation Object](#operationObject) | A definition of a TRACE operation on this path. +servers | [[Server Object](#serverObject)] | An alternative `server` array to service all operations in this path. +parameters | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | 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](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). + + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Path Item Object Example + +```json +{ + "get": { + "description": "Returns pets based on ID", + "summary": "Find pets by ID", + "operationId": "getPetsById", + "responses": { + "200": { + "description": "pet response", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Pet" + } + } + } + } + }, + "default": { + "description": "error payload", + "content": { + "text/html": { + "schema": { + "$ref": "#/components/schemas/ErrorModel" + } + } + } + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of pet to use", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "string" + } + }, + "style": "simple" + } + ] +} +``` + +```yaml +get: + description: Returns pets based on ID + summary: Find pets by ID + operationId: getPetsById + responses: + '200': + description: pet response + content: + '*/*' : + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + default: + description: error payload + content: + 'text/html': + schema: + $ref: '#/components/schemas/ErrorModel' +parameters: +- name: id + in: path + description: ID of pet to use + required: true + schema: + type: array + style: simple + items: + type: string +``` + +#### Operation Object + +Describes a single API operation on a path. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +tags | [`string`] | A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. +summary | `string` | A short summary of what the operation does. +description | `string` | A verbose explanation of the operation behavior. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this operation. +operationId | `string` | 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 | [[Parameter Object](#parameterObject) \| [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), 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](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#componentsParameters). +requestBody | [Request Body Object](#requestBodyObject) \| [Reference Object](#referenceObject) | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` SHALL be ignored by consumers. +responses | [Responses Object](#responsesObject) | **REQUIRED**. The list of possible responses as they are returned from executing this operation. +callbacks | Map[`string`, [Callback Object](#callbackObject) \| [Reference Object](#referenceObject)] | A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a [Callback Object](#callbackObject) that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. +deprecated | `boolean` | Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is `false`. +security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used. +servers | [[Server Object](#serverObject)] | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Operation Object Example + +```json +{ + "tags": [ + "pet" + ], + "summary": "Updates a pet in the store with form data", + "operationId": "updatePetWithForm", + "parameters": [ + { + "name": "petId", + "in": "path", + "description": "ID of pet that needs to be updated", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "type": "object", + "properties": { + "name": { + "description": "Updated name of the pet", + "type": "string" + }, + "status": { + "description": "Updated status of the pet", + "type": "string" + } + }, + "required": ["status"] + } + } + } + }, + "responses": { + "200": { + "description": "Pet updated.", + "content": { + "application/json": {}, + "application/xml": {} + } + }, + "405": { + "description": "Invalid input", + "content": { + "application/json": {}, + "application/xml": {} + } + } + }, + "security": [ + { + "petstore_auth": [ + "write:pets", + "read:pets" + ] + } + ] +} +``` + +```yaml +tags: +- pet +summary: Updates a pet in the store with form data +operationId: updatePetWithForm +parameters: +- name: petId + in: path + description: ID of pet that needs to be updated + required: true + schema: + type: string +requestBody: + content: + 'application/x-www-form-urlencoded': + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + required: + - status +responses: + '200': + description: Pet updated. + content: + 'application/json': {} + 'application/xml': {} + '405': + description: Invalid input + content: + 'application/json': {} + 'application/xml': {} +security: +- petstore_auth: + - write:pets + - read:pets +``` + + +#### External Documentation Object + +Allows referencing an external resource for extended documentation. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +description | `string` | A short description of the target documentation. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +url | `string` | **REQUIRED**. The URL for the target documentation. Value MUST be in the format of a URL. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### External Documentation Object Example + +```json +{ + "description": "Find more info here", + "url": "https://example.com" +} +``` + +```yaml +description: Find more info here +url: https://example.com +``` + +#### Parameter Object + +Describes a single operation parameter. + +A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). + +##### Parameter Locations +There are four possible parameter locations specified by the `in` field: +* path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, the path parameter is `itemId`. +* query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. +* header - Custom headers that are expected as part of the request. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. +* cookie - Used to pass a specific cookie value to the API. + + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +name | `string` | **REQUIRED**. The name of the parameter. Parameter names are *case sensitive*.
  • If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.
  • If [`in`](#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.
  • For all other cases, the `name` corresponds to the parameter name used by the [`in`](#parameterIn) property.
+in | `string` | **REQUIRED**. The location of the parameter. Possible values are "query", "header", "path" or "cookie". +description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameterIn) is "path", this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`. + deprecated | `boolean` | Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. + allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. + +The rules for serialization of the parameter are specified in one of two ways. +For simpler scenarios, a [`schema`](#parameterSchema) and [`style`](#parameterStyle) can describe the structure and syntax of the parameter. + +Field Name | Type | Description +---|:---:|--- +style | `string` | Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`. +explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. +allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. +schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the parameter. +example | Any | Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The `example` object is mutually exclusive of the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary. +examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` object is mutually exclusive of the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. + +For more complex scenarios, the [`content`](#parameterContent) property can define the media type and schema of the parameter. +A parameter MUST contain either a `schema` property, or a `content` property, but not both. +When `example` or `examples` are provided in conjunction with the `schema` object, the example MUST follow the prescribed serialization strategy for the parameter. + + +Field Name | Type | Description +---|:---:|--- +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry. + +##### Style Values + +In order to support common ways of serializing simple parameters, a set of `style` values are defined. + +`style` | [`type`](#dataTypes) | `in` | Comments +----------- | ------ | -------- | -------- +matrix | `primitive`, `array`, `object` | `path` | Path-style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7) +label | `primitive`, `array`, `object` | `path` | Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.5) +form | `primitive`, `array`, `object` | `query`, `cookie` | Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8). This option replaces `collectionFormat` with a `csv` (when `explode` is false) or `multi` (when `explode` is true) value from OpenAPI 2.0. +simple | `array` | `path`, `header` | Simple style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.2). This option replaces `collectionFormat` with a `csv` value from OpenAPI 2.0. +spaceDelimited | `array` | `query` | Space separated array values. This option replaces `collectionFormat` equal to `ssv` from OpenAPI 2.0. +pipeDelimited | `array` | `query` | Pipe separated array values. This option replaces `collectionFormat` equal to `pipes` from OpenAPI 2.0. +deepObject | `object` | `query` | Provides a simple way of rendering nested objects using form parameters. + + +##### Style Examples + +Assume a parameter named `color` has one of the following values: + +``` + string -> "blue" + array -> ["blue","black","brown"] + object -> { "R": 100, "G": 200, "B": 150 } +``` +The following table shows examples of rendering differences for each value. + +[`style`](#dataTypeFormat) | `explode` | `empty` | `string` | `array` | `object` +----------- | ------ | -------- | -------- | --------|------- +matrix | false | ;color | ;color=blue | ;color=blue,black,brown | ;color=R,100,G,200,B,150 +matrix | true | ;color | ;color=blue | ;color=blue;color=black;color=brown | ;R=100;G=200;B=150 +label | false | . | .blue | .blue.black.brown | .R.100.G.200.B.150 +label | true | . | .blue | .blue.black.brown | .R=100.G=200.B=150 +form | false | color= | color=blue | color=blue,black,brown | color=R,100,G,200,B,150 +form | true | color= | color=blue | color=blue&color=black&color=brown | R=100&G=200&B=150 +simple | false | n/a | blue | blue,black,brown | R,100,G,200,B,150 +simple | true | n/a | blue | blue,black,brown | R=100,G=200,B=150 +spaceDelimited | false | n/a | n/a | blue%20black%20brown | R%20100%20G%20200%20B%20150 +pipeDelimited | false | n/a | n/a | blue\|black\|brown | R\|100\|G\|200|G\|150 +deepObject | true | n/a | n/a | n/a | color\[R]=100&color\[G]=200&color\[B]=150 + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Parameter Object Examples + +A header parameter with an array of 64 bit integer numbers: + +```json +{ + "name": "token", + "in": "header", + "description": "token to be passed as a header", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + }, + "style": "simple" +} +``` + +```yaml +name: token +in: header +description: token to be passed as a header +required: true +schema: + type: array + items: + type: integer + format: int64 +style: simple +``` + +A path parameter of a string value: +```json +{ + "name": "username", + "in": "path", + "description": "username to fetch", + "required": true, + "schema": { + "type": "string" + } +} +``` + +```yaml +name: username +in: path +description: username to fetch +required: true +schema: + type: string +``` + +An optional query parameter of a string value, allowing multiple values by repeating the query parameter: +```json +{ + "name": "id", + "in": "query", + "description": "ID of the object to fetch", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + }, + "style": "form", + "explode": true +} +``` + +```yaml +name: id +in: query +description: ID of the object to fetch +required: false +schema: + type: array + items: + type: string +style: form +explode: true +``` + +A free-form query parameter, allowing undefined parameters of a specific type: +```json +{ + "in": "query", + "name": "freeForm", + "schema": { + "type": "object", + "additionalProperties": { + "type": "integer" + }, + }, + "style": "form" +} +``` + +```yaml +in: query +name: freeForm +schema: + type: object + additionalProperties: + type: integer +style: form +``` + +A complex parameter using `content` to define serialization: + +```json +{ + "in": "query", + "name": "coordinates", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "lat", + "long" + ], + "properties": { + "lat": { + "type": "number" + }, + "long": { + "type": "number" + } + } + } + } + } +} +``` + +```yaml +in: query +name: coordinates +content: + application/json: + schema: + type: object + required: + - lat + - long + properties: + lat: + type: number + long: + type: number +``` + +#### Request Body Object + +Describes a single request body. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* +required | `boolean` | Determines if the request body is required in the request. Defaults to `false`. + + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Request Body Examples + +A request body with a referenced model definition. +```json +{ + "description": "user to add to the system", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + }, + "examples": { + "user" : { + "summary": "User Example", + "externalValue": "http://foo.bar/examples/user-example.json" + } + } + }, + "application/xml": { + "schema": { + "$ref": "#/components/schemas/User" + }, + "examples": { + "user" : { + "summary": "User example in XML", + "externalValue": "http://foo.bar/examples/user-example.xml" + } + } + }, + "text/plain": { + "examples": { + "user" : { + "summary": "User example in Plain text", + "externalValue": "http://foo.bar/examples/user-example.txt" + } + } + }, + "*/*": { + "examples": { + "user" : { + "summary": "User example in other format", + "externalValue": "http://foo.bar/examples/user-example.whatever" + } + } + } + } +} +``` + +```yaml +description: user to add to the system +content: + 'application/json': + schema: + $ref: '#/components/schemas/User' + examples: + user: + summary: User Example + externalValue: 'http://foo.bar/examples/user-example.json' + 'application/xml': + schema: + $ref: '#/components/schemas/User' + examples: + user: + summary: User Example in XML + externalValue: 'http://foo.bar/examples/user-example.xml' + 'text/plain': + examples: + user: + summary: User example in text plain format + externalValue: 'http://foo.bar/examples/user-example.txt' + '*/*': + examples: + user: + summary: User example in other format + externalValue: 'http://foo.bar/examples/user-example.whatever' +``` + +A body parameter that is an array of string values: +```json +{ + "description": "user to add to the system", + "content": { + "text/plain": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } +} +``` + +```yaml +description: user to add to the system +required: true +content: + text/plain: + schema: + type: array + items: + type: string +``` + + +#### Media Type Object +Each Media Type Object provides schema and examples for the media type identified by its key. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body. +example | Any | Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` object is mutually exclusive of the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. +examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` object is mutually exclusive of the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema. +encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to `requestBody` objects when the media type is `multipart` or `application/x-www-form-urlencoded`. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Media Type Examples + +```js +{ + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + }, + "examples": { + "cat" : { + "summary": "An example of a cat", + "value": + { + "name": "Fluffy", + "petType": "Cat", + "color": "White", + "gender": "male", + "breed": "Persian" + } + }, + "dog": { + "summary": "An example of a dog with a cat's name", + "value" : { + "name": "Puma", + "petType": "Dog", + "color": "Black", + "gender": "Female", + "breed": "Mixed" + }, + "frog": { + "$ref": "#/components/examples/frog-example" + } + } + } + } +} +``` + +```yaml +application/json: + schema: + $ref: "#/components/schemas/Pet" + examples: + cat: + summary: An example of a cat + value: + name: Fluffy + petType: Cat + color: White + gender: male + breed: Persian + dog: + summary: An example of a dog with a cat's name + value: + name: Puma + petType: Dog + color: Black + gender: Female + breed: Mixed + frog: + $ref: "#/components/examples/frog-example" +``` + +##### Considerations for File Uploads + +In contrast with the 2.0 specification, `file` input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically: + +```yaml +# content transferred with base64 encoding +schema: + type: string + format: base64 +``` + +```yaml +# content transferred in binary (octet-stream): +schema: + type: string + format: binary +``` + +These examples apply to either input payloads of file uploads or response payloads. + +A `requestBody` for submitting a file in a `POST` operation may look like the following example: + +```yaml +requestBody: + content: + application/octet-stream: + # any media type is accepted, functionally equivalent to `*/*` + schema: + # a binary file of any type + type: string + format: binary +``` + +In addition, specific media types MAY be specified: + +```yaml +# multiple, specific media types may be specified: +requestBody: + content: + # a binary file of type png or jpeg + 'image/jpeg': + schema: + type: string + format: binary + 'image/png': + schema: + type: string + format: binary +``` + +To upload multiple files, a `multipart` media type MUST be used: + +```yaml +requestBody: + content: + multipart/form-data: + schema: + properties: + # The property name 'file' will be used for all files. + file: + type: array + items: + type: string + format: binary + +``` + +##### Support for x-www-form-urlencoded Request Bodies + +To submit content using form url encoding via [RFC1866](https://tools.ietf.org/html/rfc1866), the following +definition may be used: + +```yaml +requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + id: + type: string + format: uuid + address: + # complex types are stringified to support RFC 1866 + type: object + properties: {} +``` + +In this example, the contents in the `requestBody` MUST be stringified per [RFC1866](https://tools.ietf.org/html/rfc1866/) when passed to the server. In addition, the `address` field complex object will be stringified. + +When passing complex objects in the `application/x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the [`Encoding Object`](#encodingObject)'s [`style`](#encodingStyle) property as `form`. + +##### Special Considerations for `multipart` Content + +It is common to use `multipart/form-data` as a `Content-Type` when transferring request bodies to operations. In contrast to 2.0, a `schema` is REQUIRED to define the input parameters to the operation when using `multipart` content. This supports complex structures as well as supporting mechanisms for multiple file uploads. + +When passing in `multipart` types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default `Content-Type`s are defined for `multipart`: + +* If the property is a primitive, or an array of primitive values, the default Content-Type is `text/plain` +* If the property is complex, or an array of complex values, the default Content-Type is `application/json` +* If the property is a `type: string` with `format: binary` or `format: base64` (aka a file object), the default Content-Type is `application/octet-stream` + + +Examples: + +```yaml +requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + id: + type: string + format: uuid + address: + # default Content-Type for objects is `application/json` + type: object + properties: {} + profileImage: + # default Content-Type for string/binary is `application/octet-stream` + type: string + format: binary + children: + # default Content-Type for arrays is based on the `inner` type (text/plain here) + type: array + items: + type: string + addresses: + # default Content-Type for arrays is based on the `inner` type (object shown, so `application/json` in this example) + type: array + items: + type: '#/components/schemas/Address' +``` + +An `encoding` attribute is introduced to give you control over the serialization of parts of `multipart` request bodies. This attribute is _only_ applicable to `multipart` and `application/x-www-form-urlencoded` request bodies. + +#### Encoding Object + +A single encoding definition applied to a single schema property. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +contentType | `string` | The Content-Type for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. The value can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. +headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | A map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a `multipart`. +style | `string` | Describes how a specific property value will be serialized depending on its type. See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values as `query` parameters, including default values. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. +explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. +allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Encoding Object Example + +```yaml +requestBody: + content: + multipart/mixed: + schema: + type: object + properties: + id: + # default is text/plain + type: string + format: uuid + address: + # default is application/json + type: object + properties: {} + historyMetadata: + # need to declare XML format! + description: metadata in XML format + type: object + properties: {} + profileImage: + # default is application/octet-stream, need to declare an image type only! + type: string + format: binary + encoding: + historyMetadata: + # require XML Content-Type in utf-8 encoding + contentType: application/xml; charset=utf-8 + profileImage: + # only accept png/jpeg + contentType: image/png, image/jpeg + headers: + X-Rate-Limit-Limit: + description: The number of allowed requests in the current period + schema: + type: integer +``` + +#### Responses Object + +A container for the expected responses of an operation. +The container maps a HTTP response code to the expected response. + +The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. +However, documentation is expected to cover a successful operation response and any known errors. + +The `default` MAY be used as a default response object for all HTTP codes +that are not covered individually by the specification. + +The `Responses Object` MUST contain at least one response code, and it +SHOULD be the response for a successful operation call. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +default | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. A [Reference Object](#referenceObject) can link to a response that the [OpenAPI Object's components/responses](#componentsResponses) section defines. + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A [Reference Object](#referenceObject) can link to a response that is defined in the [OpenAPI Object's components/responses](#componentsResponses) section. This field MUST be enclosed in quotation marks (for example, "200") for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character `X`. For example, `2XX` represents all response codes between `[200-299]`. The following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code. + + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Responses Object Example + +A 200 response for a successful operation and a default response for others (implying an error): + +```json +{ + "200": { + "description": "a pet to be returned", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + } + } + }, + "default": { + "description": "Unexpected error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorModel" + } + } + } + } +} +``` + +```yaml +'200': + description: a pet to be returned + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' +default: + description: Unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorModel' +``` + +#### Response Object +Describes a single response from an API Operation, including design-time, static +`links` to operations based on the response. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +description | `string` | **REQUIRED**. A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored. +content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* +links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject). + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Response Object Examples + +Response of an array of a complex type: + +```json +{ + "description": "A complex object array response", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/VeryComplexType" + } + } + } + } +} +``` + +```yaml +description: A complex object array response +content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/VeryComplexType' +``` + +Response with a string type: + +```json +{ + "description": "A simple string response", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + +} +``` + +```yaml +description: A simple string response +representations: + text/plain: + schema: + type: string +``` + +Plain text response with headers: + +```json +{ + "description": "A simple string response", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + }, + "headers": { + "X-Rate-Limit-Limit": { + "description": "The number of allowed requests in the current period", + "schema": { + "type": "integer" + } + }, + "X-Rate-Limit-Remaining": { + "description": "The number of remaining requests in the current period", + "schema": { + "type": "integer" + } + }, + "X-Rate-Limit-Reset": { + "description": "The number of seconds left in the current period", + "schema": { + "type": "integer" + } + } + } +} +``` + +```yaml +description: A simple string response +content: + text/plain: + schema: + type: string + example: 'whoa!' +headers: + X-Rate-Limit-Limit: + description: The number of allowed requests in the current period + schema: + type: integer + X-Rate-Limit-Remaining: + description: The number of remaining requests in the current period + schema: + type: integer + X-Rate-Limit-Reset: + description: The number of seconds left in the current period + schema: + type: integer +``` + +Response with no return value: + +```json +{ + "description": "object created" +} +``` + +```yaml +description: object created +``` + +#### Callback Object + +A map of possible out-of band callbacks related to the parent operation. +Each value in the map is a [Path Item Object](#pathItemObject) that describes a set of requests that may be initiated by the API provider and the expected responses. +The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. + +##### Patterned Fields +Field Pattern | Type | Description +---|:---:|--- +{expression} | [Path Item Object](#pathItemObject) | A Path Item Object used to define a callback request and expected responses. A [complete example](../examples/v3.0/callback-example.yaml) is available. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Key Expression + +The key that identifies the [Path Item Object](#pathItemObject) is a [runtime expression](#runtimeExpression) that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. +A simple example might be `$request.body#/url`. +However, using a [runtime expression](#runtimeExpression) the complete HTTP message can be accessed. +This includes accessing any part of a body that a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901) can reference. + +For example, given the following HTTP request: + +```http +POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1 +Host: example.org +Content-Type: application/json +Content-Length: 187 + +{ + "failedUrl" : "http://clientdomain.com/failed", + "successUrls" : [ + "http://clientdomain.com/fast", + "http://clientdomain.com/medium", + "http://clientdomain.com/slow" + ] +} + +201 Created +Location: http://example.org/subscription/1 +``` + +The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named `eventType` and a query parameter named `queryUrl`. + +Expression | Value +---|:--- +$url | http://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning +$method | POST +$request.path.eventType | myevent +$request.query.queryUrl | http://clientdomain.com/stillrunning +$request.header.content-Type | application/json +$request.body#/failedUrl | http://clientdomain.com/stillrunning +$request.body#/successUrls/2 | http://clientdomain.com/medium +$response.header.Location | http://example.org/subscription/1 + + +##### Callback Object Example + +The following example shows a callback to the URL specified by the `id` and `email` property in the request body. + +```yaml +myWebhook: + 'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}': + post: + requestBody: + description: Callback payload + content: + 'application/json': + schema: + $ref: '#/components/schemas/SomePayload' + responses: + '200': + description: webhook successfully processed and no retries will be performed +``` + + +#### Example Object + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +summary | `string` | Short description for the example. +description | `string` | Long description for the example. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +value | Any | Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary. +externalValue | `string` | A URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `externalValue` field are mutually exclusive. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +In all cases, the example value is expected to be compatible with the type schema +of its associated value. Tooling implementations MAY choose to +validate compatibility automatically, and reject the example value(s) if incompatible. + +##### Example Object Example + +```yaml +# in a model +schemas: + properties: + name: + type: string + examples: + name: + $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example + +# in a request body: + requestBody: + content: + 'application/json': + schema: + $ref: '#/components/schemas/Address' + examples: + foo: + summary: A foo example + value: {"foo": "bar"} + bar: + summary: A bar example + value: {"bar": "baz"} + 'application/xml': + examples: + xmlExample: + summary: This is an example in XML + externalValue: 'http://example.org/examples/address-example.xml' + 'text/plain': + examples: + textExample: + summary: This is a text example + externalValue: 'http://foo.bar/examples/address-example.txt' + + +# in a parameter + parameters: + - name: 'zipCode' + in: 'query' + schema: + type: 'string' + format: 'zip-code' + examples: + zip-example: + $ref: '#/components/examples/zip-example' + +# in a response + responses: + '200': + description: your car appointment has been booked + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessResponse' + examples: + confirmation-success: + $ref: '#/components/examples/confirmation-success' +``` + + +#### Link Object + +The `Link object` represents a possible design-time link for a response. +The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. + +Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. + +For computing links, and providing instructions to execute them, a [runtime expression](#runtimeExpression) is used for accessing values in an operation and using them as parameters while invoking the linked operation. + +##### Fixed Fields + +Field Name | Type | Description +---|:---:|--- +operationRef | `string` | A relative or absolute reference to an OAS operation. This field is mutually exclusive of the `operationId` field, and MUST point to an [Operation Object](#operationObject). Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OpenAPI definition. +operationId | `string` | The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive of the `operationRef` field. +parameters | Map[`string`, Any \| [{expression}](#runtimeExpression)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the [parameter location](#parameterIn) `[{in}.]{name}` for operations that use the same parameter name in different locations (e.g. path.id). +requestBody | Any \| [{expression}](#runtimeExpression) | A literal value or [{expression}](#runtimeExpression) to use as a request body when calling the target operation. +description | `string` | A description of the link. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +server | [Server Object](#serverObject) | A server object to be used by the target operation. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +A linked operation MUST be identified using either an `operationRef` or `operationId`. +In the case of an `operationId`, it MUST be unique and resolved in the scope of the OAS document. +Because of the potential for name clashes, the `operationRef` syntax is preferred +for specifications with external references. + +##### Examples + +Computing a link from a request operation where the `$request.path.id` is used to pass a request parameter to the linked operation. + +```yaml +paths: + /users/{id}: + parameters: + - name: id + in: path + required: true + description: the user identifier, as userId + schema: + type: string + get: + responses: + '200': + description: the user being returned + content: + application/json: + schema: + type: object + properties: + uuid: # the unique user id + type: string + format: uuid + links: + address: + # the target link operationId + operationId: getUserAddress + parameters: + # get the `id` field from the request path parameter named `id` + userId: $request.path.id + # the path item of the linked operation + /users/{userid}/address: + parameters: + - name: userid + in: path + required: true + description: the user identifier, as userId + schema: + type: string + # linked operation + get: + operationId: getUserAddress + responses: + '200': + description: the user's address +``` + +When a runtime expression fails to evaluate, no parameter value is passed to the target operation. + +Values from the response body can be used to drive a linked operation. + +```yaml +links: + address: + operationId: getUserAddressByUUID + parameters: + # get the `id` field from the request path parameter named `id` + userUuid: $response.body#/uuid +``` + +Clients follow all links at their discretion. +Neither permissions, nor the capability to make a successful call to that link, is guaranteed +solely by the existence of a relationship. + + +##### OperationRef Examples + +As references to `operationId` MAY NOT be possible (the `operationId` is an optional +value), references MAY also be made through a relative `operationRef`: + +```yaml +links: + UserRepositories: + # returns array of '#/components/schemas/repository' + operationRef: '#/paths/~12.0~1repositories~1{username}/get' + parameters: + username: $response.body#/username +``` + +or an absolute `operationRef`: + +```yaml +links: + UserRepositories: + # returns array of '#/components/schemas/repository' + operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get' + parameters: + username: $response.body#/username +``` + +Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when +using JSON references. + + +##### Runtime Expressions + +Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. +This mechanism is used by [Link Objects](#linkObject) and [Callback Objects](#callbackObject). + +The runtime expression is defined by the following [ABNF](https://tools.ietf.org/html/rfc5234) syntax + +``` + expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source ) + source = ( header-reference | query-reference | path-reference | body-reference ) + header-reference = "header." token + query-reference = "query." name + path-reference = "path." name + body-reference = "body" ["#" fragment] + fragment = a JSON Pointer [RFC 6901](https://tools.ietf.org/html/rfc6901) + name = *( char ) + char = as per RFC [7159](https://tools.ietf.org/html/rfc7159#section-7) + token = as per RFC [7230](https://tools.ietf.org/html/rfc7230#section-3.2.6) +``` + +The `name` identifier is case-sensitive, whereas `token` is not. + +The table below provides examples of runtime expressions and examples of their use in a value: + +##### Examples + +Source Location | example expression | notes +---|:---|:---| +HTTP Method | `$method` | The allowable values for the `$method` will be those for the HTTP operation. +Requested media type | `$request.header.accept` | +Request parameter | `$request.path.id` | Request parameters MUST be declared in the `parameters` section of the parent operation or they cannot be evaluated. This includes request headers. +Request body property | `$request.body#/user/uuid` | In operations which accept payloads, references may be made to portions of the `requestBody` or the entire body. +Request URL | `$url` | +Response value | `$response.body#/status` | In operations which return payloads, references may be made to portions of the response body or the entire body. +Response header | `$response.header.Server` | Single header values only are available + +Runtime expressions preserve the type of the referenced value. +Expressions can be embedded into string values by surrounding the expression with `{}` curly braces. + +#### Header Object + +The Header Object follows the structure of the [Parameter Object](#parameterObject) with the following changes: + +1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. +1. `in` MUST NOT be specified, it is implicitly in `header`. +1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, [`style`](#parameterStyle)). + +##### Header Object Example + +A simple header of type `integer`: + +```json +{ + "description": "The number of allowed requests in the current period", + "schema": { + "type": "integer" + } +} +``` + +```yaml +description: The number of allowed requests in the current period +schema: + type: integer +``` + +#### Tag Object + +Adds metadata to a single tag that is used by the [Operation Object](#operationObject). +It is not mandatory to have a Tag Object per tag defined in the Operation Object instances. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +name | `string` | **REQUIRED**. The name of the tag. +description | `string` | A short description for the tag. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this tag. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Tag Object Example + +```json +{ + "name": "pet", + "description": "Pets operations" +} +``` + +```yaml +name: pet +description: Pets operations +``` + +#### Examples Object + +In an `example`, a JSON Reference MAY be used, with the +explicit restriction that examples having a JSON format with object named +`$ref` are not allowed. Therefore, that `example`, structurally, can be +either a string primitive or an object, similar to `additionalProperties`. + +In all cases, the payload is expected to be compatible with the type schema +for the associated value. Tooling implementations MAY choose to +validate compatibility automatically, and reject the example value(s) if they +are incompatible. + +```yaml +# in a model +schemas: + properties: + name: + type: string + example: + $ref: http://foo.bar#/examples/name-example + +# in a request body, note the plural `examples` + requestBody: + content: + 'application/json': + schema: + $ref: '#/components/schemas/Address' + examples: + foo: + value: {"foo": "bar"} + bar: + value: {"bar": "baz"} + 'application/xml': + examples: + xml: + externalValue: 'http://foo.bar/examples/address-example.xml' + 'text/plain': + examples: + text: + externalValue: 'http://foo.bar/examples/address-example.txt' + +# in a parameter + parameters: + - name: 'zipCode' + in: 'query' + schema: + type: 'string' + format: 'zip-code' + example: + $ref: 'http://foo.bar#/examples/zip-example' + +# in a response, note the singular `example`: + responses: + '200': + description: your car appointment has been booked + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessResponse' + example: + $ref: http://foo.bar#/examples/address-example.json +``` + +#### Reference Object + +A simple object to allow referencing other components in the specification, internally and externally. + +The Reference Object is defined by [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) and follows the same structure, behavior and rules. + +For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +$ref | `string` | **REQUIRED**. The reference string. + +This object cannot be extended with additional properties and any properties added SHALL be ignored. + +##### Reference Object Example + +```json +{ + "$ref": "#/components/schemas/Pet" +} +``` + +```yaml +$ref: '#/components/schemas/Pet' +``` + +##### Relative Schema Document Example +```json +{ + "$ref": "Pet.json" +} +``` + +```yaml +$ref: Pet.yaml +``` + +##### Relative Documents With Embedded Schema Example +```json +{ + "$ref": "definitions.json#/Pet" +} +``` + +```yaml +$ref: definitions.yaml#/Pet +``` + +#### Schema Object + +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 an extended subset of the [JSON Schema Specification Wright Draft 00](http://json-schema.org/). + +For more information about the properties, see [JSON Schema Core](https://tools.ietf.org/html/draft-wright-json-schema-00) and [JSON Schema Validation](https://tools.ietf.org/html/draft-wright-json-schema-validation-00). +Unless stated otherwise, the property definitions follow the JSON Schema. + +##### Properties + +The following properties are taken directly from the JSON Schema definition and follow the same specifications: + +- title +- multipleOf +- maximum +- exclusiveMaximum +- minimum +- exclusiveMinimum +- maxLength +- minLength +- pattern (This string SHOULD be a valid regular expression, according to the [ECMA 262 regular expression](https://www.ecma-international.org/ecma-262/5.1/#sec-7.8.5) dialect) +- maxItems +- minItems +- uniqueItems +- maxProperties +- minProperties +- required +- enum + +The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification. +- type - Value MUST be a string. Multiple types via an array are not supported. +- allOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- oneOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- anyOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- not - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. `items` MUST be present if the `type` is `array`. +- properties - Property definitions MUST be a [Schema Object](#schemaObject) and not a standard JSON Schema (inline or referenced). +- additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. +- description - [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +- format - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. +- default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if `type` is `string`, then `default` can be `"foo"` but cannot be `1`. + +Alternatively, any time a Schema Object can be used, a [Reference Object](#referenceObject) can be used in its place. This allows referencing definitions instead of defining them inline. + +Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported. + +Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation: + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +nullable | `boolean` | Allows sending a `null` value for the defined schema. Default value is `false`. +discriminator | [Discriminator Object](#discriminatorObject) | Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See [Composition and Inheritance](#schemaComposition) for more details. +readOnly | `boolean` | 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 SHOULD NOT be sent as part of the request. If the property is marked as `readOnly` being `true` and is in the `required` list, the `required` will take effect on the response only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. +writeOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "write only". Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as `writeOnly` being `true` and is in the `required` list, the `required` will take effect on the request only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`. +xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property. +externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema. +example | Any | A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. + deprecated | `boolean` | Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is `false`. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +###### Composition and Inheritance (Polymorphism) + +The OpenAPI Specification allows combining and extending model definitions using the `allOf` property of JSON Schema, in effect offering model composition. +`allOf` takes an array of object definitions that are validated *independently* but together compose a single object. + +While composition offers model extensibility, it does not imply a hierarchy between the models. +To support polymorphism, the OpenAPI Specification adds the `discriminator` field. +When used, the `discriminator` will be the name of the property that decides which schema definition validates the structure of the model. +As such, the `discriminator` field MUST be a required field. +There are are two ways to define the value of a discriminator for an inheriting instance. +- Use the schema name. +- Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name. + +As such, inline schema definitions, which do not have a given id, *cannot* be used in polymorphism. + +###### XML Modeling + +The [xml](#schemaXml) property allows extra definitions when translating the JSON definition to XML. +The [XML Object](#xmlObject) contains additional information about the available options. + +##### Schema Object Examples + +###### Primitive Sample + +```json +{ + "type": "string", + "format": "email" +} +``` + +```yaml +type: string +format: email +``` + +###### Simple Model + +```json +{ + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "address": { + "$ref": "#/components/schemas/Address" + }, + "age": { + "type": "integer", + "format": "int32", + "minimum": 0 + } + } +} +``` + +```yaml +type: object +required: +- name +properties: + name: + type: string + address: + $ref: '#/components/schemas/Address' + age: + type: integer + format: int32 + minimum: 0 +``` + +###### Model with Map/Dictionary Properties + +For a simple string to string mapping: + +```json +{ + "type": "object", + "additionalProperties": { + "type": "string" + } +} +``` + +```yaml +type: object +additionalProperties: + type: string +``` + +For a string to model mapping: + +```json +{ + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/ComplexModel" + } +} +``` + +```yaml +type: object +additionalProperties: + $ref: '#/components/schemas/ComplexModel' +``` + +###### Model with Example + +```json +{ + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + }, + "required": [ + "name" + ], + "example": { + "name": "Puma", + "id": 1 + } +} +``` + +```yaml +type: object +properties: + id: + type: integer + format: int64 + name: + type: string +required: +- name +example: + name: Puma + id: 1 +``` + +###### Models with Composition + +```json +{ + "components": { + "schemas": { + "ErrorModel": { + "type": "object", + "required": [ + "message", + "code" + ], + "properties": { + "message": { + "type": "string" + }, + "code": { + "type": "integer", + "minimum": 100, + "maximum": 600 + } + } + }, + "ExtendedErrorModel": { + "allOf": [ + { + "$ref": "#/components/schemas/ErrorModel" + }, + { + "type": "object", + "required": [ + "rootCause" + ], + "properties": { + "rootCause": { + "type": "string" + } + } + } + ] + } + } + } +} +``` + +```yaml +components: + schemas: + ErrorModel: + type: object + required: + - message + - code + properties: + message: + type: string + code: + type: integer + minimum: 100 + maximum: 600 + ExtendedErrorModel: + allOf: + - $ref: '#/components/schemas/ErrorModel' + - type: object + required: + - rootCause + properties: + rootCause: + type: string +``` + +###### Models with Polymorphism Support + +```json +{ + "components": { + "schemas": { + "Pet": { + "type": "object", + "discriminator": { + "propertyName": "petType" + }, + "properties": { + "name": { + "type": "string" + }, + "petType": { + "type": "string" + } + }, + "required": [ + "name", + "petType" + ] + }, + "Cat": { + "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "huntingSkill": { + "type": "string", + "description": "The measured skill for hunting", + "default": "lazy", + "enum": [ + "clueless", + "lazy", + "adventurous", + "aggressive" + ] + } + }, + "required": [ + "huntingSkill" + ] + } + ] + }, + "Dog": { + "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.", + "allOf": [ + { + "$ref": "#/components/schemas/Pet" + }, + { + "type": "object", + "properties": { + "packSize": { + "type": "integer", + "format": "int32", + "description": "the size of the pack the dog is from", + "default": 0, + "minimum": 0 + } + }, + "required": [ + "packSize" + ] + } + ] + } + } + } +} +``` + +```yaml +components: + schemas: + Pet: + type: object + discriminator: + propertyName: petType + properties: + name: + type: string + petType: + type: string + required: + - name + - petType + Cat: ## "Cat" will be used as the discriminator value + description: A representation of a cat + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + huntingSkill: + type: string + description: The measured skill for hunting + enum: + - clueless + - lazy + - adventurous + - aggressive + required: + - huntingSkill + Dog: ## "Dog" will be used as the discriminator value + description: A representation of a dog + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + packSize: + type: integer + format: int32 + description: the size of the pack the dog is from + default: 0 + minimum: 0 + required: + - packSize +``` + +#### Discriminator Object + +When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. + +When using the discriminator, _inline_ schemas will not be considered. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminator value. + mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or references. + +The discriminator attribute is legal only when using one of the composite keywords `oneOf`, `anyOf`, `allOf`. + +In OAS 3.0, a response payload MAY be described to be exactly one of any number of types: + +``` +MyResponseType: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Lizard' +``` + +which means the payload _MUST_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. In this case, a discriminator MAY act as a "hint" to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use: + + +``` +MyResponseType: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Lizard' + discriminator: + propertyName: pet_type +``` + +The expectation now is that a property with name `pet_type` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload: + +``` +{ + "id": 12345, + "pet_type": "Cat" +} +``` + +Will indicate that the `Cat` schema be used in conjunction with this payload. + +In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional `mapping` definition MAY be used: + +``` +MyResponseType: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Lizard' + - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json' + discriminator: + propertyName: pet_type + mapping: + dog: '#/components/schemas/Dog' + monster: 'https://gigantic-server.com/schemas/Monster/schema.json' +``` + +Here the discriminator _value_ of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `Dog`. If the discriminator _value_ does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison. + +When used in conjunction with the `anyOf` construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload. + +In both the `oneOf` and `anyOf` use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an `allOf` construct may be used as an alternate schema. + +For example: + +``` +components: + schemas: + Pet: + type: object + required: + - pet_type + properties: + pet_type: + type: string + discriminator: + propertyName: pet_type + mapping: + cachorro: Dog + Cat: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + # all other properties specific to a `Cat` + properties: + name: + type: string + Dog: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + # all other properties specific to a `Dog` + properties: + bark: + type: string + Lizard: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + # all other properties specific to a `Lizard` + properties: + lovesRocks: + type: boolean +``` + +a payload like this: + +``` +{ + "pet_type": "Cat", + "name": "misty" +} +``` + +will indicate that the `Cat` schema be used. Likewise this schema: + +``` +{ + "pet_type": "cachorro", + "bark": "soft" +} +``` + +will map to `Dog` because of the definition in the `mappings` element. + + +#### XML Object + +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. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +name | `string` | Replaces the name of the element/attribute used for the described schema property. When defined within `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. +namespace | `string` | The URI of the namespace definition. Value MUST be in the form of an absolute URI. +prefix | `string` | The prefix to be used for the [name](#xmlName). +attribute | `boolean` | Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. +wrapped | `boolean` | MAY be used only for an array definition. Signifies whether the array is wrapped (for example, ``) or unwrapped (``). Default value is `false`. The definition takes effect only when defined alongside `type` being `array` (outside the `items`). + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### XML Object Examples + +The examples of the XML object definitions are included inside a property definition of a [Schema Object](#schemaObject) with a sample of the XML representation of it. + +###### No XML Element + +Basic string property: + +```json +{ + "animals": { + "type": "string" + } +} +``` + +```yaml +animals: + type: string +``` + +```xml +... +``` + +Basic string array property ([`wrapped`](#xmlWrapped) is `false` by default): + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string" + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string +``` + +```xml +... +... +... +``` + +###### XML Name Replacement + +```json +{ + "animals": { + "type": "string", + "xml": { + "name": "animal" + } + } +} +``` + +```yaml +animals: + type: string + xml: + name: animal +``` + +```xml +... +``` + + +###### XML Attribute, Prefix and Namespace + +In this example, a full model definition is shown. + +```json +{ + "Person": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32", + "xml": { + "attribute": true + } + }, + "name": { + "type": "string", + "xml": { + "namespace": "http://example.com/schema/sample", + "prefix": "sample" + } + } + } + } +} +``` + +```yaml +Person: + type: object + properties: + id: + type: integer + format: int32 + xml: + attribute: true + name: + type: string + xml: + namespace: http://example.com/schema/sample + prefix: sample +``` + +```xml + + example + +``` + +###### XML Arrays + +Changing the element names: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string", + "xml": { + "name": "animal" + } + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: animal +``` + +```xml +value +value +``` + +The external `name` property has no effect on the XML: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string", + "xml": { + "name": "animal" + } + }, + "xml": { + "name": "aliens" + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: animal + xml: + name: aliens +``` + +```xml +value +value +``` + +Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string" + }, + "xml": { + "wrapped": true + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + wrapped: true +``` + +```xml + + value + value + +``` + +To overcome the naming problem in the example above, the following definition can be used: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string", + "xml": { + "name": "animal" + } + }, + "xml": { + "wrapped": true + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: animal + xml: + wrapped: true +``` + +```xml + + value + value + +``` + +Affecting both internal and external names: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string", + "xml": { + "name": "animal" + } + }, + "xml": { + "name": "aliens", + "wrapped": true + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: animal + xml: + name: aliens + wrapped: true +``` + +```xml + + value + value + +``` + +If we change the external element but not the internal ones: + +```json +{ + "animals": { + "type": "array", + "items": { + "type": "string" + }, + "xml": { + "name": "aliens", + "wrapped": true + } + } +} +``` + +```yaml +animals: + type: array + items: + type: string + xml: + name: aliens + wrapped: true +``` + +```xml + + value + value + +``` + +#### Security Scheme Object + +Defines a security scheme that can be used by the operations. +Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2's common flows (implicit, password, application and access code) as defined in [RFC6749](https://tools.ietf.org/html/rfc6749), and [OpenID Connect Discovery](https://tools.ietf.org/html/draft-ietf-oauth-discovery-06). + +##### Fixed Fields +Field Name | Type | Applies To | Description +---|:---:|---|--- +type | `string` | Any | **REQUIRED**. The type of the security scheme. Valid values are `"apiKey"`, `"http"`, `"oauth2"`, `"openIdConnect"`. +description | `string` | Any | A short description for security scheme. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation. +name | `string` | `apiKey` | **REQUIRED**. The name of the header, query or cookie parameter to be used. +in | `string` | `apiKey` | **REQUIRED**. The location of the API key. Valid values are `"query"`, `"header"` or `"cookie"`. +scheme | `string` | `http` | **REQUIRED**. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-5.1). +bearerFormat | `string` | `http` (`"bearer"`) | A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. +flows | [OAuth Flows Object](#oauthFlowsObject) | `oauth2` | **REQUIRED**. An object containing configuration information for the flow types supported. +openIdConnectUrl | `string` | `openIdConnect` | **REQUIRED**. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Security Scheme Object Example + +###### Basic Authentication Sample + +```json +{ + "type": "http", + "scheme": "basic" +} +``` + +```yaml +type: http +scheme: basic +``` + +###### API Key Sample + +```json +{ + "type": "apiKey", + "name": "api_key", + "in": "header" +} +``` + +```yaml +type: apiKey +name: api_key +in: header +``` + +###### JWT Bearer Sample + +```json +{ + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT", +} +``` + +```yaml +type: http +scheme: bearer +bearerFormat: JWT +``` + +###### Implicit OAuth2 Sample + +```json +{ + "type": "oauth2", + "flows": { + "implicit": { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + } +} +``` + +```yaml +type: oauth2 +flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets +``` + +#### OAuth Flows Object + +Allows configuration of the supported OAuth Flows. + +##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +implicit| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Implicit flow +password| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Resource Owner Password flow +clientCredentials| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI 2.0. +authorizationCode| [OAuth Flow Object](#oauthFlowObject) | Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +#### OAuth Flow Object + +Configuration details for a supported OAuth Flow + +##### Fixed Fields +Field Name | Type | Applies To | Description +---|:---:|---|--- +authorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorizationCode"`) | **REQUIRED**. The authorization URL to be used for this flow. This MUST be in the form of a URL. +tokenUrl | `string` | `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`) | **REQUIRED**. The token URL to be used for this flow. This MUST be in the form of a URL. +refreshUrl | `string` | `oauth2` | The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. +scopes | Map[`string`, `string`] | `oauth2` | **REQUIRED**. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### OAuth Flow Object Examples + +```JSON +{ + "type": "oauth2", + "flows": { + "implicit": { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + }, + "authorizationCode": { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "tokenUrl": "https://example.com/api/oauth/token", + "scopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + } +} +``` + +```YAML +type: oauth2 +flows: + implicit: + authorizationUrl: https://example.com/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + authorizationCode: + authorizationUrl: https://example.com/api/oauth/dialog + tokenUrl: https://example.com/api/oauth/token + scopes: + write:pets: modify pets in your account + read:pets: read your pets +``` + + +#### Security Requirement Object + +Lists the required security schemes to execute this operation. +The name used for each property MUST correspond to a security scheme declared in the [Security Schemes](#componentsSecuritySchemes) under the [Components Object](#componentsObject). + +Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. +This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. + +When a list of Security Requirement Objects is defined on the [Open API object](#oasObject) or [Operation Object](#operationObject), only one of Security Requirement Objects in the list needs to be satisfied to authorize the request. + +##### Patterned Fields + +Field Pattern | Type | Description +---|:---:|--- +{name} | [`string`] | Each name MUST correspond to a security scheme which is declared in the [Security Schemes](#componentsSecuritySchemes) under the [Components Object](#componentsObject). If the security scheme is of type `"oauth2"` or `"openIdConnect"`, then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty. + +##### Security Requirement Object Examples + +###### Non-OAuth2 Security Requirement + +```json +{ + "api_key": [] +} +``` + +```yaml +api_key: [] +``` + +###### OAuth2 Security Requirement + +```json +{ + "petstore_auth": [ + "write:pets", + "read:pets" + ] +} +``` + +```yaml +petstore_auth: +- write:pets +- read:pets +``` + +### Specification Extensions + +While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points. + +The extensions properties are implemented as patterned fields that are always prefixed by `"x-"`. + +Field Pattern | Type | Description +---|:---:|--- +^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. 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). + +### Security Filtering + +Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation. + +The reasoning is to allow an additional layer of access control over the documentation. +While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization. + +Two examples of this: + +1. The [Paths Object](#pathsObject) MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can't access any documentation. They'd still have access to the [Info Object](#infoObject) which may contain additional information regarding authentication. +2. The [Path Item Object](#pathItemObject) MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the [Paths Object](#pathsObject), so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see. + +## Appendix A: Revision History + +Version | Date | Notes +--- | --- | --- +3.0.0 | 2017-07-26 | Release of the OpenAPI Specification 3.0.0 +3.0.0-rc2 | 2017-06-16 | rc2 of the 3.0 specification +3.0.0-rc1 | 2017-04-27 | rc1 of the 3.0 specification +3.0.0-rc0 | 2017-02-28 | Implementer's Draft of the 3.0 specification +2.0 | 2015-12-31 | Donation of Swagger 2.0 to the Open API Initiative +2.0 | 2014-09-08 | Release of Swagger 2.0 +1.2 | 2014-03-14 | Initial release of the formal document. +1.1 | 2012-08-22 | Release of Swagger 1.1 +1.0 | 2011-08-10 | First release of the Swagger Specification diff --git a/bikeshed/build.sh b/bikeshed/build.sh new file mode 100644 index 0000000000..e773957f4a --- /dev/null +++ b/bikeshed/build.sh @@ -0,0 +1,5 @@ +#!/bin/sh +node md2bs.js 3.0.0.md > 3.0.0.bs +cat heading.bs style-start.html syntax-github.css style-finish.html 3.0.0.bs > input.bs +curl https://api.csswg.org/bikeshed/ -F file=@input.bs -F output=err > oas_3.0.0.err +curl https://api.csswg.org/bikeshed/ -F file=@input.bs -F force=1 > oas_3.0.0.html diff --git a/bikeshed/heading.bs b/bikeshed/heading.bs new file mode 100644 index 0000000000..46e20f8f8d --- /dev/null +++ b/bikeshed/heading.bs @@ -0,0 +1,62 @@ + + + + + + + + + + +Open API Initiative logo diff --git a/bikeshed/input.bs b/bikeshed/input.bs new file mode 100644 index 0000000000..bcf8deed63 --- /dev/null +++ b/bikeshed/input.bs @@ -0,0 +1,4249 @@ + + + + + + + + + + +Open API Initiative logo + +

OpenAPI Specification

+

Version 3.0.0

+

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [[!rfc2119]] [[!rfc8174]] when, and only when, they appear in all capitals, as shown here.

+

This document is licensed under The Apache License, Version 2.0.

+

Introduction

+

The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.

+

An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.

+

Definitions

+

OpenAPI Document

+A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification. +

Path Templating

+Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. +

Media Types

+Media type definitions are spread across several resources. +The media type definitions SHOULD be in compliance with [[!rfc6838]]. +

Some examples of possible media type definitions:

+

+  text/plain; charset=utf-8
+  application/json
+  application/vnd.github+json
+  application/vnd.github.v3+json
+  application/vnd.github.v3.raw+json
+  application/vnd.github.v3.text+json
+  application/vnd.github.v3.html+json
+  application/vnd.github.v3.full+json
+  application/vnd.github.v3.diff
+  application/vnd.github.v3.patch
+
+

HTTP Status Codes

+The HTTP Status Codes are used to indicate the status of the executed operation. +The available status codes are defined by [[!rfc7231]]section-6) and registered status codes are listed in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). +

Specification

+

Versions

+

The OpenAPI Specification is versioned using Semantic Versioning 2.0.0 (semver) and follows the semver specification.

+

The major.minor portion of the semver (for example 3.0) SHALL designate the OAS feature set. Typically, .patch versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between 3.0.0 and 3.0.1 for example.

+

Subsequent minor version releases of the OpenAPI Specification (incrementing the minor version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical 3.1.0 specification SHOULD be usable with tooling designed for 3.0.0.

+

An OpenAPI document compatible with OAS 3.*.* contains a required openapi field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named swagger and value "2.0".)

+

Format

+

An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format.

+

For example, if a field has an array value, the JSON array representation will be used:

+

+{
+   "field": [ 1, 2, 3 ]
+}
+
+

All field names in the specification are case sensitive.

+

The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name.

+

Patterned fields MUST have unique names within the containing object.

+

In order to preserve the ability to round-trip between YAML and JSON formats, YAML version 1.2 is RECOMMENDED along with some additional constraints:

+ +

Note: While APIs may be defined by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML.

+

Document Structure

+

An OpenAPI document MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the user. In the latter case, $ref fields MUST be used in the specification to reference those parts as follows from the JSON Schema definitions.

+

It is RECOMMENDED that the root OpenAPI document be named: openapi.json or openapi.yaml.

+

Data Types

+

Primitive data types in the OAS are based on the types supported by the JSON Schema Specification Wright Draft 00. +Note that integer as a type is also supported and is defined as a JSON number without a fraction or exponent part. +null is not supported as a type (see nullable for an alternative solution). +Models are defined using the Schema Object, which is an extended subset of JSON Schema Specification Wright Draft 00.

+

Primitives have an optional modifier property: format. +OAS uses several known formats to define in fine detail the data type being used. +However, to support documentation needs, the format property is an open string-valued property, and can have any value. +Formats such as "email", "uuid", and so on, MAY be used even though undefined by this specification. +Types that are not accompanied by a format property follow the type definition in the JSON Schema. Tools that do not recognize a specific format MAY default back to the type alone, as if the format is not specified.

+

The formats defined by the OAS are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Common NametypeformatComments
integerintegerint32signed 32 bits
longintegerint64signed 64 bits
floatnumberfloat
doublenumberdouble
stringstring
bytestringbytebase64 encoded characters
binarystringbinaryany sequence of octets
booleanboolean
datestringdateAs defined by full-date - [!rfc3339]
dateTimestringdate-timeAs defined by date-time - [!rfc3339]
passwordstringpasswordA hint to UIs to obscure input.
+

Rich Text Formatting

+Throughout the specification `description` fields are noted as supporting CommonMark markdown formatting. +Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by [CommonMark 0.27](http://spec.commonmark.org/0.27/). Tooling MAY choose to ignore some CommonMark features to address security concerns. +

Relative References in URLs

+

Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [[!rfc3986]]section-4.2). +Relative references are resolved using the URLs defined in the Server Object as a Base URI.

+

Relative references used in $ref are processed as per JSON Reference, using the URL of the current document as the base URI. See also the Reference Object.

+

Schema

+

In the following description, if a field is not explicitly REQUIRED or described with a MUST or SHALL, it can be considered OPTIONAL.

+

OpenAPI Object

+

This is the root document object of the OpenAPI document.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
openapistringREQUIRED. This string MUST be the semantic version number of the OpenAPI Specification version that the OpenAPI document uses. The openapi field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is not related to the API info.version string.
infoInfo ObjectREQUIRED. Provides metadata about the API. The metadata MAY be used by tooling as required.
servers[Server Object]An array of Server Objects, which provide connectivity information to a target server. If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url value of /.
pathsPaths ObjectREQUIRED. The available paths and operations for the API.
componentsComponents ObjectAn element to hold various schemas for the specification.
security[Security Requirement Object]A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition.
tags[Tag Object]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.
externalDocsExternal Documentation ObjectAdditional external documentation.
+

This object MAY be extended with Specification Extensions.

+

Info Object

+

The object provides metadata about the API. +The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
titlestringREQUIRED. The title of the application.
descriptionstringA short description of the application. CommonMark syntax MAY be used for rich text representation.
termsOfServicestringA URL to the Terms of Service for the API. MUST be in the format of a URL.
contactContact ObjectThe contact information for the exposed API.
licenseLicense ObjectThe license information for the exposed API.
versionstringREQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version).
+

This object MAY be extended with Specification Extensions.

+
Info Object Example:
+

+{
+  "title": "Sample Pet Store App",
+  "description": "This is a sample server for a pet store.",
+  "termsOfService": "http://example.com/terms/",
+  "contact": {
+    "name": "API Support",
+    "url": "http://www.example.com/support",
+    "email": "support@example.com"
+  },
+  "license": {
+    "name": "Apache 2.0",
+    "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
+  },
+  "version": "1.0.1"
+}
+
+

+title: Sample Pet Store App
+description: This is a sample server for a pet store.
+termsOfService: http://example.com/terms/
+contact:
+  name: API Support
+  url: http://www.example.com/support
+  email: support@example.com
+license:
+  name: Apache 2.0
+  url: http://www.apache.org/licenses/LICENSE-2.0.html
+version: 1.0.1
+
+

Contact Object

+

Contact information for the exposed API.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
namestringThe identifying name of the contact person/organization.
urlstringThe URL pointing to the contact information. MUST be in the format of a URL.
emailstringThe email address of the contact person/organization. MUST be in the format of an email address.
+

This object MAY be extended with Specification Extensions.

+
Contact Object Example:
+

+{
+  "name": "API Support",
+  "url": "http://www.example.com/support",
+  "email": "support@example.com"
+}
+
+

+name: API Support
+url: http://www.example.com/support
+email: support@example.com
+
+

License Object

+

License information for the exposed API.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
namestringREQUIRED. The license name used for the API.
urlstringA URL to the license used for the API. MUST be in the format of a URL.
+

This object MAY be extended with Specification Extensions.

+
License Object Example:
+

+{
+  "name": "Apache 2.0",
+  "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
+}
+
+

+name: Apache 2.0
+url: http://www.apache.org/licenses/LICENSE-2.0.html
+
+

Server Object

+

An object representing a Server.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
urlstringREQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in {brackets}.
descriptionstringAn optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation.
variablesMap[string, Server Variable Object]A map between a variable name and its value. The value is used for substitution in the server’s URL template.
+

This object MAY be extended with Specification Extensions.

+
Server Object Example
+

A single server would be described as:

+

+{
+  "url": "https://development.gigantic-server.com/v1",
+  "description": "Development server"
+}
+
+

+url: https://development.gigantic-server.com/v1
+description: Development server
+
+

The following shows how multiple servers can be described, for example, at the OpenAPI Object’s servers:

+

+{
+  "servers": [
+    {
+      "url": "https://development.gigantic-server.com/v1",
+      "description": "Development server"
+    },
+    {
+      "url": "https://staging.gigantic-server.com/v1",
+      "description": "Staging server"
+    },
+    {
+      "url": "https://api.gigantic-server.com/v1",
+      "description": "Production server"
+    }
+  ]
+}
+
+

+servers:
+- url: https://development.gigantic-server.com/v1
+  description: Development server
+- url: https://staging.gigantic-server.com/v1
+  description: Staging server
+- url: https://api.gigantic-server.com/v1
+  description: Production server
+
+

The following shows how variables can be used for a server configuration:

+

+{
+  "servers": [
+    {
+      "url": "https://{username}.gigantic-server.com:{port}/{basePath}",
+      "description": "The production API server",
+      "variables": {
+        "username": {
+          "default": "demo",
+          "description": "this value is assigned by the service provider, in this example `gigantic-server.com`"
+        },
+        "port": {
+          "enum": [
+            "8443",
+            "443"
+          ],
+          "default": "8443"
+        },
+        "basePath": {
+          "default": "v2"
+        }
+      }
+    }
+  ]
+}
+
+

+servers:
+- url: https://{username}.gigantic-server.com:{port}/{basePath}
+  description: The production API server
+  variables:
+    username:
+      # note! no enum here means it is an open value
+      default: demo
+      description: this value is assigned by the service provider, in this example `gigantic-server.com`
+    port:
+      enum:
+        - '8443'
+        - '443'
+      default: '8443'
+    basePath:
+      # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2`
+      default: v2
+
+

Server Variable Object

+

An object representing a Server Variable for server URL template substitution.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
enum[string]An enumeration of string values to be used if the substitution options are from a limited set.
defaultstringREQUIRED. The default value to use for substitution, and to send, if an alternate value is not supplied. Unlike the Schema Object’s default, this value MUST be provided by the consumer.
descriptionstringAn optional description for the server variable. CommonMark syntax MAY be used for rich text representation.
+

This object MAY be extended with Specification Extensions.

+

Components Object

+

Holds a set of reusable objects for different aspects of the OAS. +All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
schemasMap[string, Schema Object | Reference Object]An object to hold reusable Schema Objects.
responsesMap[string, Response Object | Reference Object]An object to hold reusable Response Objects.
parametersMap[string, Parameter Object | Reference Object]An object to hold reusable Parameter Objects.
examplesMap[string, Example Object | Reference Object]An object to hold reusable Example Objects.
requestBodiesMap[string, Request Body Object | Reference Object]An object to hold reusable Request Body Objects.
headersMap[string, Header Object | Reference Object]An object to hold reusable Header Objects.
securitySchemesMap[string, Security Scheme Object | Reference Object]An object to hold reusable Security Scheme Objects.
linksMap[string, Link Object | Reference Object]An object to hold reusable Link Objects.
callbacksMap[string, Callback Object | Reference Object]An object to hold reusable Callback Objects.
+

This object MAY be extended with Specification Extensions.

+

All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9\.\-_]+$.

+

Field Name Examples:

+

+User
+User_1
+User_Name
+user-name
+my.org.User
+
+
Components Object Example
+

+"components": {
+  "schemas": {
+    "Category": {
+      "type": "object",
+      "properties": {
+        "id": {
+          "type": "integer",
+          "format": "int64"
+        },
+        "name": {
+          "type": "string"
+        }
+      }
+    },
+    "Tag": {
+      "type": "object",
+      "properties": {
+        "id": {
+          "type": "integer",
+          "format": "int64"
+        },
+        "name": {
+          "type": "string"
+        }
+      }
+    }
+  },
+  "parameters": {
+    "skipParam": {
+      "name": "skip",
+      "in": "query",
+      "description": "number of items to skip",
+      "required": true,
+      "schema": {
+        "type": "integer",
+        "format": "int32"
+      }
+    },
+    "limitParam": {
+      "name": "limit",
+      "in": "query",
+      "description": "max records to return",
+      "required": true,
+      "schema" : {
+        "type": "integer",
+        "format": "int32"
+      }
+    }
+  },
+  "responses": {
+    "NotFound": {
+      "description": "Entity not found."
+    },
+    "IllegalInput": {
+      "description": "Illegal input for operation."
+    },
+    "GeneralError": {
+      "description": "General Error",
+      "content": {
+        "application/json": {
+          "schema": {
+            "$ref": "#/components/schemas/GeneralError"
+          }
+        }
+      }
+    }
+  },
+  "securitySchemes": {
+    "api_key": {
+      "type": "apiKey",
+      "name": "api_key",
+      "in": "header"
+    },
+    "petstore_auth": {
+      "type": "oauth2",
+      "flows": {
+        "implicit": {
+          "authorizationUrl": "http://example.org/api/oauth/dialog",
+          "scopes": {
+            "write:pets": "modify pets in your account",
+            "read:pets": "read your pets"
+          }
+        }
+      }
+    }
+  }
+}
+
+

+components:
+  schemas:
+    Category:
+      type: object
+      properties:
+        id:
+          type: integer
+          format: int64
+        name:
+          type: string
+    Tag:
+      type: object
+      properties:
+        id:
+          type: integer
+          format: int64
+        name:
+          type: string
+  parameters:
+    skipParam:
+      name: skip
+      in: query
+      description: number of items to skip
+      required: true
+      schema:
+        type: integer
+        format: int32
+    limitParam:
+      name: limit
+      in: query
+      description: max records to return
+      required: true
+      schema:
+        type: integer
+        format: int32
+  responses:
+    NotFound:
+      description: Entity not found.
+    IllegalInput:
+      description: Illegal input for operation.
+    GeneralError:
+      description: General Error
+      content:
+        application/json:
+          schema:
+            $ref: '#/components/schemas/GeneralError'
+  securitySchemes:
+    api_key:
+      type: apiKey
+      name: api_key
+      in: header
+    petstore_auth:
+      type: oauth2
+      flows: 
+        implicit:
+          authorizationUrl: http://example.org/api/oauth/dialog
+          scopes:
+            write:pets: modify pets in your account
+            read:pets: read your pets
+
+

Paths Object

+

Holds the relative paths to the individual endpoints and their operations. +The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.

+

Patterned Fields

+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
/{path}Path Item ObjectA relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended (no relative URL resolution) to the expanded URL from the Server Object's url field in order to construct the full URL. Path templating is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it’s up to the tooling to decide which one to use.
+

This object MAY be extended with Specification Extensions.

+
Path Templating Matching
+

Assuming the following paths, the concrete definition, /pets/mine, will be matched first if used:

+

+  /pets/{petId}
+  /pets/mine
+
+

The following paths are considered identical and invalid:

+

+  /pets/{petId}
+  /pets/{name}
+
+

The following may lead to ambiguous resolution:

+

+  /{entity}/me
+  /books/{id}
+
+
Paths Object Example
+

+{
+  "/pets": {
+    "get": {
+      "description": "Returns all pets from the system that the user has access to",
+      "responses": {
+        "200": {          
+          "description": "A list of pets.",
+          "content": {
+            "application/json": {
+              "schema": {
+                "type": "array",
+                "items": {
+                  "$ref": "#/components/schemas/pet"
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
+
+

+/pets:
+  get:
+    description: Returns all pets from the system that the user has access to
+    responses:
+      '200':
+        description: A list of pets.
+        content:
+          application/json:
+            schema:
+              type: array
+              items:
+                $ref: '#/components/schemas/pet'
+
+

Path Item Object

+

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.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
$refstringAllows 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.
summarystringAn optional, string summary, intended to apply to all operations in this path.
descriptionstringAn optional, string description, intended to apply to all operations in this path. CommonMark syntax MAY be used for rich text representation.
getOperation ObjectA definition of a GET operation on this path.
putOperation ObjectA definition of a PUT operation on this path.
postOperation ObjectA definition of a POST operation on this path.
deleteOperation ObjectA definition of a DELETE operation on this path.
optionsOperation ObjectA definition of a OPTIONS operation on this path.
headOperation ObjectA definition of a HEAD operation on this path.
patchOperation ObjectA definition of a PATCH operation on this path.
traceOperation ObjectA definition of a TRACE operation on this path.
servers[Server Object]An alternative server array to service all operations in this path.
parameters[Parameter Object | Reference Object]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 OpenAPI Object’s components/parameters.
+

This object MAY be extended with Specification Extensions.

+
Path Item Object Example
+

+{
+  "get": {
+    "description": "Returns pets based on ID",
+    "summary": "Find pets by ID",
+    "operationId": "getPetsById",
+    "responses": {
+      "200": {
+        "description": "pet response",
+        "content": {
+          "*/*": {
+            "schema": {
+              "type": "array",
+              "items": {
+                "$ref": "#/components/schemas/Pet"
+              }
+            }
+          }
+        }
+      },
+      "default": {
+        "description": "error payload",
+        "content": {
+          "text/html": {
+            "schema": {
+              "$ref": "#/components/schemas/ErrorModel"
+            }
+          }
+        }
+      }
+    }
+  },
+  "parameters": [
+    {
+      "name": "id",
+      "in": "path",
+      "description": "ID of pet to use",
+      "required": true,
+      "schema": {
+        "type": "array",
+        "items": {
+          "type": "string"
+        }
+      },
+      "style": "simple"
+    }
+  ]
+}
+
+

+get:
+  description: Returns pets based on ID
+  summary: Find pets by ID
+  operationId: getPetsById
+  responses:
+    '200':
+      description: pet response
+      content:
+        '*/*' :
+          schema:
+            type: array
+            items:
+              $ref: '#/components/schemas/Pet'
+    default:
+      description: error payload
+      content:
+        'text/html':
+          schema:
+            $ref: '#/components/schemas/ErrorModel'
+parameters:
+- name: id
+  in: path
+  description: ID of pet to use
+  required: true
+  schema:
+    type: array
+    style: simple
+    items:
+      type: string  
+
+

Operation Object

+

Describes a single API operation on a path.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
tags[string]A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
summarystringA short summary of what the operation does.
descriptionstringA verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation.
externalDocsExternal Documentation ObjectAdditional external documentation for this operation.
operationIdstringUnique 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[Parameter Object | Reference Object]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 OpenAPI Object’s components/parameters.
requestBodyRequest Body Object | Reference ObjectThe request body applicable for this operation. The requestBody is only supported in HTTP methods where the HTTP 1.1 specification [[!rfc7231]]section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers.
responsesResponses ObjectREQUIRED. The list of possible responses as they are returned from executing this operation.
callbacksMap[string, Callback Object | Reference Object]A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
deprecatedbooleanDeclares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is false.
security[Security Requirement Object]A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used.
servers[Server Object]An alternative server array to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value.
+

This object MAY be extended with Specification Extensions.

+
Operation Object Example
+

+{
+  "tags": [
+    "pet"
+  ],
+  "summary": "Updates a pet in the store with form data",
+  "operationId": "updatePetWithForm",
+  "parameters": [
+    {
+      "name": "petId",
+      "in": "path",
+      "description": "ID of pet that needs to be updated",
+      "required": true,
+      "schema": {
+        "type": "string"
+      }
+    }
+  ],
+  "requestBody": {
+    "content": {
+      "application/x-www-form-urlencoded": {
+        "schema": {
+          "type": "object",
+           "properties": {
+              "name": { 
+                "description": "Updated name of the pet",
+                "type": "string"
+              },
+              "status": {
+                "description": "Updated status of the pet",
+                "type": "string"
+             }
+           },
+        "required": ["status"] 
+        }
+      }
+    }
+  },
+  "responses": {
+    "200": {
+      "description": "Pet updated.",
+      "content": {
+        "application/json": {},
+        "application/xml": {}
+      }
+    },
+    "405": {
+      "description": "Invalid input",
+      "content": {
+        "application/json": {},
+        "application/xml": {}
+      }
+    }
+  },
+  "security": [
+    {
+      "petstore_auth": [
+        "write:pets",
+        "read:pets"
+      ]
+    }
+  ]
+}
+
+

+tags:
+- pet
+summary: Updates a pet in the store with form data
+operationId: updatePetWithForm
+parameters:
+- name: petId
+  in: path
+  description: ID of pet that needs to be updated
+  required: true
+  schema:
+    type: string
+requestBody:
+  content:
+    'application/x-www-form-urlencoded':
+      schema:
+       properties:
+          name: 
+            description: Updated name of the pet
+            type: string
+          status:
+            description: Updated status of the pet
+            type: string
+       required:
+         - status
+responses:
+  '200':
+    description: Pet updated.
+    content: 
+      'application/json': {}
+      'application/xml': {}
+  '405':
+    description: Invalid input
+    content: 
+      'application/json': {}
+      'application/xml': {}
+security:
+- petstore_auth:
+  - write:pets
+  - read:pets
+
+

External Documentation Object

+

Allows referencing an external resource for extended documentation.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
descriptionstringA short description of the target documentation. CommonMark syntax MAY be used for rich text representation.
urlstringREQUIRED. The URL for the target documentation. Value MUST be in the format of a URL.
+

This object MAY be extended with Specification Extensions.

+
External Documentation Object Example
+

+{
+  "description": "Find more info here",
+  "url": "https://example.com"
+}
+
+

+description: Find more info here
+url: https://example.com
+
+

Parameter Object

+

Describes a single operation parameter.

+

A unique parameter is defined by a combination of a name and location.

+

Parameter Locations

+

There are four possible parameter locations specified by the in field:

+
    +
  • path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId.
  • +
  • query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id.
  • +
  • header - Custom headers that are expected as part of the request. Note that [[!rfc7230]]page-22) states header names are case insensitive.
  • +
  • cookie - Used to pass a specific cookie value to the API.
  • +
+
Fixed Fields
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
namestringREQUIRED. 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.
  • If in is "header" and the name field is "Accept", "Content-Type" or "Authorization", the parameter definition SHALL be ignored.
  • For all other cases, the name corresponds to the parameter name used by the in property.
instringREQUIRED. The location of the parameter. Possible values are “query”, “header”, “path” or “cookie”.
descriptionstringA brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
requiredbooleanDetermines whether this parameter is mandatory. If the parameter location is “path”, this property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and its default value is false.
deprecatedbooleanSpecifies that a parameter is deprecated and SHOULD be transitioned out of usage.
allowEmptyValuebooleanSets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored.
+

The rules for serialization of the parameter are specified in one of two ways. +For simpler scenarios, a schema and style can describe the structure and syntax of the parameter.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
stylestringDescribes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form.
explodebooleanWhen this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false.
allowReservedbooleanDetermines whether the parameter value SHOULD allow reserved characters, as defined by [[!rfc3986]]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false.
schemaSchema Object | Reference ObjectThe schema defining the type used for the parameter.
exampleAnyExample of the media type. The example SHOULD match the specified schema and encoding properties if present. The example object is mutually exclusive of the examples object. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.
examplesMap[ string, Example Object | Reference Object]Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The examples object is mutually exclusive of the example object. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema.
+

For more complex scenarios, the content property can define the media type and schema of the parameter. +A parameter MUST contain either a schema property, or a content property, but not both. +When example or examples are provided in conjunction with the schema object, the example MUST follow the prescribed serialization strategy for the parameter.

+ + + + + + + + + + + + + + + +
Field NameTypeDescription
contentMap[string, Media Type Object]A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.
+
Style Values
+

In order to support common ways of serializing simple parameters, a set of style values are defined.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
styletypeinComments
matrixprimitive, array, objectpathPath-style parameters defined by [[!rfc6570]]section-3.2.7)
labelprimitive, array, objectpathLabel style parameters defined by [[!rfc6570]]section-3.2.5)
formprimitive, array, objectquery, cookieForm style parameters defined by [[!rfc6570]]section-3.2.8). This option replaces collectionFormat with a csv (when explode is false) or multi (when explode is true) value from OpenAPI 2.0.
simplearraypath, headerSimple style parameters defined by [[!rfc6570]]section-3.2.2). This option replaces collectionFormat with a csv value from OpenAPI 2.0.
spaceDelimitedarrayquerySpace separated array values. This option replaces collectionFormat equal to ssv from OpenAPI 2.0.
pipeDelimitedarrayqueryPipe separated array values. This option replaces collectionFormat equal to pipes from OpenAPI 2.0.
deepObjectobjectqueryProvides a simple way of rendering nested objects using form parameters.
+
Style Examples
+

Assume a parameter named color has one of the following values:

+

+   string -> "blue"
+   array -> ["blue","black","brown"]
+   object -> { "R": 100, "G": 200, "B": 150 }
+
+

The following table shows examples of rendering differences for each value.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
styleexplodeemptystringarrayobject
matrixfalse;color;color=blue;color=blue,black,brown;color=R,100,G,200,B,150
matrixtrue;color;color=blue;color=blue;color=black;color=brown;R=100;G=200;B=150
labelfalse..blue.blue.black.brown.R.100.G.200.B.150
labeltrue..blue.blue.black.brown.R=100.G=200.B=150
formfalsecolor=color=bluecolor=blue,black,browncolor=R,100,G,200,B,150
formtruecolor=color=bluecolor=blue&color=black&color=brownR=100&G=200&B=150
simplefalsen/ablueblue,black,brownR,100,G,200,B,150
simpletruen/ablueblue,black,brownR=100,G=200,B=150
spaceDelimitedfalsen/an/ablue%20black%20brownR%20100%20G%20200%20B%20150
pipeDelimitedfalsen/an/ablue|black|brownR|100|G|200
deepObjecttruen/an/an/acolor[R]=100&color[G]=200&color[B]=150
+

This object MAY be extended with Specification Extensions.

+
Parameter Object Examples
+

A header parameter with an array of 64 bit integer numbers:

+

+{
+  "name": "token",
+  "in": "header",
+  "description": "token to be passed as a header",
+  "required": true,
+  "schema": {
+    "type": "array",
+    "items": {
+      "type": "integer",
+      "format": "int64"
+    }
+  },
+  "style": "simple"
+}
+
+

+name: token
+in: header
+description: token to be passed as a header
+required: true
+schema:
+  type: array
+  items:
+    type: integer
+    format: int64
+style: simple
+
+

A path parameter of a string value:

+

+{
+  "name": "username",
+  "in": "path",
+  "description": "username to fetch",
+  "required": true,
+  "schema": {
+    "type": "string"
+  }
+}
+
+

+name: username
+in: path
+description: username to fetch
+required: true
+schema:
+  type: string
+
+

An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

+

+{
+  "name": "id",
+  "in": "query",
+  "description": "ID of the object to fetch",
+  "required": false,
+  "schema": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    }
+  },
+  "style": "form",
+  "explode": true
+}
+
+

+name: id
+in: query
+description: ID of the object to fetch
+required: false
+schema:
+  type: array
+  items:
+    type: string
+style: form
+explode: true
+
+

A free-form query parameter, allowing undefined parameters of a specific type:

+

+{
+  "in": "query",
+  "name": "freeForm",
+  "schema": {
+    "type": "object",
+    "additionalProperties": {
+      "type": "integer"
+    },
+  },
+  "style": "form"
+}
+
+

+in: query
+name: freeForm
+schema:
+  type: object
+  additionalProperties:
+    type: integer
+style: form
+
+

A complex parameter using content to define serialization:

+

+{
+  "in": "query",
+  "name": "coordinates",
+  "content": {
+    "application/json": {
+      "schema": {
+        "type": "object",
+        "required": [
+          "lat",
+          "long"
+        ],
+        "properties": {
+          "lat": {
+            "type": "number"
+          },
+          "long": {
+            "type": "number"
+          }
+        }
+      }
+    }
+  }
+}
+
+

+in: query
+name: coordinates
+content:
+  application/json:
+    schema:
+      type: object
+      required:
+        - lat
+        - long
+      properties:
+        lat:
+          type: number
+        long:
+          type: number
+
+

Request Body Object

+

Describes a single request body.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
descriptionstringA brief description of the request body. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
contentMap[string, Media Type Object]REQUIRED. The content of the request body. The key is a media type or [media type range]appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
requiredbooleanDetermines if the request body is required in the request. Defaults to false.
+

This object MAY be extended with Specification Extensions.

+
Request Body Examples
+

A request body with a referenced model definition.

+

+{
+  "description": "user to add to the system",
+  "content": {
+    "application/json": {
+      "schema": {
+        "$ref": "#/components/schemas/User"
+      },
+      "examples": {
+          "user" : {
+            "summary": "User Example", 
+            "externalValue": "http://foo.bar/examples/user-example.json"
+          } 
+        }
+    },
+    "application/xml": {
+      "schema": {
+        "$ref": "#/components/schemas/User"
+      },
+      "examples": {
+          "user" : {
+            "summary": "User example in XML",
+            "externalValue": "http://foo.bar/examples/user-example.xml"
+          }
+        }
+    },
+    "text/plain": {
+      "examples": {
+        "user" : {
+            "summary": "User example in Plain text",
+            "externalValue": "http://foo.bar/examples/user-example.txt" 
+        }
+      } 
+    },
+    "*/*": {
+      "examples": {
+        "user" : {
+            "summary": "User example in other format",
+            "externalValue": "http://foo.bar/examples/user-example.whatever"
+        }
+      }
+    }
+  }
+}
+
+

+description: user to add to the system
+content: 
+  'application/json':
+    schema:
+      $ref: '#/components/schemas/User'
+    examples:
+      user:
+        summary: User Example
+        externalValue: 'http://foo.bar/examples/user-example.json'
+  'application/xml':
+    schema:
+      $ref: '#/components/schemas/User'
+    examples:
+      user:
+        summary: User Example in XML
+        externalValue: 'http://foo.bar/examples/user-example.xml'
+  'text/plain':
+    examples:
+      user:
+        summary: User example in text plain format
+        externalValue: 'http://foo.bar/examples/user-example.txt'
+  '*/*':
+    examples:
+      user: 
+        summary: User example in other format
+        externalValue: 'http://foo.bar/examples/user-example.whatever'
+
+

A body parameter that is an array of string values:

+

+{
+  "description": "user to add to the system",
+  "content": {
+    "text/plain": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "type": "string"
+        }
+      }
+    }
+  }
+}
+
+

+description: user to add to the system
+required: true
+content:
+  text/plain:
+    schema:
+      type: array
+      items:
+        type: string
+
+

Media Type Object

+Each Media Type Object provides schema and examples for the media type identified by its key. +

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
schemaSchema Object | Reference ObjectThe schema defining the type used for the request body.
exampleAnyExample of the media type. The example object SHOULD be in the correct format as specified by the media type. The example object is mutually exclusive of the examples object. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema.
examplesMap[ string, Example Object | Reference Object]Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The examples object is mutually exclusive of the example object. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema.
encodingMap[string, Encoding Object]A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded.
+

This object MAY be extended with Specification Extensions.

+
Media Type Examples
+

+{
+  "application/json": {
+    "schema": {
+         "$ref": "#/components/schemas/Pet"
+    },
+    "examples": {
+      "cat" : {
+        "summary": "An example of a cat",
+        "value": 
+          {
+            "name": "Fluffy",
+            "petType": "Cat",
+            "color": "White",
+            "gender": "male",
+            "breed": "Persian"
+          }
+      },
+      "dog": {
+        "summary": "An example of a dog with a cat's name",
+        "value" :  { 
+          "name": "Puma",
+          "petType": "Dog",
+          "color": "Black",
+          "gender": "Female",
+          "breed": "Mixed"
+        },
+      "frog": {
+          "$ref": "#/components/examples/frog-example"
+        }
+      }
+    }
+  }
+}
+
+

+application/json: 
+  schema:
+    $ref: "#/components/schemas/Pet"
+  examples:
+    cat:
+      summary: An example of a cat
+      value:
+        name: Fluffy
+        petType: Cat
+        color: White
+        gender: male
+        breed: Persian
+    dog:
+      summary: An example of a dog with a cat's name
+      value:
+        name: Puma
+        petType: Dog
+        color: Black
+        gender: Female
+        breed: Mixed
+    frog:
+      $ref: "#/components/examples/frog-example"
+
+
Considerations for File Uploads
+

In contrast with the 2.0 specification, file input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically:

+

+# content transferred with base64 encoding
+schema:
+  type: string
+  format: base64
+
+

+# content transferred in binary (octet-stream):
+schema:
+  type: string
+  format: binary
+
+

These examples apply to either input payloads of file uploads or response payloads.

+

A requestBody for submitting a file in a POST operation may look like the following example:

+

+requestBody:
+  content:
+    application/octet-stream:
+      # any media type is accepted, functionally equivalent to `*/*`
+      schema:
+        # a binary file of any type
+        type: string
+        format: binary
+
+

In addition, specific media types MAY be specified:

+

+# multiple, specific media types may be specified:
+requestBody:
+  content:
+      # a binary file of type png or jpeg
+    'image/jpeg':
+      schema:
+        type: string
+        format: binary
+    'image/png':
+      schema:
+        type: string
+        format: binary        
+
+

To upload multiple files, a multipart media type MUST be used:

+

+requestBody:
+  content:
+    multipart/form-data:
+      schema:
+        properties:
+          # The property name 'file' will be used for all files.
+          file:
+            type: array
+            items:
+              type: string
+              format: binary
+
+
+

Support for x-www-form-urlencoded Request Bodies

+

To submit content using form url encoding via [[!rfc1866]], the following +definition may be used:

+

+requestBody:
+  content:
+    application/x-www-form-urlencoded:
+      schema:
+        type: object
+        properties:
+          id:
+            type: string
+            format: uuid
+          address:
+            # complex types are stringified to support RFC 1866
+            type: object
+            properties: {}
+
+

In this example, the contents in the requestBody MUST be stringified per [[!rfc1866]]) when passed to the server. In addition, the address field complex object will be stringified.

+

When passing complex objects in the application/x-www-form-urlencoded content type, the default serialization strategy of such properties is described in the Encoding Object's style property as form.

+

Special Considerations for multipart Content

+

It is common to use multipart/form-data as a Content-Type when transferring request bodies to operations. In contrast to 2.0, a schema is REQUIRED to define the input parameters to the operation when using multipart content. This supports complex structures as well as supporting mechanisms for multiple file uploads.

+

When passing in multipart types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default Content-Types are defined for multipart:

+
    +
  • If the property is a primitive, or an array of primitive values, the default Content-Type is text/plain
  • +
  • If the property is complex, or an array of complex values, the default Content-Type is application/json
  • +
  • If the property is a type: string with format: binary or format: base64 (aka a file object), the default Content-Type is application/octet-stream
  • +
+

Examples:

+

+requestBody:
+  content:
+    multipart/form-data:
+      schema:
+        type: object
+        properties:
+          id:
+            type: string
+            format: uuid
+          address:
+            # default Content-Type for objects is `application/json`
+            type: object
+            properties: {}
+          profileImage:
+            # default Content-Type for string/binary is `application/octet-stream`
+            type: string
+            format: binary
+          children:
+            # default Content-Type for arrays is based on the `inner` type (text/plain here)
+            type: array
+            items:
+              type: string
+          addresses:
+            # default Content-Type for arrays is based on the `inner` type (object shown, so `application/json` in this example)
+            type: array
+            items:
+              type: '#/components/schemas/Address'
+
+

An encoding attribute is introduced to give you control over the serialization of parts of multipart request bodies. This attribute is only applicable to multipart and application/x-www-form-urlencoded request bodies.

+

Encoding Object

+

A single encoding definition applied to a single schema property.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
contentTypestringThe Content-Type for encoding a specific property. Default value depends on the property type: for string with format being binaryapplication/octet-stream; for other primitive types – text/plain; for object - application/json; for array – the default is defined based on the inner type. The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types.
headersMap[string, Header Object | Reference Object]A map allowing additional information to be provided as headers, for example Content-Disposition. Content-Type is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a multipart.
stylestringDescribes how a specific property value will be serialized depending on its type. See Parameter Object for details on the style property. The behavior follows the same values as query parameters, including default values. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
explodebooleanWhen this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
allowReservedbooleanDetermines whether the parameter value SHOULD allow reserved characters, as defined by [[!rfc3986]]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
+

This object MAY be extended with Specification Extensions.

+
Encoding Object Example
+

+requestBody:
+  content:
+    multipart/mixed:
+      schema:
+        type: object
+        properties:
+          id:
+            # default is text/plain
+            type: string
+            format: uuid
+          address:
+            # default is application/json
+            type: object
+            properties: {}
+          historyMetadata:
+            # need to declare XML format!
+            description: metadata in XML format
+            type: object
+            properties: {}
+          profileImage:
+            # default is application/octet-stream, need to declare an image type only!
+            type: string
+            format: binary
+      encoding:
+        historyMetadata:
+          # require XML Content-Type in utf-8 encoding
+          contentType: application/xml; charset=utf-8
+        profileImage:
+          # only accept png/jpeg
+          contentType: image/png, image/jpeg
+          headers:
+            X-Rate-Limit-Limit:
+              description: The number of allowed requests in the current period
+              schema:
+                type: integer
+
+

Responses Object

+

A container for the expected responses of an operation. +The container maps a HTTP response code to the expected response.

+

The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. +However, documentation is expected to cover a successful operation response and any known errors.

+

The default MAY be used as a default response object for all HTTP codes +that are not covered individually by the specification.

+

The Responses Object MUST contain at least one response code, and it +SHOULD be the response for a successful operation call.

+

Fixed Fields

+ + + + + + + + + + + + + + + +
Field NameTypeDescription
defaultResponse Object | Reference ObjectThe documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. A Reference Object can link to a response that the OpenAPI Object’s components/responses section defines.
+
Patterned Fields
+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
HTTP Status CodeResponse Object | Reference ObjectAny HTTP status code can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A Reference Object can link to a response that is defined in the OpenAPI Object’s components/responses section. This field MUST be enclosed in quotation marks (for example, “200”) for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character X. For example, 2XX represents all response codes between [200-299]. The following range definitions are allowed: 1XX, 2XX, 3XX, 4XX, and 5XX. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code.
+

This object MAY be extended with Specification Extensions.

+
Responses Object Example
+

A 200 response for a successful operation and a default response for others (implying an error):

+

+{
+  "200": {
+    "description": "a pet to be returned",
+    "content": {
+      "application/json": {
+        "schema": {
+          "$ref": "#/components/schemas/Pet"
+        }
+      }
+    }
+  },
+  "default": {
+    "description": "Unexpected error",
+    "content": {
+      "application/json": {
+        "schema": {
+          "$ref": "#/components/schemas/ErrorModel"
+        }
+      }
+    }
+  }
+}
+
+

+'200':
+  description: a pet to be returned
+  content: 
+    application/json:
+      schema:
+        $ref: '#/components/schemas/Pet'
+default:
+  description: Unexpected error
+  content:
+    application/json:
+      schema:
+        $ref: '#/components/schemas/ErrorModel'
+
+

Response Object

+Describes a single response from an API Operation, including design-time, static +`links` to operations based on the response. +

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
descriptionstringREQUIRED. A short description of the response. CommonMark syntax MAY be used for rich text representation.
headersMap[string, Header Object | Reference Object]Maps a header name to its definition. [[!rfc7230]]page-22) states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored.
contentMap[string, Media Type Object]A map containing descriptions of potential response payloads. The key is a media type or [media type range]appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
linksMap[string, Link Object | Reference Object]A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for Component Objects.
+

This object MAY be extended with Specification Extensions.

+
Response Object Examples
+

Response of an array of a complex type:

+

+{
+  "description": "A complex object array response",
+  "content": {
+    "application/json": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/components/schemas/VeryComplexType"
+        }
+      }
+    }
+  }
+}
+
+

+description: A complex object array response
+content: 
+  application/json:
+    schema: 
+      type: array
+      items:
+        $ref: '#/components/schemas/VeryComplexType'
+
+

Response with a string type:

+

+{
+  "description": "A simple string response",
+  "content": {
+    "text/plain": {
+      "schema": {
+        "type": "string"
+      }
+    }
+  }
+
+}
+
+

+description: A simple string response
+representations:
+  text/plain:
+    schema:
+      type: string
+
+

Plain text response with headers:

+

+{
+  "description": "A simple string response",
+  "content": {
+    "text/plain": {
+      "schema": {
+        "type": "string"
+      }
+    }
+  },
+  "headers": {
+    "X-Rate-Limit-Limit": {
+      "description": "The number of allowed requests in the current period",
+      "schema": {
+        "type": "integer"
+      }
+    },
+    "X-Rate-Limit-Remaining": {
+      "description": "The number of remaining requests in the current period",
+      "schema": {
+        "type": "integer"
+      }
+    },
+    "X-Rate-Limit-Reset": {
+      "description": "The number of seconds left in the current period",
+      "schema": {
+        "type": "integer"
+      }
+    }
+  }
+}
+
+

+description: A simple string response
+content:
+  text/plain:
+    schema:
+      type: string
+    example: 'whoa!'
+headers:
+  X-Rate-Limit-Limit:
+    description: The number of allowed requests in the current period
+    schema:
+      type: integer
+  X-Rate-Limit-Remaining:
+    description: The number of remaining requests in the current period
+    schema:
+      type: integer
+  X-Rate-Limit-Reset:
+    description: The number of seconds left in the current period
+    schema:
+      type: integer
+
+

Response with no return value:

+

+{
+  "description": "object created"
+}
+
+

+description: object created
+
+

Callback Object

+

A map of possible out-of band callbacks related to the parent operation. +Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. +The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

+

Patterned Fields

+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
{expression}Path Item ObjectA Path Item Object used to define a callback request and expected responses. A complete example is available.
+

This object MAY be extended with Specification Extensions.

+
Key Expression
+

The key that identifies the Path Item Object is a runtime expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. +A simple example might be $request.body#/url. +However, using a runtime expression the complete HTTP message can be accessed. +This includes accessing any part of a body that a JSON Pointer [[!rfc6901]] can reference.

+

For example, given the following HTTP request:

+

+POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1
+Host: example.org
+Content-Type: application/json
+Content-Length: 187
+
+{
+  "failedUrl" : "http://clientdomain.com/failed",
+  "successUrls" : [
+    "http://clientdomain.com/fast",
+    "http://clientdomain.com/medium",
+    "http://clientdomain.com/slow"
+  ] 
+}
+
+201 Created
+Location: http://example.org/subscription/1
+
+

The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named eventType and a query parameter named queryUrl.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ExpressionValue
$urlhttp://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning
$methodPOST
$request.path.eventTypemyevent
$request.query.queryUrlhttp://clientdomain.com/stillrunning
$request.header.content-Typeapplication/json
$request.body#/failedUrlhttp://clientdomain.com/stillrunning
$request.body#/successUrls/2http://clientdomain.com/medium
$response.header.Locationhttp://example.org/subscription/1
+
Callback Object Example
+

The following example shows a callback to the URL specified by the id and email property in the request body.

+

+myWebhook:
+  'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
+    post:
+      requestBody:
+        description: Callback payload
+        content: 
+          'application/json':
+            schema:
+              $ref: '#/components/schemas/SomePayload'
+      responses:
+        '200':
+          description: webhook successfully processed and no retries will be performed
+
+

Example Object

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
summarystringShort description for the example.
descriptionstringLong description for the example. CommonMark syntax MAY be used for rich text representation.
valueAnyEmbedded literal example. The value field and externalValue field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary.
externalValuestringA URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The value field and externalValue field are mutually exclusive.
+

This object MAY be extended with Specification Extensions.

+

In all cases, the example value is expected to be compatible with the type schema +of its associated value. Tooling implementations MAY choose to +validate compatibility automatically, and reject the example value(s) if incompatible.

+
Example Object Example
+

+# in a model
+schemas:
+  properties:
+    name:
+      type: string
+      examples:
+        name:
+          $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example
+
+# in a request body:
+  requestBody:
+    content:
+      'application/json':
+        schema:
+          $ref: '#/components/schemas/Address'
+        examples: 
+          foo:
+            summary: A foo example
+            value: {"foo": "bar"}
+          bar:
+            summary: A bar example
+            value: {"bar": "baz"}
+      'application/xml':
+        examples: 
+          xmlExample:
+            summary: This is an example in XML
+            externalValue: 'http://example.org/examples/address-example.xml'
+      'text/plain':
+        examples:
+          textExample: 
+            summary: This is a text example
+            externalValue: 'http://foo.bar/examples/address-example.txt' 
+
+
+# in a parameter
+  parameters:
+    - name: 'zipCode'
+      in: 'query'
+      schema:
+        type: 'string'
+        format: 'zip-code'
+        examples:
+          zip-example: 
+            $ref: '#/components/examples/zip-example'
+
+# in a response
+  responses:
+    '200':
+      description: your car appointment has been booked
+      content: 
+        application/json:
+          schema:
+            $ref: '#/components/schemas/SuccessResponse'
+          examples:
+            confirmation-success:
+              $ref: '#/components/examples/confirmation-success'
+
+

Link Object

+

The Link object represents a possible design-time link for a response. +The presence of a link does not guarantee the caller’s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.

+

Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.

+

For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
operationRefstringA relative or absolute reference to an OAS operation. This field is mutually exclusive of the operationId field, and MUST point to an Operation Object. Relative operationRef values MAY be used to locate an existing Operation Object in the OpenAPI definition.
operationIdstringThe name of an existing, resolvable OAS operation, as defined with a unique operationId. This field is mutually exclusive of the operationRef field.
parametersMap[string, Any | {expression}]A map representing parameters to pass to an operation as specified with operationId or identified via operationRef. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id).
requestBodyAny | {expression}A literal value or {expression} to use as a request body when calling the target operation.
descriptionstringA description of the link. CommonMark syntax MAY be used for rich text representation.
serverServer ObjectA server object to be used by the target operation.
+

This object MAY be extended with Specification Extensions.

+

A linked operation MUST be identified using either an operationRef or operationId. +In the case of an operationId, it MUST be unique and resolved in the scope of the OAS document. +Because of the potential for name clashes, the operationRef syntax is preferred +for specifications with external references.

+

Examples

+

Computing a link from a request operation where the $request.path.id is used to pass a request parameter to the linked operation.

+

+paths:
+  /users/{id}:
+    parameters:
+    - name: id
+      in: path
+      required: true
+      description: the user identifier, as userId 
+      schema:
+        type: string
+    get:
+      responses:
+        '200':
+          description: the user being returned
+          content:
+            application/json:
+              schema:
+                type: object
+                properties:
+                  uuid: # the unique user id
+                    type: string
+                    format: uuid
+        links:
+          address:
+            # the target link operationId
+            operationId: getUserAddress
+            parameters:
+              # get the `id` field from the request path parameter named `id`
+              userId: $request.path.id
+  # the path item of the linked operation
+  /users/{userid}/address:
+    parameters:
+    - name: userid
+      in: path
+      required: true
+      description: the user identifier, as userId 
+      schema:
+        type: string
+      # linked operation
+      get:
+        operationId: getUserAddress
+        responses:
+          '200':
+            description: the user's address
+
+

When a runtime expression fails to evaluate, no parameter value is passed to the target operation.

+

Values from the response body can be used to drive a linked operation.

+

+links:
+  address:
+    operationId: getUserAddressByUUID
+    parameters:
+      # get the `id` field from the request path parameter named `id`
+      userUuid: $response.body#/uuid
+
+

Clients follow all links at their discretion. +Neither permissions, nor the capability to make a successful call to that link, is guaranteed +solely by the existence of a relationship.

+

OperationRef Examples

+

As references to operationId MAY NOT be possible (the operationId is an optional +value), references MAY also be made through a relative operationRef:

+

+links:
+  UserRepositories:
+    # returns array of '#/components/schemas/repository'
+    operationRef: '#/paths/~12.0~1repositories~1{username}/get'
+    parameters:
+      username: $response.body#/username
+
+

or an absolute operationRef:

+

+links:
+  UserRepositories:
+    # returns array of '#/components/schemas/repository'
+    operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get'
+    parameters:
+      username: $response.body#/username
+
+

Note that in the use of operationRef, the escaped forward-slash is necessary when +using JSON references.

+
Runtime Expressions
+

Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. +This mechanism is used by Link Objects and Callback Objects.

+

The runtime expression is defined by the following [Advanced Backus-Naur Form] syntax

+

+      expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source )
+      source = ( header-reference | query-reference | path-reference | body-reference )  
+      header-reference = "header." token
+      query-reference = "query." name  
+      path-reference = "path." name
+      body-reference = "body" ["#" fragment]
+      fragment = a JSON Pointer [RFC 6901]  
+      name = *( char )
+      char = as per RFC [7159]section-7)
+      token = as per RFC [7230]section-3.2.6)
+
+

The name identifier is case-sensitive, whereas token is not.

+

The table below provides examples of runtime expressions and examples of their use in a value:

+
Examples
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source Locationexample expressionnotes
HTTP Method$methodThe allowable values for the $method will be those for the HTTP operation.
Requested media type$request.header.accept
Request parameter$request.path.idRequest parameters MUST be declared in the parameters section of the parent operation or they cannot be evaluated. This includes request headers.
Request body property$request.body#/user/uuidIn operations which accept payloads, references may be made to portions of the requestBody or the entire body.
Request URL$url
Response value$response.body#/statusIn operations which return payloads, references may be made to portions of the response body or the entire body.
Response header$response.header.ServerSingle header values only are available
+

Runtime expressions preserve the type of the referenced value. +Expressions can be embedded into string values by surrounding the expression with {} curly braces.

+

Header Object

+

The Header Object follows the structure of the Parameter Object with the following changes:

+
    +
  1. name MUST NOT be specified, it is given in the corresponding headers map.
  2. +
  3. in MUST NOT be specified, it is implicitly in header.
  4. +
  5. All traits that are affected by the location MUST be applicable to a location of header (for example, style).
  6. +
+

Header Object Example

+

A simple header of type integer:

+

+{
+  "description": "The number of allowed requests in the current period",
+  "schema": {
+    "type": "integer"
+  }
+}
+
+

+description: The number of allowed requests in the current period
+schema:
+  type: integer
+
+

Tag Object

+

Adds metadata to a single tag that is used by the Operation Object. +It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
namestringREQUIRED. The name of the tag.
descriptionstringA short description for the tag. CommonMark syntax MAY be used for rich text representation.
externalDocsExternal Documentation ObjectAdditional external documentation for this tag.
+

This object MAY be extended with Specification Extensions.

+
Tag Object Example
+

+{
+	"name": "pet",
+	"description": "Pets operations"
+}
+
+

+name: pet
+description: Pets operations
+
+

Examples Object

+

In an example, a JSON Reference MAY be used, with the +explicit restriction that examples having a JSON format with object named +$ref are not allowed. Therefore, that example, structurally, can be +either a string primitive or an object, similar to additionalProperties.

+

In all cases, the payload is expected to be compatible with the type schema +for the associated value. Tooling implementations MAY choose to +validate compatibility automatically, and reject the example value(s) if they +are incompatible.

+

+# in a model
+schemas:
+  properties:
+    name:
+      type: string
+      example:
+        $ref: http://foo.bar#/examples/name-example
+
+# in a request body, note the plural `examples`
+  requestBody:
+    content:
+      'application/json':
+        schema:
+          $ref: '#/components/schemas/Address'
+        examples:
+          foo:
+            value: {"foo": "bar"}
+          bar:
+            value: {"bar": "baz"}
+      'application/xml':
+        examples:
+          xml:
+            externalValue: 'http://foo.bar/examples/address-example.xml'
+      'text/plain':
+        examples:
+          text:
+            externalValue: 'http://foo.bar/examples/address-example.txt'
+        
+# in a parameter
+  parameters:
+    - name: 'zipCode'
+      in: 'query'
+      schema:
+        type: 'string'
+        format: 'zip-code'
+        example: 
+          $ref: 'http://foo.bar#/examples/zip-example'
+
+# in a response, note the singular `example`:
+  responses:
+    '200':
+      description: your car appointment has been booked
+      content: 
+        application/json:
+          schema:
+            $ref: '#/components/schemas/SuccessResponse'
+          example:
+            $ref: http://foo.bar#/examples/address-example.json
+
+

Reference Object

+

A simple object to allow referencing other components in the specification, internally and externally.

+

The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.

+

For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.

+

Fixed Fields

+ + + + + + + + + + + + + + + +
Field NameTypeDescription
$refstringREQUIRED. The reference string.
+

This object cannot be extended with additional properties and any properties added SHALL be ignored.

+

Reference Object Example

+

+{
+	"$ref": "#/components/schemas/Pet"
+}
+
+

+$ref: '#/components/schemas/Pet'
+
+

Relative Schema Document Example

+

+{
+  "$ref": "Pet.json"
+}
+
+

+$ref: Pet.yaml
+
+
Relative Documents With Embedded Schema Example
+

+{
+  "$ref": "definitions.json#/Pet"
+}
+
+

+$ref: definitions.yaml#/Pet
+
+

Schema Object

+

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 an extended subset of the JSON Schema Specification Wright Draft 00.

+

For more information about the properties, see JSON Schema Core and JSON Schema Validation. +Unless stated otherwise, the property definitions follow the JSON Schema.

+

Properties

+

The following properties are taken directly from the JSON Schema definition and follow the same specifications:

+
    +
  • title
  • +
  • multipleOf
  • +
  • maximum
  • +
  • exclusiveMaximum
  • +
  • minimum
  • +
  • exclusiveMinimum
  • +
  • maxLength
  • +
  • minLength
  • +
  • pattern (This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect)
  • +
  • maxItems
  • +
  • minItems
  • +
  • uniqueItems
  • +
  • maxProperties
  • +
  • minProperties
  • +
  • required
  • +
  • enum
  • +
+

The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification.

+
    +
  • type - Value MUST be a string. Multiple types via an array are not supported.
  • +
  • allOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
  • +
  • oneOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
  • +
  • anyOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
  • +
  • not - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
  • +
  • items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. items MUST be present if the type is array.
  • +
  • properties - Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced).
  • +
  • additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
  • +
  • description - CommonMark syntax MAY be used for rich text representation.
  • +
  • format - See Data Type Formats for further details. While relying on JSON Schema’s defined formats, the OAS offers a few additional predefined formats.
  • +
  • default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if type is string, then default can be "foo" but cannot be 1.
  • +
+

Alternatively, any time a Schema Object can be used, a Reference Object can be used in its place. This allows referencing definitions instead of defining them inline.

+

Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported.

+

Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation:

+
Fixed Fields
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
nullablebooleanAllows sending a null value for the defined schema. Default value is false.
discriminatorDiscriminator ObjectAdds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See Composition and Inheritance for more details.
readOnlybooleanRelevant only for Schema "properties" definitions. Declares the property as “read only”. This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.
writeOnlybooleanRelevant only for Schema "properties" definitions. Declares the property as “write only”. Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as writeOnly being true and is in the required list, the required will take effect on the request only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.
xmlXML ObjectThis MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property.
externalDocsExternal Documentation ObjectAdditional external documentation for this schema.
exampleAnyA free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary.
deprecatedbooleanSpecifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false.
+

This object MAY be extended with Specification Extensions.

+
Composition and Inheritance (Polymorphism)
+

The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. +allOf takes an array of object definitions that are validated independently but together compose a single object.

+

While composition offers model extensibility, it does not imply a hierarchy between the models. +To support polymorphism, the OpenAPI Specification adds the discriminator field. +When used, the discriminator will be the name of the property that decides which schema definition validates the structure of the model. +As such, the discriminator field MUST be a required field. +There are are two ways to define the value of a discriminator for an inheriting instance.

+
    +
  • Use the schema name.
  • +
  • Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name.
  • +
+

As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism.

+
XML Modeling
+

The xml property allows extra definitions when translating the JSON definition to XML. +The XML Object contains additional information about the available options.

+
Schema Object Examples
+
Primitive Sample
+

+{
+  "type": "string",
+  "format": "email"
+}
+
+

+type: string
+format: email
+
+
Simple Model
+

+{
+  "type": "object",
+  "required": [
+    "name"
+  ],
+  "properties": {
+    "name": {
+      "type": "string"
+    },
+    "address": {
+      "$ref": "#/components/schemas/Address"
+    },
+    "age": {
+      "type": "integer",
+      "format": "int32",
+      "minimum": 0
+    }
+  }
+}
+
+

+type: object
+required:
+- name
+properties:
+  name:
+    type: string
+  address:
+    $ref: '#/components/schemas/Address'
+  age:
+    type: integer
+    format: int32
+    minimum: 0
+
+
Model with Map/Dictionary Properties
+

For a simple string to string mapping:

+

+{
+  "type": "object",
+  "additionalProperties": {
+    "type": "string"
+  }
+}
+
+

+type: object
+additionalProperties:
+  type: string
+
+

For a string to model mapping:

+

+{
+  "type": "object",
+  "additionalProperties": {
+    "$ref": "#/components/schemas/ComplexModel"
+  }
+}
+
+

+type: object
+additionalProperties:
+  $ref: '#/components/schemas/ComplexModel'
+
+
Model with Example
+

+{
+  "type": "object",
+  "properties": {
+    "id": {
+      "type": "integer",
+      "format": "int64"
+    },
+    "name": {
+      "type": "string"
+    }
+  },
+  "required": [
+    "name"
+  ],
+  "example": {
+    "name": "Puma",
+    "id": 1
+  }
+}
+
+

+type: object
+properties:
+  id:
+    type: integer
+    format: int64
+  name:
+    type: string
+required:
+- name
+example:
+  name: Puma
+  id: 1
+
+
Models with Composition
+

+{
+  "components": {
+    "schemas": {
+      "ErrorModel": {
+        "type": "object",
+        "required": [
+          "message",
+          "code"
+        ],
+        "properties": {
+          "message": {
+            "type": "string"
+          },
+          "code": {
+            "type": "integer",
+            "minimum": 100,
+            "maximum": 600
+          }
+        }
+      },
+      "ExtendedErrorModel": {
+        "allOf": [
+          {
+            "$ref": "#/components/schemas/ErrorModel"
+          },
+          {
+            "type": "object",
+            "required": [
+              "rootCause"
+            ],
+            "properties": {
+              "rootCause": {
+                "type": "string"
+              }
+            }
+          }
+        ]
+      }
+    }
+  }
+}
+
+

+components:
+  schemas:
+    ErrorModel:
+      type: object
+      required:
+      - message
+      - code
+      properties:
+        message:
+          type: string
+        code:
+          type: integer
+          minimum: 100
+          maximum: 600
+    ExtendedErrorModel:
+      allOf:
+      - $ref: '#/components/schemas/ErrorModel'
+      - type: object
+        required:
+        - rootCause
+        properties:
+          rootCause:
+            type: string
+
+
Models with Polymorphism Support
+

+{
+  "components": {
+    "schemas": {
+      "Pet": {
+        "type": "object",
+        "discriminator": {
+          "propertyName": "petType"
+        },
+        "properties": {
+          "name": {
+            "type": "string"
+          },
+          "petType": {
+            "type": "string"
+          }
+        },
+        "required": [
+          "name",
+          "petType"
+        ]
+      },
+      "Cat": {
+        "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.",
+        "allOf": [
+          {
+            "$ref": "#/components/schemas/Pet"
+          },
+          {
+            "type": "object",
+            "properties": {
+              "huntingSkill": {
+                "type": "string",
+                "description": "The measured skill for hunting",
+                "default": "lazy",
+                "enum": [
+                  "clueless",
+                  "lazy",
+                  "adventurous",
+                  "aggressive"
+                ]
+              }
+            },
+            "required": [
+              "huntingSkill"
+            ]
+          }
+        ]
+      },
+      "Dog": {
+        "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.",
+        "allOf": [
+          {
+            "$ref": "#/components/schemas/Pet"
+          },
+          {
+            "type": "object",
+            "properties": {
+              "packSize": {
+                "type": "integer",
+                "format": "int32",
+                "description": "the size of the pack the dog is from",
+                "default": 0,
+                "minimum": 0
+              }
+            },
+            "required": [
+              "packSize"
+            ]
+          }
+        ]
+      }
+    }
+  }
+}
+
+

+components:
+  schemas:
+    Pet:
+      type: object
+      discriminator:
+        propertyName: petType
+      properties:
+        name:
+          type: string
+        petType:
+          type: string
+      required:
+      - name
+      - petType
+    Cat:  ## "Cat" will be used as the discriminator value
+      description: A representation of a cat
+      allOf:
+      - $ref: '#/components/schemas/Pet'
+      - type: object
+        properties:
+          huntingSkill:
+            type: string
+            description: The measured skill for hunting
+            enum:
+            - clueless
+            - lazy
+            - adventurous
+            - aggressive
+        required:
+        - huntingSkill
+    Dog:  ## "Dog" will be used as the discriminator value
+      description: A representation of a dog
+      allOf:
+      - $ref: '#/components/schemas/Pet'
+      - type: object
+        properties:
+          packSize:
+            type: integer
+            format: int32
+            description: the size of the pack the dog is from
+            default: 0
+            minimum: 0
+        required:
+        - packSize
+
+

Discriminator Object

+

When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

+

When using the discriminator, inline schemas will not be considered.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
propertyNamestringREQUIRED. The name of the property in the payload that will hold the discriminator value.
mappingMap[string, string]An object to hold mappings between payload values and schema names or references.
+

The discriminator attribute is legal only when using one of the composite keywords oneOf, anyOf, allOf.

+

In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:

+

+MyResponseType:
+  oneOf:
+  - $ref: '#/components/schemas/Cat'
+  - $ref: '#/components/schemas/Dog'
+  - $ref: '#/components/schemas/Lizard'
+
+

which means the payload MUST, by validation, match exactly one of the schemas described by Cat, Dog, or Lizard. In this case, a discriminator MAY act as a “hint” to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use:

+

+MyResponseType:
+  oneOf:
+  - $ref: '#/components/schemas/Cat'
+  - $ref: '#/components/schemas/Dog'
+  - $ref: '#/components/schemas/Lizard'
+  discriminator:
+    propertyName: pet_type
+
+

The expectation now is that a property with name pet_type MUST be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload:

+

+{
+  "id": 12345,
+  "pet_type": "Cat"
+}
+
+

Will indicate that the Cat schema be used in conjunction with this payload.

+

In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional mapping definition MAY be used:

+

+MyResponseType:
+  oneOf:
+  - $ref: '#/components/schemas/Cat'
+  - $ref: '#/components/schemas/Dog'
+  - $ref: '#/components/schemas/Lizard'
+  - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json'
+  discriminator:
+    propertyName: pet_type
+    mapping:
+      dog: '#/components/schemas/Dog'
+      monster: 'https://gigantic-server.com/schemas/Monster/schema.json'
+
+

Here the discriminator value of dog will map to the schema #/components/schemas/Dog, rather than the default (implicit) value of Dog. If the discriminator value does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison.

+

When used in conjunction with the anyOf construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload.

+

In both the oneOf and anyOf use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an allOf construct may be used as an alternate schema.

+

For example:

+

+components:
+  schemas:
+    Pet:
+      type: object
+      required:
+      - pet_type
+      properties:
+        pet_type:
+          type: string
+      discriminator:
+        propertyName: pet_type
+        mapping:
+          cachorro: Dog
+    Cat:
+      allOf:
+      - $ref: '#/components/schemas/Pet'
+      - type: object
+        # all other properties specific to a `Cat`
+        properties:
+          name:
+            type: string
+    Dog:
+      allOf:
+      - $ref: '#/components/schemas/Pet'
+      - type: object
+        # all other properties specific to a `Dog`
+        properties:
+          bark:
+            type: string
+    Lizard:
+      allOf:
+      - $ref: '#/components/schemas/Pet'
+      - type: object
+        # all other properties specific to a `Lizard`
+        properties:
+          lovesRocks:
+            type: boolean
+
+

a payload like this:

+

+{
+  "pet_type": "Cat",
+  "name": "misty"
+}
+
+

will indicate that the Cat schema be used. Likewise this schema:

+

+{
+  "pet_type": "cachorro",
+  "bark": "soft"
+}
+
+

will map to Dog because of the definition in the mappings element.

+

XML Object

+

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.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
namestringReplaces the name of the element/attribute used for the described schema property. When defined within 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.
namespacestringThe URI of the namespace definition. Value MUST be in the form of an absolute URI.
prefixstringThe prefix to be used for the name.
attributebooleanDeclares whether the property definition translates to an attribute instead of an element. Default value is false.
wrappedbooleanMAY 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).
+

This object MAY be extended with Specification Extensions.

+
XML Object Examples
+

The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

+
No XML Element
+

Basic string property:

+

+{
+    "animals": {
+        "type": "string"
+    }
+}
+
+

+animals:
+  type: string
+
+

+<animals>...</animals>
+
+

Basic string array property (wrapped is false by default):

+

+{
+    "animals": {
+        "type": "array",
+        "items": {
+            "type": "string"
+        }
+    }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+
+

+<animals>...</animals>
+<animals>...</animals>
+<animals>...</animals>
+
+
XML Name Replacement
+

+{
+  "animals": {
+    "type": "string",
+    "xml": {
+      "name": "animal"
+    }
+  }
+}
+
+

+animals:
+  type: string
+  xml:
+    name: animal
+
+

+<animal>...</animal>
+
+
XML Attribute, Prefix and Namespace
+

In this example, a full model definition is shown.

+

+{
+  "Person": {
+    "type": "object",
+    "properties": {
+      "id": {
+        "type": "integer",
+        "format": "int32",
+        "xml": {
+          "attribute": true
+        }
+      },
+      "name": {
+        "type": "string",
+        "xml": {
+          "namespace": "http://example.com/schema/sample",
+          "prefix": "sample"
+        }
+      }
+    }
+  }
+}
+
+

+Person:
+  type: object
+  properties:
+    id:
+      type: integer
+      format: int32
+      xml:
+        attribute: true
+    name:
+      type: string
+      xml:
+        namespace: http://example.com/schema/sample
+        prefix: sample
+
+

+<Person id="123">
+    <sample:name xmlns:sample="http://example.com/schema/sample">example</sample:name>
+</Person>
+
+
XML Arrays
+

Changing the element names:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+
+

+<animal>value</animal>
+<animal>value</animal>
+
+

The external name property has no effect on the XML:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    },
+    "xml": {
+      "name": "aliens"
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+  xml:
+    name: aliens
+
+

+<animal>value</animal>
+<animal>value</animal>
+
+

Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    },
+    "xml": {
+      "wrapped": true
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+  xml:
+    wrapped: true
+
+

+<animals>
+  <animals>value</animals>
+  <animals>value</animals>
+</animals>
+
+

To overcome the naming problem in the example above, the following definition can be used:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    },
+    "xml": {
+      "wrapped": true
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+  xml:
+    wrapped: true
+
+

+<animals>
+  <animal>value</animal>
+  <animal>value</animal>
+</animals>
+
+

Affecting both internal and external names:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    },
+    "xml": {
+      "name": "aliens",
+      "wrapped": true
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+  xml:
+    name: aliens
+    wrapped: true
+
+

+<aliens>
+  <animal>value</animal>
+  <animal>value</animal>
+</aliens>
+
+

If we change the external element but not the internal ones:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    },
+    "xml": {
+      "name": "aliens",
+      "wrapped": true
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+  xml:
+    name: aliens
+    wrapped: true
+
+

+<aliens>
+  <aliens>value</aliens>
+  <aliens>value</aliens>
+</aliens>
+
+

Security Scheme Object

+

Defines a security scheme that can be used by the operations. +Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [[!rfc6749]], and OpenID Connect Discovery.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeApplies ToDescription
typestringAnyREQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "oauth2", "openIdConnect".
descriptionstringAnyA short description for security scheme. CommonMark syntax MAY be used for rich text representation.
namestringapiKeyREQUIRED. The name of the header, query or cookie parameter to be used.
instringapiKeyREQUIRED. The location of the API key. Valid values are "query", "header" or "cookie".
schemestringhttpREQUIRED. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235]section-5.1).
bearerFormatstringhttp ("bearer")A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes.
flowsOAuth Flows Objectoauth2REQUIRED. An object containing configuration information for the flow types supported.
openIdConnectUrlstringopenIdConnectREQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL.
+

This object MAY be extended with Specification Extensions.

+
Security Scheme Object Example
+
Basic Authentication Sample
+

+{
+  "type": "http",
+  "scheme": "basic"
+}
+
+

+type: http
+scheme: basic
+
+
API Key Sample
+

+{
+  "type": "apiKey",
+  "name": "api_key",
+  "in": "header"
+}
+
+

+type: apiKey
+name: api_key
+in: header
+
+
JWT Bearer Sample
+

+{
+  "type": "http",
+  "scheme": "bearer",
+  "bearerFormat": "JWT",
+}
+
+

+type: http
+scheme: bearer
+bearerFormat: JWT
+
+
Implicit OAuth2 Sample
+

+{
+  "type": "oauth2",
+  "flows": {
+    "implicit": {
+      "authorizationUrl": "https://example.com/api/oauth/dialog",
+      "scopes": {
+        "write:pets": "modify pets in your account",
+        "read:pets": "read your pets"
+      }
+    }
+  }
+}
+
+

+type: oauth2
+flows: 
+  implicit:
+    authorizationUrl: https://example.com/api/oauth/dialog
+    scopes:
+      write:pets: modify pets in your account
+      read:pets: read your pets
+
+

OAuth Flows Object

+

Allows configuration of the supported OAuth Flows.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
implicitOAuth Flow ObjectConfiguration for the OAuth Implicit flow
passwordOAuth Flow ObjectConfiguration for the OAuth Resource Owner Password flow
clientCredentialsOAuth Flow ObjectConfiguration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0.
authorizationCodeOAuth Flow ObjectConfiguration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.
+

This object MAY be extended with Specification Extensions.

+

OAuth Flow Object

+

Configuration details for a supported OAuth Flow

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeApplies ToDescription
authorizationUrlstringoauth2 ("implicit", "authorizationCode")REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL.
tokenUrlstringoauth2 ("password", "clientCredentials", "authorizationCode")REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL.
refreshUrlstringoauth2The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.
scopesMap[string, string]oauth2REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it.
+

This object MAY be extended with Specification Extensions.

+
OAuth Flow Object Examples
+

+{
+  "type": "oauth2",
+  "flows": {
+    "implicit": {
+      "authorizationUrl": "https://example.com/api/oauth/dialog",
+      "scopes": {
+        "write:pets": "modify pets in your account",
+        "read:pets": "read your pets"
+      }
+    },
+    "authorizationCode": {
+      "authorizationUrl": "https://example.com/api/oauth/dialog",
+      "tokenUrl": "https://example.com/api/oauth/token",
+      "scopes": {
+        "write:pets": "modify pets in your account",
+        "read:pets": "read your pets"
+      }
+    }
+  }
+}
+
+

+type: oauth2
+flows: 
+  implicit:
+    authorizationUrl: https://example.com/api/oauth/dialog
+    scopes:
+      write:pets: modify pets in your account
+      read:pets: read your pets
+  authorizationCode:
+    authorizationUrl: https://example.com/api/oauth/dialog
+    tokenUrl: https://example.com/api/oauth/token
+    scopes:
+      write:pets: modify pets in your account
+      read:pets: read your pets 
+
+

Security Requirement Object

+

Lists the required security schemes to execute this operation. +The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.

+

Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. +This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.

+

When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.

+

Patterned Fields

+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
{name}[string]Each name MUST correspond to a security scheme which is declared in the Security Schemes under the Components Object. If the security scheme is of type "oauth2" or "openIdConnect", then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty.
+
Security Requirement Object Examples
+
Non-OAuth2 Security Requirement
+

+{
+  "api_key": []
+}
+
+

+api_key: []
+
+
OAuth2 Security Requirement
+

+{
+  "petstore_auth": [
+    "write:pets",
+    "read:pets"
+  ]
+}
+
+

+petstore_auth:
+- write:pets
+- read:pets
+
+

Specification Extensions

+

While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

+

The extensions properties are implemented as patterned fields that are always prefixed by "x-".

+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
^x-AnyAllows extensions to the OpenAPI Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. 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).

+

Security Filtering

+

Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.

+

The reasoning is to allow an additional layer of access control over the documentation. +While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.

+

Two examples of this:

+
    +
  1. The Paths Object MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication.
  2. +
  3. The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object, so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see.
  4. +
+

Appendix A: Revision History

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VersionDateNotes
3.0.02017-07-26Release of the OpenAPI Specification 3.0.0
3.0.0-rc22017-06-16rc2 of the 3.0 specification
3.0.0-rc12017-04-27rc1 of the 3.0 specification
3.0.0-rc02017-02-28Implementer’s Draft of the 3.0 specification
2.02015-12-31Donation of Swagger 2.0 to the Open API Initiative
2.02014-09-08Release of Swagger 2.0
1.22014-03-14Initial release of the formal document.
1.12012-08-22Release of Swagger 1.1
1.02011-08-10First release of the Swagger Specification
+ diff --git a/bikeshed/md2bs.js b/bikeshed/md2bs.js new file mode 100644 index 0000000000..71804ed8b0 --- /dev/null +++ b/bikeshed/md2bs.js @@ -0,0 +1,93 @@ +/* bikeshed claims to support markdown syntax, but not (yet) commonmark. +Hence we render the markdown to HTML ourselves, this gives us +complete control over formatting and syntax highlighting (where +highlight.js does a better job than bikeshed's Pygments) */ + +/** +@author Mike Ralphson +**/ + +const fs = require('fs'); +const hljs = require('highlightjs/highlight.pack.js'); +const md = require('markdown-it')({ + html: true, + linkify: true, + typographer: true, + highlight: function (str, lang) { + if (lang && hljs.getLanguage(lang)) { + try { + return '
' +
+                  hljs.highlight(lang, str, true).value +
+                  '
'; + } catch (__) { } + } + + return '
' + md.utils.escapeHtml(str) + '
'; + } +}); +let s = fs.readFileSync(process.argv[2],'utf8'); + +let lines = s.split('\r').join().split('\n'); + +let prevIndent = 0; + +for (let l in lines) { + let line = lines[l]; + + if (line.startsWith('#') && line.indexOf('prevIndent+1) { + indent = prevIndent+1; + } + + let comp = line.split(''); + let title = comp[1]; + let link = comp[0].split(''); + prevIndent = indent-1; + } + + if (line.indexOf('">')>=0) { + line = line.replace(' name=',' id='); + line = line.replace('">','"> '); + } + + if (line.indexOf('[RFC')>=0) { + line = line.replace(/\[RFC([0-9]{1,5})\]/g,function(match,group1){ + console.warn('Fixing RFC reference',match,group1); + return '[[!rfc'+group1+']]'; + }); + } + + while (line.indexOf('https://tools.ietf.org/html/rfc')>=0) { + line = line.replace(/.https:..tools.ietf.org.html.rfc[0-9]{1,5}./g,''); + } + while (line.indexOf('http://tools.ietf.org/html/rfc')>=0) { + line = line.replace(/.http:..tools.ietf.org.html.rfc[0-9]{1,5}./g,''); + } + + if (line.indexOf('[ABNF]')>=0) { + line = line.replace('[ABNF]','[Advanced Backus-Naur Form]'); + } + + if (line.startsWith('#')) { + let indent = 0; + while (line[indent] === '#') indent++; + if (indent>prevIndent+1) { + line = line.replace('#'.repeat(indent),'#'.repeat(prevIndent+1)); + indent = prevIndent+1; + } + prevIndent = indent; + } + + if (line.startsWith('```')) line += '\n'; // fixes formatting of first line of syntax-highlighted blocks + + lines[l] = line; + +} + +s = lines.join('\n'); +console.log(md.render(s)); diff --git a/bikeshed/oas_3.0.0.err b/bikeshed/oas_3.0.0.err new file mode 100644 index 0000000000..51499ac0a9 --- /dev/null +++ b/bikeshed/oas_3.0.0.err @@ -0,0 +1,3 @@ +Error running preprocessor, returned code: 1. +\033[1;31mFATAL ERROR:\033[0m Found unmatched text macro [R]. Correct the macro, or escape it with a leading backslash. +\033[7;31m ✘ \033[0m Did not generate, due to fatal errors \ No newline at end of file diff --git a/bikeshed/oas_3.0.0.html b/bikeshed/oas_3.0.0.html new file mode 100644 index 0000000000..8a26b571b8 --- /dev/null +++ b/bikeshed/oas_3.0.0.html @@ -0,0 +1,5684 @@ + + + + OpenAPI Specification + + + + + + + + + + + + +
+

+

OpenAPI Specification

+

Living Standard,

+
+
+
This version: +
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md +
Issue Tracking: +
GitHub +
Editors: +
Darrel Miller +
Jeremy Whitlock +
Marsh Gardiner +
Ron Ratovsky +
Former Editors: +
Jason Harmon +
Tony Tam +
+
+
+ +
+
+
+

Abstract

+

The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

+
+
+ +
+ + + +

Open API Initiative logo

+

1. Version 3.0.0

+

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [rfc2119] [rfc8174] when, and only when, they appear in all capitals, as shown here.

+

This document is licensed under The Apache License, Version 2.0.

+

2. Introduction

+

The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.

+

An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.

+

3. Definitions

+

3.1. OpenAPI Document

+ A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification. +

3.2. Path Templating

+ Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. +

3.3. Media Types

+ Media type definitions are spread across several resources. +The media type definitions SHOULD be in compliance with [rfc6838]. +

Some examples of possible media type definitions:

+
text/plain; charset=utf-8
+application/json
+application/vnd.github+json
+application/vnd.github.v3+json
+application/vnd.github.v3.raw+json
+application/vnd.github.v3.text+json
+application/vnd.github.v3.html+json
+application/vnd.github.v3.full+json
+application/vnd.github.v3.diff
+application/vnd.github.v3.patch
+
+

3.4. HTTP Status Codes

+ The HTTP Status Codes are used to indicate the status of the executed operation. +The available status codes are defined by [rfc7231]section-6) and registered status codes are listed in the IANA Status Code Registry. +

4. Specification

+

4.1. Versions

+

The OpenAPI Specification is versioned using Semantic Versioning 2.0.0 (semver) and follows the semver specification.

+

The major.minor portion of the semver (for example 3.0) SHALL designate the OAS feature set. Typically, .patch versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between 3.0.0 and 3.0.1 for example.

+

Subsequent minor version releases of the OpenAPI Specification (incrementing the minor version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical 3.1.0 specification SHOULD be usable with tooling designed for 3.0.0.

+

An OpenAPI document compatible with OAS 3.. contains a required openapi field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named swagger and value "2.0".)

+

4.2. Format

+

An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format.

+

For example, if a field has an array value, the JSON array representation will be used:

+
{
+   "field": [ 1, 2, 3 ]
+}
+
+

All field names in the specification are case sensitive.

+

The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name.

+

Patterned fields MUST have unique names within the containing object.

+

In order to preserve the ability to round-trip between YAML and JSON formats, YAML version 1.2 is RECOMMENDED along with some additional constraints:

+ +

Note: While APIs may be defined by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML.

+

4.3. Document Structure

+

An OpenAPI document MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the user. In the latter case, $ref fields MUST be used in the specification to reference those parts as follows from the JSON Schema definitions.

+

It is RECOMMENDED that the root OpenAPI document be named: openapi.json or openapi.yaml.

+

4.4. Data Types

+

Primitive data types in the OAS are based on the types supported by the JSON Schema Specification Wright Draft 00. +Note that integer as a type is also supported and is defined as a JSON number without a fraction or exponent part. null is not supported as a type (see nullable for an alternative solution). +Models are defined using the Schema Object, which is an extended subset of JSON Schema Specification Wright Draft 00.

+

Primitives have an optional modifier property: format. +OAS uses several known formats to define in fine detail the data type being used. +However, to support documentation needs, the format property is an open string-valued property, and can have any value. +Formats such as "email", "uuid", and so on, MAY be used even though undefined by this specification. +Types that are not accompanied by a format property follow the type definition in the JSON Schema. Tools that do not recognize a specific format MAY default back to the type alone, as if the format is not specified.

+

The formats defined by the OAS are:

+ + + + + + + + + + + + + + + +
Common Name + type + format + Comments +
integer + integer + int32 + signed 32 bits +
long + integer + int64 + signed 64 bits +
float + number + float + +
double + number + double + +
string + string + + +
byte + string + byte + base64 encoded characters +
binary + string + binary + any sequence of octets +
boolean + boolean + + +
date + string + date + As defined by full-date - [!rfc3339] +
dateTime + string + date-time + As defined by date-time - [!rfc3339] +
password + string + password + A hint to UIs to obscure input. +
+

4.5. Rich Text Formatting

+ Throughout the specification description fields are noted as supporting CommonMark markdown formatting. +Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by CommonMark 0.27. Tooling MAY choose to ignore some CommonMark features to address security concerns. +

4.6. Relative References in URLs

+

Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [rfc3986]section-4.2). +Relative references are resolved using the URLs defined in the Server Object as a Base URI.

+

Relative references used in $ref are processed as per JSON Reference, using the URL of the current document as the base URI. See also the Reference Object.

+

4.7. Schema

+

In the following description, if a field is not explicitly REQUIRED or described with a MUST or SHALL, it can be considered OPTIONAL.

+

4.7.1. OpenAPI Object

+

This is the root document object of the OpenAPI document.

+

4.7.2. Fixed Fields

+ + + + + + + + + + + + +
Field Name + Type + Description +
openapi + string + REQUIRED. This string MUST be the semantic version number of the OpenAPI Specification version that the OpenAPI document uses. The openapi field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is not related to the API info.version string. +
info + Info Object + REQUIRED. Provides metadata about the API. The metadata MAY be used by tooling as required. +
servers + [Server Object] + An array of Server Objects, which provide connectivity information to a target server. If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url value of /. +
paths + Paths Object + REQUIRED. The available paths and operations for the API. +
components + Components Object + An element to hold various schemas for the specification. +
security + [Security Requirement Object] + A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. +
tags + [Tag Object] + 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. +
externalDocs + External Documentation Object + Additional external documentation. +
+

This object MAY be extended with Specification Extensions.

+

4.7.3. Info Object

+

The object provides metadata about the API. +The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.

+

4.7.4. Fixed Fields

+ + + + + + + + + + +
Field Name + Type + Description +
title + string + REQUIRED. The title of the application. +
description + string + A short description of the application. CommonMark syntax MAY be used for rich text representation. +
termsOfService + string + A URL to the Terms of Service for the API. MUST be in the format of a URL. +
contact + Contact Object + The contact information for the exposed API. +
license + License Object + The license information for the exposed API. +
version + string + REQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version). +
+

This object MAY be extended with Specification Extensions.

+
4.7.4.1. Info Object Example:
+
{
+  "title": "Sample Pet Store App",
+  "description": "This is a sample server for a pet store.",
+  "termsOfService": "http://example.com/terms/",
+  "contact": {
+    "name": "API Support",
+    "url": "http://www.example.com/support",
+    "email": "support@example.com"
+  },
+  "license": {
+    "name": "Apache 2.0",
+    "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
+  },
+  "version": "1.0.1"
+}
+
+
title: Sample Pet Store App
+description: This is a sample server for a pet store.
+termsOfService: http://example.com/terms/
+contact:
+  name: API Support
+  url: http://www.example.com/support
+  email: support@example.com
+license:
+  name: Apache 2.0
+  url: http://www.apache.org/licenses/LICENSE-2.0.html
+version: 1.0.1
+
+

4.7.5. Contact Object

+

Contact information for the exposed API.

+

4.7.6. Fixed Fields

+ + + + + + + +
Field Name + Type + Description +
name + string + The identifying name of the contact person/organization. +
url + string + The URL pointing to the contact information. MUST be in the format of a URL. +
email + string + The email address of the contact person/organization. MUST be in the format of an email address. +
+

This object MAY be extended with Specification Extensions.

+
4.7.6.1. Contact Object Example:
+
{
+  "name": "API Support",
+  "url": "http://www.example.com/support",
+  "email": "support@example.com"
+}
+
+
name: API Support
+url: http://www.example.com/support
+email: support@example.com
+
+

4.7.7. License Object

+

License information for the exposed API.

+

4.7.8. Fixed Fields

+ + + + + + +
Field Name + Type + Description +
name + string + REQUIRED. The license name used for the API. +
url + string + A URL to the license used for the API. MUST be in the format of a URL. +
+

This object MAY be extended with Specification Extensions.

+
4.7.8.1. License Object Example:
+
{
+  "name": "Apache 2.0",
+  "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
+}
+
+
name: Apache 2.0
+url: http://www.apache.org/licenses/LICENSE-2.0.html
+
+

4.7.9. Server Object

+

An object representing a Server.

+

4.7.10. Fixed Fields

+ + + + + + + +
Field Name + Type + Description +
url + string + REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in {brackets}. +
description + string + An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation. +
variables + Map[string, Server Variable Object] + A map between a variable name and its value. The value is used for substitution in the server’s URL template. +
+

This object MAY be extended with Specification Extensions.

+
4.7.10.1. Server Object Example
+

A single server would be described as:

+
{
+  "url": "https://development.gigantic-server.com/v1",
+  "description": "Development server"
+}
+
+
url: https://development.gigantic-server.com/v1
+description: Development server
+
+

The following shows how multiple servers can be described, for example, at the OpenAPI Object’s servers:

+
{
+  "servers": [
+    {
+      "url": "https://development.gigantic-server.com/v1",
+      "description": "Development server"
+    },
+    {
+      "url": "https://staging.gigantic-server.com/v1",
+      "description": "Staging server"
+    },
+    {
+      "url": "https://api.gigantic-server.com/v1",
+      "description": "Production server"
+    }
+  ]
+}
+
+
servers:
+- url: https://development.gigantic-server.com/v1
+  description: Development server
+- url: https://staging.gigantic-server.com/v1
+  description: Staging server
+- url: https://api.gigantic-server.com/v1
+  description: Production server
+
+

The following shows how variables can be used for a server configuration:

+
{
+  "servers": [
+    {
+      "url": "https://{username}.gigantic-server.com:{port}/{basePath}",
+      "description": "The production API server",
+      "variables": {
+        "username": {
+          "default": "demo",
+          "description": "this value is assigned by the service provider, in this example gigantic-server.com"
+        },
+        "port": {
+          "enum": [
+            "8443",
+            "443"
+          ],
+          "default": "8443"
+        },
+        "basePath": {
+          "default": "v2"
+        }
+      }
+    }
+  ]
+}
+
+
servers:
+- url: https://{username}.gigantic-server.com:{port}/{basePath}
+  description: The production API server
+  variables:
+    username:
+      # note! no enum here means it is an open value
+      default: demo
+      description: this value is assigned by the service provider, in this example gigantic-server.com
+    port:
+      enum:
+        - '8443'
+        - '443'
+      default: '8443'
+    basePath:
+      # open meaning there is the opportunity to use special base paths as assigned by the provider, default is v2
+      default: v2
+
+

4.7.11. Server Variable Object

+

An object representing a Server Variable for server URL template substitution.

+

4.7.12. Fixed Fields

+ + + + + + + +
Field Name + Type + Description +
enum + [string] + An enumeration of string values to be used if the substitution options are from a limited set. +
default + string + REQUIRED. The default value to use for substitution, and to send, if an alternate value is not supplied. Unlike the Schema Object’s default, this value MUST be provided by the consumer. +
description + string + An optional description for the server variable. CommonMark syntax MAY be used for rich text representation. +
+

This object MAY be extended with Specification Extensions.

+

4.7.13. Components Object

+

Holds a set of reusable objects for different aspects of the OAS. +All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.

+

4.7.14. Fixed Fields

+ + + + + + + + + + + + + +
Field Name + Type + Description +
schemas + Map[string, Schema Object | Reference Object] + An object to hold reusable Schema Objects. +
responses + Map[string, Response Object | Reference Object] + An object to hold reusable Response Objects. +
parameters + Map[string, Parameter Object | Reference Object] + An object to hold reusable Parameter Objects. +
examples + Map[string, Example Object | Reference Object] + An object to hold reusable Example Objects. +
requestBodies + Map[string, Request Body Object | Reference Object] + An object to hold reusable Request Body Objects. +
headers + Map[string, Header Object | Reference Object] + An object to hold reusable Header Objects. +
securitySchemes + Map[string, Security Scheme Object | Reference Object] + An object to hold reusable Security Scheme Objects. +
links + Map[string, Link Object | Reference Object] + An object to hold reusable Link Objects. +
callbacks + Map[string, Callback Object | Reference Object] + An object to hold reusable Callback Objects. +
+

This object MAY be extended with Specification Extensions.

+

All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9\.\-_]+$.

+

Field Name Examples:

+
User
+User_1
+User_Name
+user-name
+my.org.User
+
+
4.7.14.1. Components Object Example
+
"components": {
+  "schemas": {
+    "Category": {
+      "type": "object",
+      "properties": {
+        "id": {
+          "type": "integer",
+          "format": "int64"
+        },
+        "name": {
+          "type": "string"
+        }
+      }
+    },
+    "Tag": {
+      "type": "object",
+      "properties": {
+        "id": {
+          "type": "integer",
+          "format": "int64"
+        },
+        "name": {
+          "type": "string"
+        }
+      }
+    }
+  },
+  "parameters": {
+    "skipParam": {
+      "name": "skip",
+      "in": "query",
+      "description": "number of items to skip",
+      "required": true,
+      "schema": {
+        "type": "integer",
+        "format": "int32"
+      }
+    },
+    "limitParam": {
+      "name": "limit",
+      "in": "query",
+      "description": "max records to return",
+      "required": true,
+      "schema" : {
+        "type": "integer",
+        "format": "int32"
+      }
+    }
+  },
+  "responses": {
+    "NotFound": {
+      "description": "Entity not found."
+    },
+    "IllegalInput": {
+      "description": "Illegal input for operation."
+    },
+    "GeneralError": {
+      "description": "General Error",
+      "content": {
+        "application/json": {
+          "schema": {
+            "$ref": "#/components/schemas/GeneralError"
+          }
+        }
+      }
+    }
+  },
+  "securitySchemes": {
+    "api_key": {
+      "type": "apiKey",
+      "name": "api_key",
+      "in": "header"
+    },
+    "petstore_auth": {
+      "type": "oauth2",
+      "flows": {
+        "implicit": {
+          "authorizationUrl": "http://example.org/api/oauth/dialog",
+          "scopes": {
+            "write:pets": "modify pets in your account",
+            "read:pets": "read your pets"
+          }
+        }
+      }
+    }
+  }
+}
+
+
components:
+  schemas:
+    Category:
+      type: object
+      properties:
+        id:
+          type: integer
+          format: int64
+        name:
+          type: string
+    Tag:
+      type: object
+      properties:
+        id:
+          type: integer
+          format: int64
+        name:
+          type: string
+  parameters:
+    skipParam:
+      name: skip
+      in: query
+      description: number of items to skip
+      required: true
+      schema:
+        type: integer
+        format: int32
+    limitParam:
+      name: limit
+      in: query
+      description: max records to return
+      required: true
+      schema:
+        type: integer
+        format: int32
+  responses:
+    NotFound:
+      description: Entity not found.
+    IllegalInput:
+      description: Illegal input for operation.
+    GeneralError:
+      description: General Error
+      content:
+        application/json:
+          schema:
+            $ref: '#/components/schemas/GeneralError'
+  securitySchemes:
+    api_key:
+      type: apiKey
+      name: api_key
+      in: header
+    petstore_auth:
+      type: oauth2
+      flows: 
+        implicit:
+          authorizationUrl: http://example.org/api/oauth/dialog
+          scopes:
+            write:pets: modify pets in your account
+            read:pets: read your pets
+
+

4.7.15. Paths Object

+

Holds the relative paths to the individual endpoints and their operations. +The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.

+

4.7.16. Patterned Fields

+ + + + + +
Field Pattern + Type + Description +
/{path} + Path Item Object + A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended (no relative URL resolution) to the expanded URL from the Server Object’s url field in order to construct the full URL. Path templating is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it’s up to the tooling to decide which one to use. +
+

This object MAY be extended with Specification Extensions.

+
4.7.16.1. Path Templating Matching
+

Assuming the following paths, the concrete definition, /pets/mine, will be matched first if used:

+
/pets/{petId}
+/pets/mine
+
+

The following paths are considered identical and invalid:

+
/pets/{petId}
+/pets/{name}
+
+

The following may lead to ambiguous resolution:

+
/{entity}/me
+/books/{id}
+
+
4.7.16.2. Paths Object Example
+
{
+  "/pets": {
+    "get": {
+      "description": "Returns all pets from the system that the user has access to",
+      "responses": {
+        "200": {          
+          "description": "A list of pets.",
+          "content": {
+            "application/json": {
+              "schema": {
+                "type": "array",
+                "items": {
+                  "$ref": "#/components/schemas/pet"
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
+
+
/pets:
+  get:
+    description: Returns all pets from the system that the user has access to
+    responses:
+      '200':
+        description: A list of pets.
+        content:
+          application/json:
+            schema:
+              type: array
+              items:
+                $ref: '#/components/schemas/pet'
+
+

4.7.17. Path Item Object

+

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.

+

4.7.18. Fixed Fields

+ + + + + + + + + + + + + + + + + +
Field Name + Type + Description +
$ref + string + 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. +
summary + string + An optional, string summary, intended to apply to all operations in this path. +
description + string + An optional, string description, intended to apply to all operations in this path. CommonMark syntax MAY be used for rich text representation. +
get + Operation Object + A definition of a GET operation on this path. +
put + Operation Object + A definition of a PUT operation on this path. +
post + Operation Object + A definition of a POST operation on this path. +
delete + Operation Object + A definition of a DELETE operation on this path. +
options + Operation Object + A definition of a OPTIONS operation on this path. +
head + Operation Object + A definition of a HEAD operation on this path. +
patch + Operation Object + A definition of a PATCH operation on this path. +
trace + Operation Object + A definition of a TRACE operation on this path. +
servers + [Server Object] + An alternative server array to service all operations in this path. +
parameters + [Parameter Object | Reference Object] + 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 OpenAPI Object’s components/parameters. +
+

This object MAY be extended with Specification Extensions.

+
4.7.18.1. Path Item Object Example
+
{
+  "get": {
+    "description": "Returns pets based on ID",
+    "summary": "Find pets by ID",
+    "operationId": "getPetsById",
+    "responses": {
+      "200": {
+        "description": "pet response",
+        "content": {
+          "*/*": {
+            "schema": {
+              "type": "array",
+              "items": {
+                "$ref": "#/components/schemas/Pet"
+              }
+            }
+          }
+        }
+      },
+      "default": {
+        "description": "error payload",
+        "content": {
+          "text/html": {
+            "schema": {
+              "$ref": "#/components/schemas/ErrorModel"
+            }
+          }
+        }
+      }
+    }
+  },
+  "parameters": [
+    {
+      "name": "id",
+      "in": "path",
+      "description": "ID of pet to use",
+      "required": true,
+      "schema": {
+        "type": "array",
+        "items": {
+          "type": "string"
+        }
+      },
+      "style": "simple"
+    }
+  ]
+}
+
+
get:
+  description: Returns pets based on ID
+  summary: Find pets by ID
+  operationId: getPetsById
+  responses:
+    '200':
+      description: pet response
+      content:
+        '*/*' :
+          schema:
+            type: array
+            items:
+              $ref: '#/components/schemas/Pet'
+    default:
+      description: error payload
+      content:
+        'text/html':
+          schema:
+            $ref: '#/components/schemas/ErrorModel'
+parameters:
+- name: id
+  in: path
+  description: ID of pet to use
+  required: true
+  schema:
+    type: array
+    style: simple
+    items:
+      type: string  
+
+

4.7.19. Operation Object

+

Describes a single API operation on a path.

+

4.7.20. Fixed Fields

+ + + + + + + + + + + + + + + + +
Field Name + Type + Description +
tags + [string] + A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. +
summary + string + A short summary of what the operation does. +
description + string + A verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation. +
externalDocs + External Documentation Object + Additional external documentation for this operation. +
operationId + string + 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 + [Parameter Object | Reference Object] + 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 OpenAPI Object’s components/parameters. +
requestBody + Request Body Object | Reference Object + The request body applicable for this operation. The requestBody is only supported in HTTP methods where the HTTP 1.1 specification [rfc7231]section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers. +
responses + Responses Object + REQUIRED. The list of possible responses as they are returned from executing this operation. +
callbacks + Map[string, Callback Object | Reference Object] + A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. +
deprecated + boolean + Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is false. +
security + [Security Requirement Object] + A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used. +
servers + [Server Object] + An alternative server array to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value. +
+

This object MAY be extended with Specification Extensions.

+
4.7.20.1. Operation Object Example
+
{
+  "tags": [
+    "pet"
+  ],
+  "summary": "Updates a pet in the store with form data",
+  "operationId": "updatePetWithForm",
+  "parameters": [
+    {
+      "name": "petId",
+      "in": "path",
+      "description": "ID of pet that needs to be updated",
+      "required": true,
+      "schema": {
+        "type": "string"
+      }
+    }
+  ],
+  "requestBody": {
+    "content": {
+      "application/x-www-form-urlencoded": {
+        "schema": {
+          "type": "object",
+           "properties": {
+              "name": { 
+                "description": "Updated name of the pet",
+                "type": "string"
+              },
+              "status": {
+                "description": "Updated status of the pet",
+                "type": "string"
+             }
+           },
+        "required": ["status"] 
+        }
+      }
+    }
+  },
+  "responses": {
+    "200": {
+      "description": "Pet updated.",
+      "content": {
+        "application/json": {},
+        "application/xml": {}
+      }
+    },
+    "405": {
+      "description": "Invalid input",
+      "content": {
+        "application/json": {},
+        "application/xml": {}
+      }
+    }
+  },
+  "security": [
+    {
+      "petstore_auth": [
+        "write:pets",
+        "read:pets"
+      ]
+    }
+  ]
+}
+
+
tags:
+- pet
+summary: Updates a pet in the store with form data
+operationId: updatePetWithForm
+parameters:
+- name: petId
+  in: path
+  description: ID of pet that needs to be updated
+  required: true
+  schema:
+    type: string
+requestBody:
+  content:
+    'application/x-www-form-urlencoded':
+      schema:
+       properties:
+          name: 
+            description: Updated name of the pet
+            type: string
+          status:
+            description: Updated status of the pet
+            type: string
+       required:
+         - status
+responses:
+  '200':
+    description: Pet updated.
+    content: 
+      'application/json': {}
+      'application/xml': {}
+  '405':
+    description: Invalid input
+    content: 
+      'application/json': {}
+      'application/xml': {}
+security:
+- petstore_auth:
+  - write:pets
+  - read:pets
+
+

4.7.21. External Documentation Object

+

Allows referencing an external resource for extended documentation.

+

4.7.22. Fixed Fields

+ + + + + + +
Field Name + Type + Description +
description + string + A short description of the target documentation. CommonMark syntax MAY be used for rich text representation. +
url + string + REQUIRED. The URL for the target documentation. Value MUST be in the format of a URL. +
+

This object MAY be extended with Specification Extensions.

+
4.7.22.1. External Documentation Object Example
+
{
+  "description": "Find more info here",
+  "url": "https://example.com"
+}
+
+
description: Find more info here
+url: https://example.com
+
+

4.7.23. Parameter Object

+

Describes a single operation parameter.

+

A unique parameter is defined by a combination of a name and location.

+

4.7.24. Parameter Locations

+

There are four possible parameter locations specified by the in field:

+
    +
  • path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId. +
  • query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id. +
  • header - Custom headers that are expected as part of the request. Note that [rfc7230]page-22) states header names are case insensitive. +
  • cookie - Used to pass a specific cookie value to the API. +
+
4.7.24.1. Fixed Fields
+ + + + + + + + + + +
Field Name + Type + Description +
name + string + + REQUIRED. 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. +
  • If in is "header" and the name field is "Accept", "Content-Type" or "Authorization", the parameter definition SHALL be ignored. +
  • For all other cases, the name corresponds to the parameter name used by the in property. +
+
in + string + REQUIRED. The location of the parameter. Possible values are “query”, “header”, “path” or “cookie”. +
description + string + A brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation. +
required + boolean + Determines whether this parameter is mandatory. If the parameter location is “path”, this property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and its default value is false. +
deprecated + boolean + Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. +
allowEmptyValue + boolean + Sets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored. +
+

The rules for serialization of the parameter are specified in one of two ways. +For simpler scenarios, a schema and style can describe the structure and syntax of the parameter.

+ + + + + + + + + + +
Field Name + Type + Description +
style + string + Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form. +
explode + boolean + When this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. +
allowReserved + boolean + Determines whether the parameter value SHOULD allow reserved characters, as defined by [rfc3986]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false. +
schema + Schema Object | Reference Object + The schema defining the type used for the parameter. +
example + Any + Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The example object is mutually exclusive of the examples object. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary. +
examples + Map[ string, Example Object | Reference Object] + Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The examples object is mutually exclusive of the example object. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema. +
+

For more complex scenarios, the content property can define the media type and schema of the parameter. +A parameter MUST contain either a schema property, or a content property, but not both. +When example or examples are provided in conjunction with the schema object, the example MUST follow the prescribed serialization strategy for the parameter.

+ + + + + +
Field Name + Type + Description +
content + Map[string, Media Type Object] + A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry. +
+
4.7.24.2. Style Values
+

In order to support common ways of serializing simple parameters, a set of style values are defined.

+ + + + + + + + + + + +
style + type + in + Comments +
matrix + primitive, array, object + path + Path-style parameters defined by [rfc6570]section-3.2.7) +
label + primitive, array, object + path + Label style parameters defined by [rfc6570]section-3.2.5) +
form + primitive, array, object + query, cookie + Form style parameters defined by [rfc6570]section-3.2.8). This option replaces collectionFormat with a csv (when explode is false) or multi (when explode is true) value from OpenAPI 2.0. +
simple + array + path, header + Simple style parameters defined by [rfc6570]section-3.2.2). This option replaces collectionFormat with a csv value from OpenAPI 2.0. +
spaceDelimited + array + query + Space separated array values. This option replaces collectionFormat equal to ssv from OpenAPI 2.0. +
pipeDelimited + array + query + Pipe separated array values. This option replaces collectionFormat equal to pipes from OpenAPI 2.0. +
deepObject + object + query + Provides a simple way of rendering nested objects using form parameters. +
+
4.7.24.3. Style Examples
+

Assume a parameter named color has one of the following values:

+
string -> "blue"
+array -> ["blue","black","brown"]
+object -> { "R": 100, "G": 200, "B": 150 }
+
+

The following table shows examples of rendering differences for each value.

+ + + + + + + + + + + + + + + +
style + explode + empty + string + array + object +
matrix + false + ;color + ;color=blue + ;color=blue,black,brown + ;color=R,100,G,200,B,150 +
matrix + true + ;color + ;color=blue + ;color=blue;color=black;color=brown + ;R=100;G=200;B=150 +
label + false + . + .blue + .blue.black.brown + .R.100.G.200.B.150 +
label + true + . + .blue + .blue.black.brown + .R=100.G=200.B=150 +
form + false + color= + color=blue + color=blue,black,brown + color=R,100,G,200,B,150 +
form + true + color= + color=blue + color=blue&color=black&color=brown + R=100&G=200&B=150 +
simple + false + n/a + blue + blue,black,brown + R,100,G,200,B,150 +
simple + true + n/a + blue + blue,black,brown + R=100,G=200,B=150 +
spaceDelimited + false + n/a + n/a + blue%20black%20brown + R%20100%20G%20200%20B%20150 +
pipeDelimited + false + n/a + n/a + blueblackbrown + R100G|200 +
deepObject + true + n/a + n/a + n/a + color[R]=100&color[G]=200&color[B]=150 +
+

This object MAY be extended with Specification Extensions.

+
4.7.24.4. Parameter Object Examples
+

A header parameter with an array of 64 bit integer numbers:

+
{
+  "name": "token",
+  "in": "header",
+  "description": "token to be passed as a header",
+  "required": true,
+  "schema": {
+    "type": "array",
+    "items": {
+      "type": "integer",
+      "format": "int64"
+    }
+  },
+  "style": "simple"
+}
+
+
name: token
+in: header
+description: token to be passed as a header
+required: true
+schema:
+  type: array
+  items:
+    type: integer
+    format: int64
+style: simple
+
+

A path parameter of a string value:

+
{
+  "name": "username",
+  "in": "path",
+  "description": "username to fetch",
+  "required": true,
+  "schema": {
+    "type": "string"
+  }
+}
+
+
name: username
+in: path
+description: username to fetch
+required: true
+schema:
+  type: string
+
+

An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

+
{
+  "name": "id",
+  "in": "query",
+  "description": "ID of the object to fetch",
+  "required": false,
+  "schema": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    }
+  },
+  "style": "form",
+  "explode": true
+}
+
+
name: id
+in: query
+description: ID of the object to fetch
+required: false
+schema:
+  type: array
+  items:
+    type: string
+style: form
+explode: true
+
+

A free-form query parameter, allowing undefined parameters of a specific type:

+
{
+  "in": "query",
+  "name": "freeForm",
+  "schema": {
+    "type": "object",
+    "additionalProperties": {
+      "type": "integer"
+    },
+  },
+  "style": "form"
+}
+
+
in: query
+name: freeForm
+schema:
+  type: object
+  additionalProperties:
+    type: integer
+style: form
+
+

A complex parameter using content to define serialization:

+
{
+  "in": "query",
+  "name": "coordinates",
+  "content": {
+    "application/json": {
+      "schema": {
+        "type": "object",
+        "required": [
+          "lat",
+          "long"
+        ],
+        "properties": {
+          "lat": {
+            "type": "number"
+          },
+          "long": {
+            "type": "number"
+          }
+        }
+      }
+    }
+  }
+}
+
+
in: query
+name: coordinates
+content:
+  application/json:
+    schema:
+      type: object
+      required:
+        - lat
+        - long
+      properties:
+        lat:
+          type: number
+        long:
+          type: number
+
+

4.7.25. Request Body Object

+

Describes a single request body.

+

4.7.26. Fixed Fields

+ + + + + + + +
Field Name + Type + Description +
description + string + A brief description of the request body. This could contain examples of use. CommonMark syntax MAY be used for rich text representation. +
content + Map[string, Media Type Object] + REQUIRED. The content of the request body. The key is a media type or [media type range]appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* +
required + boolean + Determines if the request body is required in the request. Defaults to false. +
+

This object MAY be extended with Specification Extensions.

+
4.7.26.1. Request Body Examples
+

A request body with a referenced model definition.

+
{
+  "description": "user to add to the system",
+  "content": {
+    "application/json": {
+      "schema": {
+        "$ref": "#/components/schemas/User"
+      },
+      "examples": {
+          "user" : {
+            "summary": "User Example", 
+            "externalValue": "http://foo.bar/examples/user-example.json"
+          } 
+        }
+    },
+    "application/xml": {
+      "schema": {
+        "$ref": "#/components/schemas/User"
+      },
+      "examples": {
+          "user" : {
+            "summary": "User example in XML",
+            "externalValue": "http://foo.bar/examples/user-example.xml"
+          }
+        }
+    },
+    "text/plain": {
+      "examples": {
+        "user" : {
+            "summary": "User example in Plain text",
+            "externalValue": "http://foo.bar/examples/user-example.txt" 
+        }
+      } 
+    },
+    "*/*": {
+      "examples": {
+        "user" : {
+            "summary": "User example in other format",
+            "externalValue": "http://foo.bar/examples/user-example.whatever"
+        }
+      }
+    }
+  }
+}
+
+
description: user to add to the system
+content: 
+  'application/json':
+    schema:
+      $ref: '#/components/schemas/User'
+    examples:
+      user:
+        summary: User Example
+        externalValue: 'http://foo.bar/examples/user-example.json'
+  'application/xml':
+    schema:
+      $ref: '#/components/schemas/User'
+    examples:
+      user:
+        summary: User Example in XML
+        externalValue: 'http://foo.bar/examples/user-example.xml'
+  'text/plain':
+    examples:
+      user:
+        summary: User example in text plain format
+        externalValue: 'http://foo.bar/examples/user-example.txt'
+  '*/*':
+    examples:
+      user: 
+        summary: User example in other format
+        externalValue: 'http://foo.bar/examples/user-example.whatever'
+
+

A body parameter that is an array of string values:

+
{
+  "description": "user to add to the system",
+  "content": {
+    "text/plain": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "type": "string"
+        }
+      }
+    }
+  }
+}
+
+
description: user to add to the system
+required: true
+content:
+  text/plain:
+    schema:
+      type: array
+      items:
+        type: string
+
+

4.7.27. Media Type Object

+ Each Media Type Object provides schema and examples for the media type identified by its key. +

4.7.28. Fixed Fields

+ + + + + + + + +
Field Name + Type + Description +
schema + Schema Object | Reference Object + The schema defining the type used for the request body. +
example + Any + Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The example object is mutually exclusive of the examples object. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema. +
examples + Map[ string, Example Object | Reference Object] + Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The examples object is mutually exclusive of the example object. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema. +
encoding + Map[string, Encoding Object] + A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded. +
+

This object MAY be extended with Specification Extensions.

+
4.7.28.1. Media Type Examples
+
{
+  "application/json": {
+    "schema": {
+         "$ref": "#/components/schemas/Pet"
+    },
+    "examples": {
+      "cat" : {
+        "summary": "An example of a cat",
+        "value": 
+          {
+            "name": "Fluffy",
+            "petType": "Cat",
+            "color": "White",
+            "gender": "male",
+            "breed": "Persian"
+          }
+      },
+      "dog": {
+        "summary": "An example of a dog with a cat’s name",
+        "value" :  { 
+          "name": "Puma",
+          "petType": "Dog",
+          "color": "Black",
+          "gender": "Female",
+          "breed": "Mixed"
+        },
+      "frog": {
+          "$ref": "#/components/examples/frog-example"
+        }
+      }
+    }
+  }
+}
+
+
application/json: 
+  schema:
+    $ref: "#/components/schemas/Pet"
+  examples:
+    cat:
+      summary: An example of a cat
+      value:
+        name: Fluffy
+        petType: Cat
+        color: White
+        gender: male
+        breed: Persian
+    dog:
+      summary: An example of a dog with a cat’s name
+      value:
+        name: Puma
+        petType: Dog
+        color: Black
+        gender: Female
+        breed: Mixed
+    frog:
+      $ref: "#/components/examples/frog-example"
+
+
4.7.28.2. Considerations for File Uploads
+

In contrast with the 2.0 specification, file input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically:

+
# content transferred with base64 encoding
+schema:
+  type: string
+  format: base64
+
+
# content transferred in binary (octet-stream):
+schema:
+  type: string
+  format: binary
+
+

These examples apply to either input payloads of file uploads or response payloads.

+

A requestBody for submitting a file in a POST operation may look like the following example:

+
requestBody:
+  content:
+    application/octet-stream:
+      # any media type is accepted, functionally equivalent to */*
+      schema:
+        # a binary file of any type
+        type: string
+        format: binary
+
+

In addition, specific media types MAY be specified:

+
# multiple, specific media types may be specified:
+requestBody:
+  content:
+      # a binary file of type png or jpeg
+    'image/jpeg':
+      schema:
+        type: string
+        format: binary
+    'image/png':
+      schema:
+        type: string
+        format: binary        
+
+

To upload multiple files, a multipart media type MUST be used:

+
requestBody:
+  content:
+    multipart/form-data:
+      schema:
+        properties:
+          # The property name 'file' will be used for all files.
+          file:
+            type: array
+            items:
+              type: string
+              format: binary
+
+
+

5. Support for x-www-form-urlencoded Request Bodies

+

To submit content using form url encoding via [rfc1866], the following +definition may be used:

+
requestBody:
+  content:
+    application/x-www-form-urlencoded:
+      schema:
+        type: object
+        properties:
+          id:
+            type: string
+            format: uuid
+          address:
+            # complex types are stringified to support RFC 1866
+            type: object
+            properties: {}
+
+

In this example, the contents in the requestBody MUST be stringified per [rfc1866]) when passed to the server. In addition, the address field complex object will be stringified.

+

When passing complex objects in the application/x-www-form-urlencoded content type, the default serialization strategy of such properties is described in the Encoding Object’s style property as form.

+

5.1. Special Considerations for multipart Content

+

It is common to use multipart/form-data as a Content-Type when transferring request bodies to operations. In contrast to 2.0, a schema is REQUIRED to define the input parameters to the operation when using multipart content. This supports complex structures as well as supporting mechanisms for multiple file uploads.

+

When passing in multipart types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default Content-Types are defined for multipart:

+
    +
  • If the property is a primitive, or an array of primitive values, the default Content-Type is text/plain +
  • If the property is complex, or an array of complex values, the default Content-Type is application/json +
  • If the property is a type: string with format: binary or format: base64 (aka a file object), the default Content-Type is application/octet-stream +
+

Examples:

+
requestBody:
+  content:
+    multipart/form-data:
+      schema:
+        type: object
+        properties:
+          id:
+            type: string
+            format: uuid
+          address:
+            # default Content-Type for objects is application/json
+            type: object
+            properties: {}
+          profileImage:
+            # default Content-Type for string/binary is application/octet-stream
+            type: string
+            format: binary
+          children:
+            # default Content-Type for arrays is based on the inner type (text/plain here)
+            type: array
+            items:
+              type: string
+          addresses:
+            # default Content-Type for arrays is based on the inner type (object shown, so application/json in this example)
+            type: array
+            items:
+              type: '#/components/schemas/Address'
+
+

An encoding attribute is introduced to give you control over the serialization of parts of multipart request bodies. This attribute is only applicable to multipart and application/x-www-form-urlencoded request bodies.

+

5.1.1. Encoding Object

+

A single encoding definition applied to a single schema property.

+

5.1.2. Fixed Fields

+ + + + + + + + + +
Field Name + Type + Description +
contentType + string + The Content-Type for encoding a specific property. Default value depends on the property type: for string with format being binaryapplication/octet-stream; for other primitive types – text/plain; for object - application/json; for array – the default is defined based on the inner type. The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types. +
headers + Map[string, Header Object | Reference Object] + A map allowing additional information to be provided as headers, for example Content-Disposition. Content-Type is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a multipart. +
style + string + Describes how a specific property value will be serialized depending on its type. See Parameter Object for details on the style property. The behavior follows the same values as query parameters, including default values. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded. +
explode + boolean + When this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded. +
allowReserved + boolean + Determines whether the parameter value SHOULD allow reserved characters, as defined by [rfc3986]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded. +
+

This object MAY be extended with Specification Extensions.

+
5.1.2.1. Encoding Object Example
+
requestBody:
+  content:
+    multipart/mixed:
+      schema:
+        type: object
+        properties:
+          id:
+            # default is text/plain
+            type: string
+            format: uuid
+          address:
+            # default is application/json
+            type: object
+            properties: {}
+          historyMetadata:
+            # need to declare XML format!
+            description: metadata in XML format
+            type: object
+            properties: {}
+          profileImage:
+            # default is application/octet-stream, need to declare an image type only!
+            type: string
+            format: binary
+      encoding:
+        historyMetadata:
+          # require XML Content-Type in utf-8 encoding
+          contentType: application/xml; charset=utf-8
+        profileImage:
+          # only accept png/jpeg
+          contentType: image/png, image/jpeg
+          headers:
+            X-Rate-Limit-Limit:
+              description: The number of allowed requests in the current period
+              schema:
+                type: integer
+
+

5.1.3. Responses Object

+

A container for the expected responses of an operation. +The container maps a HTTP response code to the expected response.

+

The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. +However, documentation is expected to cover a successful operation response and any known errors.

+

The default MAY be used as a default response object for all HTTP codes +that are not covered individually by the specification.

+

The Responses Object MUST contain at least one response code, and it +SHOULD be the response for a successful operation call.

+

5.1.4. Fixed Fields

+ + + + + +
Field Name + Type + Description +
default + Response Object | Reference Object + The documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. A Reference Object can link to a response that the OpenAPI Object’s components/responses section defines. +
+
5.1.4.1. Patterned Fields
+ + + + + +
Field Pattern + Type + Description +
HTTP Status Code + Response Object | Reference Object + Any HTTP status code can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A Reference Object can link to a response that is defined in the OpenAPI Object’s components/responses section. This field MUST be enclosed in quotation marks (for example, “200”) for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character X. For example, 2XX represents all response codes between [200-299]. The following range definitions are allowed: 1XX, 2XX, 3XX, 4XX, and 5XX. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code. +
+

This object MAY be extended with Specification Extensions.

+
5.1.4.2. Responses Object Example
+

A 200 response for a successful operation and a default response for others (implying an error):

+
{
+  "200": {
+    "description": "a pet to be returned",
+    "content": {
+      "application/json": {
+        "schema": {
+          "$ref": "#/components/schemas/Pet"
+        }
+      }
+    }
+  },
+  "default": {
+    "description": "Unexpected error",
+    "content": {
+      "application/json": {
+        "schema": {
+          "$ref": "#/components/schemas/ErrorModel"
+        }
+      }
+    }
+  }
+}
+
+
'200':
+  description: a pet to be returned
+  content: 
+    application/json:
+      schema:
+        $ref: '#/components/schemas/Pet'
+default:
+  description: Unexpected error
+  content:
+    application/json:
+      schema:
+        $ref: '#/components/schemas/ErrorModel'
+
+

5.1.5. Response Object

+ Describes a single response from an API Operation, including design-time, static links to operations based on the response. +

5.1.6. Fixed Fields

+ + + + + + + + +
Field Name + Type + Description +
description + string + REQUIRED. A short description of the response. CommonMark syntax MAY be used for rich text representation. +
headers + Map[string, Header Object | Reference Object] + Maps a header name to its definition. [rfc7230]page-22) states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored. +
content + Map[string, Media Type Object] + A map containing descriptions of potential response payloads. The key is a media type or [media type range]appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* +
links + Map[string, Link Object | Reference Object] + A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for Component Objects. +
+

This object MAY be extended with Specification Extensions.

+
5.1.6.1. Response Object Examples
+

Response of an array of a complex type:

+
{
+  "description": "A complex object array response",
+  "content": {
+    "application/json": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/components/schemas/VeryComplexType"
+        }
+      }
+    }
+  }
+}
+
+
description: A complex object array response
+content: 
+  application/json:
+    schema: 
+      type: array
+      items:
+        $ref: '#/components/schemas/VeryComplexType'
+
+

Response with a string type:

+
{
+  "description": "A simple string response",
+  "content": {
+    "text/plain": {
+      "schema": {
+        "type": "string"
+      }
+    }
+  }
+
+}
+
+
description: A simple string response
+representations:
+  text/plain:
+    schema:
+      type: string
+
+

Plain text response with headers:

+
{
+  "description": "A simple string response",
+  "content": {
+    "text/plain": {
+      "schema": {
+        "type": "string"
+      }
+    }
+  },
+  "headers": {
+    "X-Rate-Limit-Limit": {
+      "description": "The number of allowed requests in the current period",
+      "schema": {
+        "type": "integer"
+      }
+    },
+    "X-Rate-Limit-Remaining": {
+      "description": "The number of remaining requests in the current period",
+      "schema": {
+        "type": "integer"
+      }
+    },
+    "X-Rate-Limit-Reset": {
+      "description": "The number of seconds left in the current period",
+      "schema": {
+        "type": "integer"
+      }
+    }
+  }
+}
+
+
description: A simple string response
+content:
+  text/plain:
+    schema:
+      type: string
+    example: 'whoa!'
+headers:
+  X-Rate-Limit-Limit:
+    description: The number of allowed requests in the current period
+    schema:
+      type: integer
+  X-Rate-Limit-Remaining:
+    description: The number of remaining requests in the current period
+    schema:
+      type: integer
+  X-Rate-Limit-Reset:
+    description: The number of seconds left in the current period
+    schema:
+      type: integer
+
+

Response with no return value:

+
{
+  "description": "object created"
+}
+
+
description: object created
+
+

5.1.7. Callback Object

+

A map of possible out-of band callbacks related to the parent operation. +Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. +The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

+

5.1.8. Patterned Fields

+ + + + + +
Field Pattern + Type + Description +
{expression} + Path Item Object + A Path Item Object used to define a callback request and expected responses. A complete example is available. +
+

This object MAY be extended with Specification Extensions.

+
5.1.8.1. Key Expression
+

The key that identifies the Path Item Object is a runtime expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. +A simple example might be $request.body#/url. +However, using a runtime expression the complete HTTP message can be accessed. +This includes accessing any part of a body that a JSON Pointer [rfc6901] can reference.

+

For example, given the following HTTP request:

+
POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1
+Host: example.org
+Content-Type: application/json
+Content-Length: 187
+
+{
+  "failedUrl" : "http://clientdomain.com/failed",
+  "successUrls" : [
+    "http://clientdomain.com/fast",
+    "http://clientdomain.com/medium",
+    "http://clientdomain.com/slow"
+  ] 
+}
+
+201 Created
+Location: http://example.org/subscription/1
+
+

The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named eventType and a query parameter named queryUrl.

+ + + + + + + + + + + + +
Expression + Value +
$url + http://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning +
$method + POST +
$request.path.eventType + myevent +
$request.query.queryUrl + http://clientdomain.com/stillrunning +
$request.header.content-Type + application/json +
$request.body#/failedUrl + http://clientdomain.com/stillrunning +
$request.body#/successUrls/2 + http://clientdomain.com/medium +
$response.header.Location + http://example.org/subscription/1 +
+
5.1.8.2. Callback Object Example
+

The following example shows a callback to the URL specified by the id and email property in the request body.

+
myWebhook:
+  'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
+    post:
+      requestBody:
+        description: Callback payload
+        content: 
+          'application/json':
+            schema:
+              $ref: '#/components/schemas/SomePayload'
+      responses:
+        '200':
+          description: webhook successfully processed and no retries will be performed
+
+

5.1.9. Example Object

+

5.1.10. Fixed Fields

+ + + + + + + + +
Field Name + Type + Description +
summary + string + Short description for the example. +
description + string + Long description for the example. CommonMark syntax MAY be used for rich text representation. +
value + Any + Embedded literal example. The value field and externalValue field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary. +
externalValue + string + A URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The value field and externalValue field are mutually exclusive. +
+

This object MAY be extended with Specification Extensions.

+

In all cases, the example value is expected to be compatible with the type schema +of its associated value. Tooling implementations MAY choose to +validate compatibility automatically, and reject the example value(s) if incompatible.

+
5.1.10.1. Example Object Example
+
# in a model
+schemas:
+  properties:
+    name:
+      type: string
+      examples:
+        name:
+          $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example
+
+# in a request body:
+  requestBody:
+    content:
+      'application/json':
+        schema:
+          $ref: '#/components/schemas/Address'
+        examples: 
+          foo:
+            summary: A foo example
+            value: {"foo": "bar"}
+          bar:
+            summary: A bar example
+            value: {"bar": "baz"}
+      'application/xml':
+        examples: 
+          xmlExample:
+            summary: This is an example in XML
+            externalValue: 'http://example.org/examples/address-example.xml'
+      'text/plain':
+        examples:
+          textExample: 
+            summary: This is a text example
+            externalValue: 'http://foo.bar/examples/address-example.txt' 
+
+
+# in a parameter
+  parameters:
+    - name: 'zipCode'
+      in: 'query'
+      schema:
+        type: 'string'
+        format: 'zip-code'
+        examples:
+          zip-example: 
+            $ref: '#/components/examples/zip-example'
+
+# in a response
+  responses:
+    '200':
+      description: your car appointment has been booked
+      content: 
+        application/json:
+          schema:
+            $ref: '#/components/schemas/SuccessResponse'
+          examples:
+            confirmation-success:
+              $ref: '#/components/examples/confirmation-success'
+
+ +

The Link object represents a possible design-time link for a response. +The presence of a link does not guarantee the caller’s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.

+

Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.

+

For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.

+

7. Fixed Fields

+ + + + + + + + + + +
Field Name + Type + Description +
operationRef + string + A relative or absolute reference to an OAS operation. This field is mutually exclusive of the operationId field, and MUST point to an Operation Object. Relative operationRef values MAY be used to locate an existing Operation Object in the OpenAPI definition. +
operationId + string + The name of an existing, resolvable OAS operation, as defined with a unique operationId. This field is mutually exclusive of the operationRef field. +
parameters + Map[string, Any | {expression}] + A map representing parameters to pass to an operation as specified with operationId or identified via operationRef. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id). +
requestBody + Any | {expression} + A literal value or {expression} to use as a request body when calling the target operation. +
description + string + A description of the link. CommonMark syntax MAY be used for rich text representation. +
server + Server Object + A server object to be used by the target operation. +
+

This object MAY be extended with Specification Extensions.

+

A linked operation MUST be identified using either an operationRef or operationId. +In the case of an operationId, it MUST be unique and resolved in the scope of the OAS document. +Because of the potential for name clashes, the operationRef syntax is preferred +for specifications with external references.

+

7.1. Examples

+

Computing a link from a request operation where the $request.path.id is used to pass a request parameter to the linked operation.

+
paths:
+  /users/{id}:
+    parameters:
+    - name: id
+      in: path
+      required: true
+      description: the user identifier, as userId 
+      schema:
+        type: string
+    get:
+      responses:
+        '200':
+          description: the user being returned
+          content:
+            application/json:
+              schema:
+                type: object
+                properties:
+                  uuid: # the unique user id
+                    type: string
+                    format: uuid
+        links:
+          address:
+            # the target link operationId
+            operationId: getUserAddress
+            parameters:
+              # get the id field from the request path parameter named id
+              userId: $request.path.id
+  # the path item of the linked operation
+  /users/{userid}/address:
+    parameters:
+    - name: userid
+      in: path
+      required: true
+      description: the user identifier, as userId 
+      schema:
+        type: string
+      # linked operation
+      get:
+        operationId: getUserAddress
+        responses:
+          '200':
+            description: the user’s address
+
+

When a runtime expression fails to evaluate, no parameter value is passed to the target operation.

+

Values from the response body can be used to drive a linked operation.

+
links:
+  address:
+    operationId: getUserAddressByUUID
+    parameters:
+      # get the id field from the request path parameter named id
+      userUuid: $response.body#/uuid
+
+

Clients follow all links at their discretion. +Neither permissions, nor the capability to make a successful call to that link, is guaranteed +solely by the existence of a relationship.

+

7.1.1. OperationRef Examples

+

As references to operationId MAY NOT be possible (the operationId is an optional +value), references MAY also be made through a relative operationRef:

+
links:
+  UserRepositories:
+    # returns array of '#/components/schemas/repository'
+    operationRef: '#/paths/~12.0~1repositories~1{username}/get'
+    parameters:
+      username: $response.body#/username
+
+

or an absolute operationRef:

+
links:
+  UserRepositories:
+    # returns array of '#/components/schemas/repository'
+    operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get'
+    parameters:
+      username: $response.body#/username
+
+

Note that in the use of operationRef, the escaped forward-slash is necessary when +using JSON references.

+
7.1.1.1. Runtime Expressions
+

Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. +This mechanism is used by Link Objects and Callback Objects.

+

The runtime expression is defined by the following [Advanced Backus-Naur Form] syntax

+
expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source )
+source = ( header-reference | query-reference | path-reference | body-reference )  
+header-reference = "header." token
+query-reference = "query." name  
+path-reference = "path." name
+body-reference = "body" ["#" fragment]
+fragment = a JSON Pointer [RFC 6901]  
+name = *( char )
+char = as per RFC [7159]section-7)
+token = as per RFC [7230]section-3.2.6)
+
+

The name identifier is case-sensitive, whereas token is not.

+

The table below provides examples of runtime expressions and examples of their use in a value:

+
7.1.1.2. Examples
+ + + + + + + + + + + +
Source Location + example expression + notes +
HTTP Method + $method + The allowable values for the $method will be those for the HTTP operation. +
Requested media type + $request.header.accept + +
Request parameter + $request.path.id + Request parameters MUST be declared in the parameters section of the parent operation or they cannot be evaluated. This includes request headers. +
Request body property + $request.body#/user/uuid + In operations which accept payloads, references may be made to portions of the requestBody or the entire body. +
Request URL + $url + +
Response value + $response.body#/status + In operations which return payloads, references may be made to portions of the response body or the entire body. +
Response header + $response.header.Server + Single header values only are available +
+

Runtime expressions preserve the type of the referenced value. +Expressions can be embedded into string values by surrounding the expression with {} curly braces.

+

7.1.2. Header Object

+

The Header Object follows the structure of the Parameter Object with the following changes:

+
    +
  1. name MUST NOT be specified, it is given in the corresponding headers map. +
  2. in MUST NOT be specified, it is implicitly in header. +
  3. All traits that are affected by the location MUST be applicable to a location of header (for example, style). +
+

7.1.3. Header Object Example

+

A simple header of type integer:

+
{
+  "description": "The number of allowed requests in the current period",
+  "schema": {
+    "type": "integer"
+  }
+}
+
+
description: The number of allowed requests in the current period
+schema:
+  type: integer
+
+

7.1.4. Tag Object

+

Adds metadata to a single tag that is used by the Operation Object. +It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

+

7.1.5. Fixed Fields

+ + + + + + + +
Field Name + Type + Description +
name + string + REQUIRED. The name of the tag. +
description + string + A short description for the tag. CommonMark syntax MAY be used for rich text representation. +
externalDocs + External Documentation Object + Additional external documentation for this tag. +
+

This object MAY be extended with Specification Extensions.

+
7.1.5.1. Tag Object Example
+
{
+  "name": "pet",
+  "description": "Pets operations"
+}
+
+
name: pet
+description: Pets operations
+
+

7.1.6. Examples Object

+

In an example, a JSON Reference MAY be used, with the +explicit restriction that examples having a JSON format with object named $ref are not allowed. Therefore, that example, structurally, can be +either a string primitive or an object, similar to additionalProperties.

+

In all cases, the payload is expected to be compatible with the type schema +for the associated value. Tooling implementations MAY choose to +validate compatibility automatically, and reject the example value(s) if they +are incompatible.

+
# in a model
+schemas:
+  properties:
+    name:
+      type: string
+      example:
+        $ref: http://foo.bar#/examples/name-example
+
+# in a request body, note the plural examples
+  requestBody:
+    content:
+      'application/json':
+        schema:
+          $ref: '#/components/schemas/Address'
+        examples:
+          foo:
+            value: {"foo": "bar"}
+          bar:
+            value: {"bar": "baz"}
+      'application/xml':
+        examples:
+          xml:
+            externalValue: 'http://foo.bar/examples/address-example.xml'
+      'text/plain':
+        examples:
+          text:
+            externalValue: 'http://foo.bar/examples/address-example.txt'
+        
+# in a parameter
+  parameters:
+    - name: 'zipCode'
+      in: 'query'
+      schema:
+        type: 'string'
+        format: 'zip-code'
+        example: 
+          $ref: 'http://foo.bar#/examples/zip-example'
+
+# in a response, note the singular example:
+  responses:
+    '200':
+      description: your car appointment has been booked
+      content: 
+        application/json:
+          schema:
+            $ref: '#/components/schemas/SuccessResponse'
+          example:
+            $ref: http://foo.bar#/examples/address-example.json
+
+

8. Reference Object

+

A simple object to allow referencing other components in the specification, internally and externally.

+

The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.

+

For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.

+

9. Fixed Fields

+ + + + + +
Field Name + Type + Description +
$ref + string + REQUIRED. The reference string. +
+

This object cannot be extended with additional properties and any properties added SHALL be ignored.

+

9.1. Reference Object Example

+
{
+  "$ref": "#/components/schemas/Pet"
+}
+
+
$ref: '#/components/schemas/Pet'
+
+

9.1.1. Relative Schema Document Example

+
{
+  "$ref": "Pet.json"
+}
+
+
$ref: Pet.yaml
+
+
9.1.1.1. Relative Documents With Embedded Schema Example
+
{
+  "$ref": "definitions.json#/Pet"
+}
+
+
$ref: definitions.yaml#/Pet
+
+

9.1.2. Schema Object

+

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 an extended subset of the JSON Schema Specification Wright Draft 00.

+

For more information about the properties, see JSON Schema Core and JSON Schema Validation. +Unless stated otherwise, the property definitions follow the JSON Schema.

+

9.1.3. Properties

+

The following properties are taken directly from the JSON Schema definition and follow the same specifications:

+
    +
  • title +
  • multipleOf +
  • maximum +
  • exclusiveMaximum +
  • minimum +
  • exclusiveMinimum +
  • maxLength +
  • minLength +
  • pattern (This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect) +
  • maxItems +
  • minItems +
  • uniqueItems +
  • maxProperties +
  • minProperties +
  • required +
  • enum +
+

The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification.

+
    +
  • type - Value MUST be a string. Multiple types via an array are not supported. +
  • allOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. +
  • oneOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. +
  • anyOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. +
  • not - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. +
  • items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. items MUST be present if the type is array. +
  • properties - Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced). +
  • additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. +
  • description - CommonMark syntax MAY be used for rich text representation. +
  • format - See Data Type Formats for further details. While relying on JSON Schema’s defined formats, the OAS offers a few additional predefined formats. +
  • default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if type is string, then default can be "foo" but cannot be 1. +
+

Alternatively, any time a Schema Object can be used, a Reference Object can be used in its place. This allows referencing definitions instead of defining them inline.

+

Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported.

+

Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation:

+
9.1.3.1. Fixed Fields
+ + + + + + + + + + + + +
Field Name + Type + Description +
nullable + boolean + Allows sending a null value for the defined schema. Default value is false. +
discriminator + Discriminator Object + Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See Composition and Inheritance for more details. +
readOnly + boolean + 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 SHOULD NOT be sent as part of the request. If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false. +
writeOnly + boolean + Relevant only for Schema "properties" definitions. Declares the property as “write only”. Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as writeOnly being true and is in the required list, the required will take effect on the request only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false. +
xml + XML Object + This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property. +
externalDocs + External Documentation Object + Additional external documentation for this schema. +
example + Any + A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. +
deprecated + boolean + Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false. +
+

This object MAY be extended with Specification Extensions.

+
9.1.3.1.1. Composition and Inheritance (Polymorphism)
+

The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. allOf takes an array of object definitions that are validated independently but together compose a single object.

+

While composition offers model extensibility, it does not imply a hierarchy between the models. +To support polymorphism, the OpenAPI Specification adds the discriminator field. +When used, the discriminator will be the name of the property that decides which schema definition validates the structure of the model. +As such, the discriminator field MUST be a required field. +There are are two ways to define the value of a discriminator for an inheriting instance.

+
    +
  • Use the schema name. +
  • Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name. +
+

As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism.

+
9.1.3.1.2. XML Modeling
+

The xml property allows extra definitions when translating the JSON definition to XML. +The XML Object contains additional information about the available options.

+
9.1.3.2. Schema Object Examples
+
9.1.3.2.1. Primitive Sample
+
{
+  "type": "string",
+  "format": "email"
+}
+
+
type: string
+format: email
+
+
9.1.3.2.2. Simple Model
+
{
+  "type": "object",
+  "required": [
+    "name"
+  ],
+  "properties": {
+    "name": {
+      "type": "string"
+    },
+    "address": {
+      "$ref": "#/components/schemas/Address"
+    },
+    "age": {
+      "type": "integer",
+      "format": "int32",
+      "minimum": 0
+    }
+  }
+}
+
+
type: object
+required:
+- name
+properties:
+  name:
+    type: string
+  address:
+    $ref: '#/components/schemas/Address'
+  age:
+    type: integer
+    format: int32
+    minimum: 0
+
+
9.1.3.2.3. Model with Map/Dictionary Properties
+

For a simple string to string mapping:

+
{
+  "type": "object",
+  "additionalProperties": {
+    "type": "string"
+  }
+}
+
+
type: object
+additionalProperties:
+  type: string
+
+

For a string to model mapping:

+
{
+  "type": "object",
+  "additionalProperties": {
+    "$ref": "#/components/schemas/ComplexModel"
+  }
+}
+
+
type: object
+additionalProperties:
+  $ref: '#/components/schemas/ComplexModel'
+
+
9.1.3.2.4. Model with Example
+
{
+  "type": "object",
+  "properties": {
+    "id": {
+      "type": "integer",
+      "format": "int64"
+    },
+    "name": {
+      "type": "string"
+    }
+  },
+  "required": [
+    "name"
+  ],
+  "example": {
+    "name": "Puma",
+    "id": 1
+  }
+}
+
+
type: object
+properties:
+  id:
+    type: integer
+    format: int64
+  name:
+    type: string
+required:
+- name
+example:
+  name: Puma
+  id: 1
+
+
9.1.3.2.5. Models with Composition
+
{
+  "components": {
+    "schemas": {
+      "ErrorModel": {
+        "type": "object",
+        "required": [
+          "message",
+          "code"
+        ],
+        "properties": {
+          "message": {
+            "type": "string"
+          },
+          "code": {
+            "type": "integer",
+            "minimum": 100,
+            "maximum": 600
+          }
+        }
+      },
+      "ExtendedErrorModel": {
+        "allOf": [
+          {
+            "$ref": "#/components/schemas/ErrorModel"
+          },
+          {
+            "type": "object",
+            "required": [
+              "rootCause"
+            ],
+            "properties": {
+              "rootCause": {
+                "type": "string"
+              }
+            }
+          }
+        ]
+      }
+    }
+  }
+}
+
+
components:
+  schemas:
+    ErrorModel:
+      type: object
+      required:
+      - message
+      - code
+      properties:
+        message:
+          type: string
+        code:
+          type: integer
+          minimum: 100
+          maximum: 600
+    ExtendedErrorModel:
+      allOf:
+      - $ref: '#/components/schemas/ErrorModel'
+      - type: object
+        required:
+        - rootCause
+        properties:
+          rootCause:
+            type: string
+
+
9.1.3.2.6. Models with Polymorphism Support
+
{
+  "components": {
+    "schemas": {
+      "Pet": {
+        "type": "object",
+        "discriminator": {
+          "propertyName": "petType"
+        },
+        "properties": {
+          "name": {
+            "type": "string"
+          },
+          "petType": {
+            "type": "string"
+          }
+        },
+        "required": [
+          "name",
+          "petType"
+        ]
+      },
+      "Cat": {
+        "description": "A representation of a cat. Note that Cat will be used as the discriminator value.",
+        "allOf": [
+          {
+            "$ref": "#/components/schemas/Pet"
+          },
+          {
+            "type": "object",
+            "properties": {
+              "huntingSkill": {
+                "type": "string",
+                "description": "The measured skill for hunting",
+                "default": "lazy",
+                "enum": [
+                  "clueless",
+                  "lazy",
+                  "adventurous",
+                  "aggressive"
+                ]
+              }
+            },
+            "required": [
+              "huntingSkill"
+            ]
+          }
+        ]
+      },
+      "Dog": {
+        "description": "A representation of a dog. Note that Dog will be used as the discriminator value.",
+        "allOf": [
+          {
+            "$ref": "#/components/schemas/Pet"
+          },
+          {
+            "type": "object",
+            "properties": {
+              "packSize": {
+                "type": "integer",
+                "format": "int32",
+                "description": "the size of the pack the dog is from",
+                "default": 0,
+                "minimum": 0
+              }
+            },
+            "required": [
+              "packSize"
+            ]
+          }
+        ]
+      }
+    }
+  }
+}
+
+
components:
+  schemas:
+    Pet:
+      type: object
+      discriminator:
+        propertyName: petType
+      properties:
+        name:
+          type: string
+        petType:
+          type: string
+      required:
+      - name
+      - petType
+    Cat:  ## "Cat" will be used as the discriminator value
+      description: A representation of a cat
+      allOf:
+      - $ref: '#/components/schemas/Pet'
+      - type: object
+        properties:
+          huntingSkill:
+            type: string
+            description: The measured skill for hunting
+            enum:
+            - clueless
+            - lazy
+            - adventurous
+            - aggressive
+        required:
+        - huntingSkill
+    Dog:  ## "Dog" will be used as the discriminator value
+      description: A representation of a dog
+      allOf:
+      - $ref: '#/components/schemas/Pet'
+      - type: object
+        properties:
+          packSize:
+            type: integer
+            format: int32
+            description: the size of the pack the dog is from
+            default: 0
+            minimum: 0
+        required:
+        - packSize
+
+

9.1.4. Discriminator Object

+

When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

+

When using the discriminator, inline schemas will not be considered.

+

9.1.5. Fixed Fields

+ + + + + + +
Field Name + Type + Description +
propertyName + string + REQUIRED. The name of the property in the payload that will hold the discriminator value. +
mapping + Map[string, string] + An object to hold mappings between payload values and schema names or references. +
+

The discriminator attribute is legal only when using one of the composite keywords oneOf, anyOf, allOf.

+

In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:

+
MyResponseType:
+  oneOf:
+  - $ref: '#/components/schemas/Cat'
+  - $ref: '#/components/schemas/Dog'
+  - $ref: '#/components/schemas/Lizard'
+
+

which means the payload MUST, by validation, match exactly one of the schemas described by Cat, Dog, or Lizard. In this case, a discriminator MAY act as a “hint” to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use:

+
MyResponseType:
+  oneOf:
+  - $ref: '#/components/schemas/Cat'
+  - $ref: '#/components/schemas/Dog'
+  - $ref: '#/components/schemas/Lizard'
+  discriminator:
+    propertyName: pet_type
+
+

The expectation now is that a property with name pet_type MUST be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload:

+
{
+  "id": 12345,
+  "pet_type": "Cat"
+}
+
+

Will indicate that the Cat schema be used in conjunction with this payload.

+

In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional mapping definition MAY be used:

+
MyResponseType:
+  oneOf:
+  - $ref: '#/components/schemas/Cat'
+  - $ref: '#/components/schemas/Dog'
+  - $ref: '#/components/schemas/Lizard'
+  - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json'
+  discriminator:
+    propertyName: pet_type
+    mapping:
+      dog: '#/components/schemas/Dog'
+      monster: 'https://gigantic-server.com/schemas/Monster/schema.json'
+
+

Here the discriminator value of dog will map to the schema #/components/schemas/Dog, rather than the default (implicit) value of Dog. If the discriminator value does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison.

+

When used in conjunction with the anyOf construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload.

+

In both the oneOf and anyOf use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an allOf construct may be used as an alternate schema.

+

For example:

+
components:
+  schemas:
+    Pet:
+      type: object
+      required:
+      - pet_type
+      properties:
+        pet_type:
+          type: string
+      discriminator:
+        propertyName: pet_type
+        mapping:
+          cachorro: Dog
+    Cat:
+      allOf:
+      - $ref: '#/components/schemas/Pet'
+      - type: object
+        # all other properties specific to a Cat
+        properties:
+          name:
+            type: string
+    Dog:
+      allOf:
+      - $ref: '#/components/schemas/Pet'
+      - type: object
+        # all other properties specific to a Dog
+        properties:
+          bark:
+            type: string
+    Lizard:
+      allOf:
+      - $ref: '#/components/schemas/Pet'
+      - type: object
+        # all other properties specific to a Lizard
+        properties:
+          lovesRocks:
+            type: boolean
+
+

a payload like this:

+
{
+  "pet_type": "Cat",
+  "name": "misty"
+}
+
+

will indicate that the Cat schema be used. Likewise this schema:

+
{
+  "pet_type": "cachorro",
+  "bark": "soft"
+}
+
+

will map to Dog because of the definition in the mappings element.

+

9.1.6. XML Object

+

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.

+

9.1.7. Fixed Fields

+ + + + + + + + + +
Field Name + Type + Description +
name + string + Replaces the name of the element/attribute used for the described schema property. When defined within 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. +
namespace + string + The URI of the namespace definition. Value MUST be in the form of an absolute URI. +
prefix + string + The prefix to be used for the name. +
attribute + boolean + Declares whether the property definition translates to an attribute instead of an element. Default value is false. +
wrapped + 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). +
+

This object MAY be extended with Specification Extensions.

+
9.1.7.1. XML Object Examples
+

The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

+
9.1.7.1.1. No XML Element
+

Basic string property:

+
{
+    "animals": {
+        "type": "string"
+    }
+}
+
+
animals:
+  type: string
+
+
<animals>...</animals>
+
+

Basic string array property (wrapped is false by default):

+
{
+    "animals": {
+        "type": "array",
+        "items": {
+            "type": "string"
+        }
+    }
+}
+
+
animals:
+  type: array
+  items:
+    type: string
+
+
<animals>...</animals>
+<animals>...</animals>
+<animals>...</animals>
+
+
9.1.7.1.2. XML Name Replacement
+
{
+  "animals": {
+    "type": "string",
+    "xml": {
+      "name": "animal"
+    }
+  }
+}
+
+
animals:
+  type: string
+  xml:
+    name: animal
+
+
<animal>...</animal>
+
+
9.1.7.1.3. XML Attribute, Prefix and Namespace
+

In this example, a full model definition is shown.

+
{
+  "Person": {
+    "type": "object",
+    "properties": {
+      "id": {
+        "type": "integer",
+        "format": "int32",
+        "xml": {
+          "attribute": true
+        }
+      },
+      "name": {
+        "type": "string",
+        "xml": {
+          "namespace": "http://example.com/schema/sample",
+          "prefix": "sample"
+        }
+      }
+    }
+  }
+}
+
+
Person:
+  type: object
+  properties:
+    id:
+      type: integer
+      format: int32
+      xml:
+        attribute: true
+    name:
+      type: string
+      xml:
+        namespace: http://example.com/schema/sample
+        prefix: sample
+
+
<Person id="123">
+    <sample:name xmlns:sample="http://example.com/schema/sample">example</sample:name>
+</Person>
+
+
9.1.7.1.4. XML Arrays
+

Changing the element names:

+
{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    }
+  }
+}
+
+
animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+
+
<animal>value</animal>
+<animal>value</animal>
+
+

The external name property has no effect on the XML:

+
{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    },
+    "xml": {
+      "name": "aliens"
+    }
+  }
+}
+
+
animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+  xml:
+    name: aliens
+
+
<animal>value</animal>
+<animal>value</animal>
+
+

Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally:

+
{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    },
+    "xml": {
+      "wrapped": true
+    }
+  }
+}
+
+
animals:
+  type: array
+  items:
+    type: string
+  xml:
+    wrapped: true
+
+
<animals>
+  <animals>value</animals>
+  <animals>value</animals>
+</animals>
+
+

To overcome the naming problem in the example above, the following definition can be used:

+
{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    },
+    "xml": {
+      "wrapped": true
+    }
+  }
+}
+
+
animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+  xml:
+    wrapped: true
+
+
<animals>
+  <animal>value</animal>
+  <animal>value</animal>
+</animals>
+
+

Affecting both internal and external names:

+
{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    },
+    "xml": {
+      "name": "aliens",
+      "wrapped": true
+    }
+  }
+}
+
+
animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+  xml:
+    name: aliens
+    wrapped: true
+
+
<aliens>
+  <animal>value</animal>
+  <animal>value</animal>
+</aliens>
+
+

If we change the external element but not the internal ones:

+
{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    },
+    "xml": {
+      "name": "aliens",
+      "wrapped": true
+    }
+  }
+}
+
+
animals:
+  type: array
+  items:
+    type: string
+  xml:
+    name: aliens
+    wrapped: true
+
+
<aliens>
+  <aliens>value</aliens>
+  <aliens>value</aliens>
+</aliens>
+
+

9.1.8. Security Scheme Object

+

Defines a security scheme that can be used by the operations. +Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [rfc6749], and OpenID Connect Discovery.

+

9.1.9. Fixed Fields

+ + + + + + + + + + + + +
Field Name + Type + Applies To + Description +
type + string + Any + REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "oauth2", "openIdConnect". +
description + string + Any + A short description for security scheme. CommonMark syntax MAY be used for rich text representation. +
name + string + apiKey + REQUIRED. The name of the header, query or cookie parameter to be used. +
in + string + apiKey + REQUIRED. The location of the API key. Valid values are "query", "header" or "cookie". +
scheme + string + http + REQUIRED. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235]section-5.1). +
bearerFormat + string + http ("bearer") + A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. +
flows + OAuth Flows Object + oauth2 + REQUIRED. An object containing configuration information for the flow types supported. +
openIdConnectUrl + string + openIdConnect + REQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. +
+

This object MAY be extended with Specification Extensions.

+
9.1.9.1. Security Scheme Object Example
+
9.1.9.1.1. Basic Authentication Sample
+
{
+  "type": "http",
+  "scheme": "basic"
+}
+
+
type: http
+scheme: basic
+
+
9.1.9.1.2. API Key Sample
+
{
+  "type": "apiKey",
+  "name": "api_key",
+  "in": "header"
+}
+
+
type: apiKey
+name: api_key
+in: header
+
+
9.1.9.1.3. JWT Bearer Sample
+
{
+  "type": "http",
+  "scheme": "bearer",
+  "bearerFormat": "JWT",
+}
+
+
type: http
+scheme: bearer
+bearerFormat: JWT
+
+
9.1.9.1.4. Implicit OAuth2 Sample
+
{
+  "type": "oauth2",
+  "flows": {
+    "implicit": {
+      "authorizationUrl": "https://example.com/api/oauth/dialog",
+      "scopes": {
+        "write:pets": "modify pets in your account",
+        "read:pets": "read your pets"
+      }
+    }
+  }
+}
+
+
type: oauth2
+flows: 
+  implicit:
+    authorizationUrl: https://example.com/api/oauth/dialog
+    scopes:
+      write:pets: modify pets in your account
+      read:pets: read your pets
+
+

9.1.10. OAuth Flows Object

+

Allows configuration of the supported OAuth Flows.

+

9.1.11. Fixed Fields

+ + + + + + + + +
Field Name + Type + Description +
implicit + OAuth Flow Object + Configuration for the OAuth Implicit flow +
password + OAuth Flow Object + Configuration for the OAuth Resource Owner Password flow +
clientCredentials + OAuth Flow Object + Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0. +
authorizationCode + OAuth Flow Object + Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0. +
+

This object MAY be extended with Specification Extensions.

+

9.1.12. OAuth Flow Object

+

Configuration details for a supported OAuth Flow

+

9.1.13. Fixed Fields

+ + + + + + + + +
Field Name + Type + Applies To + Description +
authorizationUrl + string + oauth2 ("implicit", "authorizationCode") + REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL. +
tokenUrl + string + oauth2 ("password", "clientCredentials", "authorizationCode") + REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL. +
refreshUrl + string + oauth2 + The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. +
scopes + Map[string, string] + oauth2 + REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. +
+

This object MAY be extended with Specification Extensions.

+
9.1.13.1. OAuth Flow Object Examples
+
{
+  "type": "oauth2",
+  "flows": {
+    "implicit": {
+      "authorizationUrl": "https://example.com/api/oauth/dialog",
+      "scopes": {
+        "write:pets": "modify pets in your account",
+        "read:pets": "read your pets"
+      }
+    },
+    "authorizationCode": {
+      "authorizationUrl": "https://example.com/api/oauth/dialog",
+      "tokenUrl": "https://example.com/api/oauth/token",
+      "scopes": {
+        "write:pets": "modify pets in your account",
+        "read:pets": "read your pets"
+      }
+    }
+  }
+}
+
+
type: oauth2
+flows: 
+  implicit:
+    authorizationUrl: https://example.com/api/oauth/dialog
+    scopes:
+      write:pets: modify pets in your account
+      read:pets: read your pets
+  authorizationCode:
+    authorizationUrl: https://example.com/api/oauth/dialog
+    tokenUrl: https://example.com/api/oauth/token
+    scopes:
+      write:pets: modify pets in your account
+      read:pets: read your pets 
+
+

9.1.14. Security Requirement Object

+

Lists the required security schemes to execute this operation. +The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.

+

Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. +This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.

+

When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.

+

9.1.15. Patterned Fields

+ + + + + +
Field Pattern + Type + Description +
{name} + [string] + Each name MUST correspond to a security scheme which is declared in the Security Schemes under the Components Object. If the security scheme is of type "oauth2" or "openIdConnect", then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty. +
+
9.1.15.1. Security Requirement Object Examples
+
9.1.15.1.1. Non-OAuth2 Security Requirement
+
{
+  "api_key": []
+}
+
+
api_key: []
+
+
9.1.15.1.2. OAuth2 Security Requirement
+
{
+  "petstore_auth": [
+    "write:pets",
+    "read:pets"
+  ]
+}
+
+
petstore_auth:
+- write:pets
+- read:pets
+
+

9.2. Specification Extensions

+

While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

+

The extensions properties are implemented as patterned fields that are always prefixed by "x-".

+ + + + + +
Field Pattern + Type + Description +
^x- + Any + Allows extensions to the OpenAPI Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. 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).

+

9.3. Security Filtering

+

Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.

+

The reasoning is to allow an additional layer of access control over the documentation. +While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.

+

Two examples of this:

+
    +
  1. The Paths Object MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication. +
  2. The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object, so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see. +
+

Appendix A: Revision History

+ + + + + + + + + + + + + +
Version + Date + Notes +
3.0.0 + 2017-07-26 + Release of the OpenAPI Specification 3.0.0 +
3.0.0-rc2 + 2017-06-16 + rc2 of the 3.0 specification +
3.0.0-rc1 + 2017-04-27 + rc1 of the 3.0 specification +
3.0.0-rc0 + 2017-02-28 + Implementer’s Draft of the 3.0 specification +
2.0 + 2015-12-31 + Donation of Swagger 2.0 to the Open API Initiative +
2.0 + 2014-09-08 + Release of Swagger 2.0 +
1.2 + 2014-03-14 + Initial release of the formal document. +
1.1 + 2012-08-22 + Release of Swagger 1.1 +
1.0 + 2011-08-10 + First release of the Swagger Specification +
+
+
+

Conformance

+

Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. + The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” + in the normative parts of this document + are to be interpreted as described in RFC 2119. + However, for readability, + these words do not appear in all uppercase letters in this specification.

+

All of the text of this specification is normative + except sections explicitly marked as non-normative, examples, and notes. [RFC2119]

+

Examples in this specification are introduced with the words “for example” + or are set apart from the normative text with class="example", like this:

+
This is an example of an informative example.
+

Informative notes begin with the word “Note” + and are set apart from the normative text with class="note", like this:

+

Note, this is an informative note.

+
+ +

Index

+

Terms defined by this specification

+ +

References

+

Normative References

+
+
[RFC1866] +
D. Connolly; L. Masinter. The 'text/html' Media Type. June 2000. Informational. URL: https://tools.ietf.org/html/rfc2854 +
[RFC2119] +
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119 +
[RFC3986] +
T. Berners-Lee; R. Fielding; L. Masinter. Uniform Resource Identifier (URI): Generic Syntax. January 2005. Internet Standard. URL: https://tools.ietf.org/html/rfc3986 +
[RFC6570] +
J. Gregorio; et al. URI Template. March 2012. Proposed Standard. URL: https://tools.ietf.org/html/rfc6570 +
[RFC6749] +
D. Hardt, Ed.. The OAuth 2.0 Authorization Framework. October 2012. Proposed Standard. URL: https://tools.ietf.org/html/rfc6749 +
[RFC6838] +
N. Freed; J. Klensin; T. Hansen. Media Type Specifications and Registration Procedures. January 2013. Best Current Practice. URL: https://tools.ietf.org/html/rfc6838 +
[RFC6901] +
P. Bryan, Ed.; K. Zyp; M. Nottingham, Ed.. JavaScript Object Notation (JSON) Pointer. April 2013. Proposed Standard. URL: https://tools.ietf.org/html/rfc6901 +
[RFC7230] +
R. Fielding, Ed.; J. Reschke, Ed.. Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing. June 2014. Proposed Standard. URL: https://tools.ietf.org/html/rfc7230 +
[RFC7231] +
R. Fielding, Ed.; J. Reschke, Ed.. Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content. June 2014. Proposed Standard. URL: https://tools.ietf.org/html/rfc7231 +
[RFC8174] +
B. Leiba. Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words. May 2017. Best Current Practice. URL: https://tools.ietf.org/html/rfc8174 +
+ + + + \ No newline at end of file diff --git a/bikeshed/style-finish.html b/bikeshed/style-finish.html new file mode 100644 index 0000000000..5d2c91def1 --- /dev/null +++ b/bikeshed/style-finish.html @@ -0,0 +1 @@ + diff --git a/bikeshed/style-start.html b/bikeshed/style-start.html new file mode 100644 index 0000000000..747b621cc6 --- /dev/null +++ b/bikeshed/style-start.html @@ -0,0 +1,4 @@ + + + + + + + + +Open API Initiative logo diff --git a/bikeshed/v2/input.bs b/bikeshed/v2/input.bs new file mode 100644 index 0000000000..8d039730dc --- /dev/null +++ b/bikeshed/v2/input.bs @@ -0,0 +1,3258 @@ + + + + + + + + + + +Open API Initiative logo + +

OpenAPI Specification

+

(fka Swagger RESTful API Documentation Specification)

+

Version 2.0

+

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [!rfc2119].

+

The Swagger specification is licensed under The Apache License, Version 2.0.

+

Introductions

+

Swagger™ is a project used to describe and document RESTful APIs.

+

The Swagger specification defines a set of files required to describe such an API. These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various languages. Additional utilities can also take advantage of the resulting files, such as testing tools.

+

Revision History

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VersionDateNotes
2.02014-09-08Release of Swagger 2.0
1.22014-03-14Initial release of the formal document.
1.12012-08-22Release of Swagger 1.1
1.02011-08-10First release of the Swagger Specification
+

Definitions

+

Path Templating

+Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. +

Mime Types

+Mime type definitions are spread across several resources. The mime type definitions should be in compliance with [[!rfc6838]]. +

Some examples of possible mime type definitions:

+

+  text/plain; charset=utf-8
+  application/json
+  application/vnd.github+json
+  application/vnd.github.v3+json
+  application/vnd.github.v3.raw+json
+  application/vnd.github.v3.text+json
+  application/vnd.github.v3.html+json
+  application/vnd.github.v3.full+json
+  application/vnd.github.v3.diff
+  application/vnd.github.v3.patch
+
+

HTTP Status Codes

+The HTTP Status Codes are used to indicate the status of the executed operation. The available status codes are described by [[!rfc7231]]section-6) and in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). +

Specification

+

Format

+

The files describing the RESTful API in accordance with the Swagger specification are represented as JSON objects and conform to the JSON standards. YAML, being a superset of JSON, can be used as well to +represent a Swagger specification file.

+

For example, if a field is said to have an array value, the JSON array representation will be used:

+

+{
+   "field" : [...]
+}
+
+

While the API is described using JSON it does not impose a JSON input/output to the API itself.

+

All field names in the specification are case sensitive.

+

The schema exposes two types of fields. Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. Patterned fields can have multiple occurrences as long as each has a unique name.

+

File Structure

+

The Swagger representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for $ref fields in the specification as follows from the JSON Schema definitions.

+

By convention, the Swagger specification file is named swagger.json.

+

Data Types

+

Primitive data types in the Swagger Specification are based on the types supported by the JSON-Schema Draft 4. Models are described using the Schema Object which is a subset of JSON Schema Draft 4.

+

An additional primitive data type "file" is used by the Parameter Object and the Response Object to set the parameter type or the response as being a file.

+

Primitives have an optional modifier property format. Swagger uses several known formats to more finely define the data type being used. However, the format property is an open string-valued property, and can have any value to support documentation needs. Formats such as "email", "uuid", etc., can be used even though they are not defined by this specification. Types that are not accompanied by a format property follow their definition from the JSON Schema (except for file type which is defined above). The formats defined by the Swagger Specification are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Common NametypeformatComments
integerintegerint32signed 32 bits
longintegerint64signed 64 bits
floatnumberfloat
doublenumberdouble
stringstring
bytestringbytebase64 encoded characters
binarystringbinaryany sequence of octets
booleanboolean
datestringdateAs defined by full-date - [!rfc3339]
dateTimestringdate-timeAs defined by date-time - [!rfc3339]
passwordstringpasswordUsed to hint UIs the input needs to be obscured.
+

Schema

+

Swagger Object

+

This is the root document object for the API specification. It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
swaggerstringRequired. 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".
infoInfo ObjectRequired. Provides metadata about the API. The metadata can be used by the clients if needed.
hoststringThe 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.
basePathstringThe 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.
schemes[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.
consumes[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.
produces[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.
pathsPaths ObjectRequired. The available paths and operations for the API.
definitionsDefinitions ObjectAn object to hold data types produced and consumed by operations.
parametersParameters Definitions ObjectAn object to hold parameters that can be used across operations. This property does not define global parameters for all operations.
responsesResponses Definitions ObjectAn object to hold responses that can be used across operations. This property does not define global responses for all operations.
securityDefinitionsSecurity Definitions ObjectSecurity scheme definitions that can be used across the specification.
security[Security Requirement Object]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.
tags[Tag Object]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.
externalDocsExternal Documentation ObjectAdditional external documentation.
+
Patterned Objects
+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+

Info Object

+

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.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
titlestringRequired. The title of the application.
descriptionstringA short description of the application. GFM syntax can be used for rich text representation.
termsOfServicestringThe Terms of Service for the API.
contactContact ObjectThe contact information for the exposed API.
licenseLicense ObjectThe license information for the exposed API.
versionstringRequired Provides the version of the application API (not to be confused with the specification version).
+
Patterned Objects
+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+
Info Object Example:
+

+{
+  "title": "Swagger Sample App",
+  "description": "This is a sample server Petstore server.",
+  "termsOfService": "http://swagger.io/terms/",
+  "contact": {
+    "name": "API Support",
+    "url": "http://www.swagger.io/support",
+    "email": "support@swagger.io"
+  },
+  "license": {
+    "name": "Apache 2.0",
+    "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
+  },
+  "version": "1.0.1"
+}
+
+

+title: Swagger Sample App
+description: This is a sample server Petstore server.
+termsOfService: http://swagger.io/terms/
+contact:
+  name: API Support
+  url: http://www.swagger.io/support
+  email: support@swagger.io
+license:
+  name: Apache 2.0
+  url: http://www.apache.org/licenses/LICENSE-2.0.html
+version: 1.0.1
+
+

Contact Object

+

Contact information for the exposed API.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
namestringThe identifying name of the contact person/organization.
urlstringThe URL pointing to the contact information. MUST be in the format of a URL.
emailstringThe email address of the contact person/organization. MUST be in the format of an email address.
+
Patterned Objects
+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+
Contact Object Example:
+

+{
+  "name": "API Support",
+  "url": "http://www.swagger.io/support",
+  "email": "support@swagger.io"
+}
+
+

+name: API Support
+url: http://www.swagger.io/support
+email: support@swagger.io
+
+

License Object

+

License information for the exposed API.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
namestringRequired. The license name used for the API.
urlstringA URL to the license used for the API. MUST be in the format of a URL.
+
Patterned Objects
+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+
License Object Example:
+

+{
+  "name": "Apache 2.0",
+  "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
+}
+
+

+name: Apache 2.0
+url: http://www.apache.org/licenses/LICENSE-2.0.html
+
+

Paths Object

+

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.

+

Patterned Fields

+ + + + + + + + + + + + + + + + + + + + +
Field PatternTypeDescription
/{path}Path Item ObjectA relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended to the basePath in order to construct the full URL. Path templating is allowed.
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+
Paths Object Example
+

+{
+  "/pets": {
+    "get": {
+      "description": "Returns all pets from the system that the user has access to",
+      "produces": [
+        "application/json"
+      ],
+      "responses": {
+        "200": {
+          "description": "A list of pets.",
+          "schema": {
+            "type": "array",
+            "items": {
+              "$ref": "#/definitions/pet"
+            }
+          }
+        }
+      }
+    }
+  }
+}
+
+

+/pets:
+  get:
+    description: Returns all pets from the system that the user has access to
+    produces:
+    - application/json
+    responses:
+      '200':
+        description: A list of pets.
+        schema:
+          type: array
+          items:
+            $ref: '#/definitions/pet'
+
+

Path Item Object

+

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.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
$refstringAllows 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.
getOperation ObjectA definition of a GET operation on this path.
putOperation ObjectA definition of a PUT operation on this path.
postOperation ObjectA definition of a POST operation on this path.
deleteOperation ObjectA definition of a DELETE operation on this path.
optionsOperation ObjectA definition of a OPTIONS operation on this path.
headOperation ObjectA definition of a HEAD operation on this path.
patchOperation ObjectA definition of a PATCH operation on this path.
parameters[Parameter Object | Reference Object]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.
+
Patterned Fields
+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+
Path Item Object Example
+

+{
+  "get": {
+    "description": "Returns pets based on ID",
+    "summary": "Find pets by ID",
+    "operationId": "getPetsById",
+    "produces": [
+      "application/json",
+      "text/html"
+    ],
+    "responses": {
+      "200": {
+        "description": "pet response",
+        "schema": {
+          "type": "array",
+          "items": {
+            "$ref": "#/definitions/Pet"
+          }
+        }
+      },
+      "default": {
+        "description": "error payload",
+        "schema": {
+          "$ref": "#/definitions/ErrorModel"
+        }
+      }
+    }
+  },
+  "parameters": [
+    {
+      "name": "id",
+      "in": "path",
+      "description": "ID of pet to use",
+      "required": true,
+      "type": "array",
+      "items": {
+        "type": "string"
+      },
+      "collectionFormat": "csv"
+    }
+  ]
+}
+
+

+get:
+  description: Returns pets based on ID
+  summary: Find pets by ID
+  operationId: getPetsById
+  produces:
+  - application/json
+  - text/html
+  responses:
+    '200':
+      description: pet response
+      schema:
+        type: array
+        items:
+          $ref: '#/definitions/Pet'
+    default:
+      description: error payload
+      schema:
+        $ref: '#/definitions/ErrorModel'
+parameters:
+- name: id
+  in: path
+  description: ID of pet to use
+  required: true
+  type: array
+  items:
+    type: string
+  collectionFormat: csv
+
+

Operation Object

+

Describes a single API operation on a path.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
tags[string]A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
summarystringA short summary of what the operation does. For maximum readability in the swagger-ui, this field SHOULD be less than 120 characters.
descriptionstringA verbose explanation of the operation behavior. GFM syntax can be used for rich text representation.
externalDocsExternal Documentation ObjectAdditional external documentation for this operation.
operationIdstringUnique 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.
consumes[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.
produces[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.
parameters[Parameter Object | Reference Object]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.
responsesResponses ObjectRequired. The list of possible responses as they are returned from executing this operation.
schemes[string]The transfer protocol for the operation. Values MUST be from the list: "http", "https", "ws", "wss". The value overrides the Swagger Object schemes definition.
deprecatedbooleanDeclares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is false.
security[Security Requirement Object]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.
+
Patterned Objects
+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+
Operation Object Example
+

+{
+  "tags": [
+    "pet"
+  ],
+  "summary": "Updates a pet in the store with form data",
+  "description": "",
+  "operationId": "updatePetWithForm",
+  "consumes": [
+    "application/x-www-form-urlencoded"
+  ],
+  "produces": [
+    "application/json",
+    "application/xml"
+  ],
+  "parameters": [
+    {
+      "name": "petId",
+      "in": "path",
+      "description": "ID of pet that needs to be updated",
+      "required": true,
+      "type": "string"
+    },
+    {
+      "name": "name",
+      "in": "formData",
+      "description": "Updated name of the pet",
+      "required": false,
+      "type": "string"
+    },
+    {
+      "name": "status",
+      "in": "formData",
+      "description": "Updated status of the pet",
+      "required": false,
+      "type": "string"
+    }
+  ],
+  "responses": {
+    "200": {
+      "description": "Pet updated."
+    },
+    "405": {
+      "description": "Invalid input"
+    }
+  },
+  "security": [
+    {
+      "petstore_auth": [
+        "write:pets",
+        "read:pets"
+      ]
+    }
+  ]
+}
+
+

+tags:
+- pet
+summary: Updates a pet in the store with form data
+description: ""
+operationId: updatePetWithForm
+consumes:
+- application/x-www-form-urlencoded
+produces:
+- application/json
+- application/xml
+parameters:
+- name: petId
+  in: path
+  description: ID of pet that needs to be updated
+  required: true
+  type: string
+- name: name
+  in: formData
+  description: Updated name of the pet
+  required: false
+  type: string
+- name: status
+  in: formData
+  description: Updated status of the pet
+  required: false
+  type: string
+responses:
+  '200':
+    description: Pet updated.
+  '405':
+    description: Invalid input
+security:
+- petstore_auth:
+  - write:pets
+  - read:pets
+
+

External Documentation Object

+

Allows referencing an external resource for extended documentation.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
descriptionstringA short description of the target documentation. GFM syntax can be used for rich text representation.
urlstringRequired. The URL for the target documentation. Value MUST be in the format of a URL.
+
Patterned Objects
+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+
External Documentation Object Example
+

+{
+  "description": "Find more info here",
+  "url": "https://swagger.io"
+}
+
+

+description: Find more info here
+url: https://swagger.io
+
+

Parameter Object

+

Describes a single operation parameter.

+

A unique parameter is defined by a combination of a name and location.

+

There are five possible parameter types.

+
    +
  • Path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId.
  • +
  • Query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id.
  • +
  • Header - Custom headers that are expected as part of the request.
  • +
  • Body - The payload that’s appended to the HTTP request. Since there can only be one payload, there can only be one body parameter. The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation.
  • +
  • Form - Used to describe the payload of an HTTP request when either application/x-www-form-urlencoded, multipart/form-data or both are used as the content type of the request (in Swagger’s definition, the consumes property of an operation). This is the only parameter type that can be used to send files, thus supporting the file type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): +
      +
    • application/x-www-form-urlencoded - Similar to the format of Query parameters but as a payload. For example, foo=1&bar=swagger - both foo and bar are form parameters. This is normally used for simple parameters that are being transferred.
    • +
    • multipart/form-data - each parameter takes a section in the payload with an internal header. For example, for the header Content-Disposition: form-data; name="submit-name" the name of the parameter is submit-name. This type of form parameters is more commonly used for file transfers.
    • +
    +
  • +
+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
namestringRequired. 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.
instringRequired. The location of the parameter. Possible values are “query”, “header”, “path”, “formData” or “body”.
descriptionstringA brief description of the parameter. This could contain examples of use. GFM syntax can be used for rich text representation.
requiredbooleanDetermines 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.
+

If in is "body":

+ + + + + + + + + + + + + + + +
Field NameTypeDescription
schemaSchema ObjectRequired. The schema defining the type used for the body parameter.
+

If in is any value other than "body":

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
typestringRequired. 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".
formatstringThe extending format for the previously mentioned type. See Data Type Formats for further details.
allowEmptyValuebooleanSets 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.
itemsItems ObjectRequired if type is “array”. Describes the type of items in the array.
collectionFormatstringDetermines 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.
default*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.
maximumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
exclusiveMaximumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
minimumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
exclusiveMinimumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
maxLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1.
minLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2.
patternstringSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.
maxItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2.
minItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3.
uniqueItemsbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4.
enum[*]See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1.
multipleOfnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1.
+
Patterned Fields
+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+
Parameter Object Examples
+
Body Parameters
+

A body parameter with a referenced schema definition (normally for a model definition):

+

+{
+  "name": "user",
+  "in": "body",
+  "description": "user to add to the system",
+  "required": true,
+  "schema": {
+    "$ref": "#/definitions/User"
+  }
+}
+
+

+name: user
+in: body
+description: user to add to the system
+required: true
+schema:
+  $ref: '#/definitions/User'
+
+

A body parameter that is an array of string values:

+

+{
+  "name": "user",
+  "in": "body",
+  "description": "user to add to the system",
+  "required": true,
+  "schema": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    }
+  }
+}
+
+

+name: user
+in: body
+description: user to add to the system
+required: true
+schema:
+  type: array
+  items:
+    type: string
+
+
Other Parameters
+

A header parameter with an array of 64 bit integer numbers:

+

+{
+  "name": "token",
+  "in": "header",
+  "description": "token to be passed as a header",
+  "required": true,
+  "type": "array",
+  "items": {
+    "type": "integer",
+    "format": "int64"
+  },
+  "collectionFormat": "csv"
+}
+
+

+name: token
+in: header
+description: token to be passed as a header
+required: true
+type: array
+items:
+  type: integer
+  format: int64
+collectionFormat: csv
+
+

A path parameter of a string value:

+

+{
+  "name": "username",
+  "in": "path",
+  "description": "username to fetch",
+  "required": true,
+  "type": "string"
+}
+
+

+name: username
+in: path
+description: username to fetch
+required: true
+type: string
+
+

An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

+

+{
+  "name": "id",
+  "in": "query",
+  "description": "ID of the object to fetch",
+  "required": false,
+  "type": "array",
+  "items": {
+    "type": "string"
+  },
+  "collectionFormat": "multi"
+}
+
+

+name: id
+in: query
+description: ID of the object to fetch
+required: false
+type: array
+items:
+  type: string
+collectionFormat: multi
+
+

A form data with file type for a file upload:

+

+{
+  "name": "avatar",
+  "in": "formData",
+  "description": "The avatar of the user",
+  "required": true,
+  "type": "file"
+}
+
+

+name: avatar
+in: formData
+description: The avatar of the user
+required: true
+type: file
+
+

Items Object

+

A limited subset of JSON-Schema’s items object. It is used by parameter definitions that are not located in "body".

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
typestringRequired. The internal type of the array. The value MUST be one of "string", "number", "integer", "boolean", or "array". Files and models are not allowed.
formatstringThe extending format for the previously mentioned type. See Data Type Formats for further details.
itemsItems ObjectRequired if type is “array”. Describes the type of items in the array.
collectionFormatstringDetermines 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.
Default value is csv.
default*Declares the value of the item that the server will use if none is provided. (Note: “default” has no meaning for required items.) 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 the data type.
maximumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
exclusiveMaximumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
minimumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
exclusiveMinimumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
maxLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1.
minLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2.
patternstringSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.
maxItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2.
minItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3.
uniqueItemsbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4.
enum[*]See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1.
multipleOfnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1.
+
Patterned Objects
+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+
Items Object Examples
+

Items must be of type string and have the minimum length of 2 characters:

+

+{
+    "type": "string",
+    "minLength": 2
+}
+
+

+type: string
+minLength: 2
+
+

An array of arrays, the internal array being of type integer, numbers must be between 0 and 63 (inclusive):

+

+{
+    "type": "array",
+    "items": {
+        "type": "integer",
+        "minimum": 0,
+        "maximum": 63
+    }
+}
+
+

+type: array
+items:
+  type: integer
+  minimum: 0
+  maximum: 63
+
+

Responses Object

+

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 Responses Object MUST contain at least one response code, and it SHOULD be the response for a successful operation call.

+

Fixed Fields

+ + + + + + + + + + + + + + + +
Field NameTypeDescription
defaultResponse Object | Reference ObjectThe 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.
+
Patterned Fields
+ + + + + + + + + + + + + + + + + + + + +
Field PatternTypeDescription
{HTTP Status Code}Response Object | Reference ObjectAny HTTP status code can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. Reference Object can be used to link to a response that is defined at the Swagger Object’s responses section.
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+
Responses Object Example
+

A 200 response for successful operation and a default response for others (implying an error):

+

+{
+  "200": {
+    "description": "a pet to be returned",
+    "schema": {
+      "$ref": "#/definitions/Pet"
+    }
+  },
+  "default": {
+    "description": "Unexpected error",
+    "schema": {
+      "$ref": "#/definitions/ErrorModel"
+    }
+  }
+}
+
+

+'200':
+  description: a pet to be returned
+  schema:
+    $ref: '#/definitions/Pet'
+default:
+  description: Unexpected error
+  schema:
+    $ref: '#/definitions/ErrorModel'
+
+

Response Object

+Describes a single response from an API Operation. +

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
descriptionstringRequired. A short description of the response. GFM syntax can be used for rich text representation.
schemaSchema ObjectA 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 Schema Object, its root type value may also be "file". This SHOULD be accompanied by a relevant produces mime-type.
headersHeaders ObjectA list of headers that are sent with the response.
examplesExample ObjectAn example of the response message.
+
Patterned Objects
+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+
Response Object Examples
+

Response of an array of a complex type:

+

+{
+  "description": "A complex object array response",
+  "schema": {
+    "type": "array",
+    "items": {
+      "$ref": "#/definitions/VeryComplexType"
+    }
+  }
+}
+
+

+description: A complex object array response
+schema:
+  type: array
+  items:
+    $ref: '#/definitions/VeryComplexType'
+
+

Response with a string type:

+

+{
+  "description": "A simple string response",
+  "schema": {
+    "type": "string"
+  }
+}
+
+

+description: A simple string response
+schema:
+  type: string
+
+

Response with headers:

+

+{
+  "description": "A simple string response",
+  "schema": {
+    "type": "string"
+  },
+  "headers": {
+    "X-Rate-Limit-Limit": {
+      "description": "The number of allowed requests in the current period",
+      "type": "integer"
+    },
+    "X-Rate-Limit-Remaining": {
+      "description": "The number of remaining requests in the current period",
+      "type": "integer"
+    },
+    "X-Rate-Limit-Reset": {
+      "description": "The number of seconds left in the current period",
+      "type": "integer"
+    }
+  }
+}
+
+

+description: A simple string response
+schema:
+  type: string
+headers:
+  X-Rate-Limit-Limit:
+    description: The number of allowed requests in the current period
+    type: integer
+  X-Rate-Limit-Remaining:
+    description: The number of remaining requests in the current period
+    type: integer
+  X-Rate-Limit-Reset:
+    description: The number of seconds left in the current period
+    type: integer
+
+

Response with no return value:

+

+{
+  "description": "object created"
+}
+
+

+description: object created
+
+

Headers Object

+Lists the headers that can be sent as part of a response. +

Patterned Fields

+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
{name}Header ObjectThe name of the property corresponds to the name of the header. The value describes the type of the header.
+
Headers Object Example
+

Rate-limit headers:

+

+{
+    "X-Rate-Limit-Limit": {
+        "description": "The number of allowed requests in the current period",
+        "type": "integer"
+    },
+    "X-Rate-Limit-Remaining": {
+        "description": "The number of remaining requests in the current period",
+        "type": "integer"
+    },
+    "X-Rate-Limit-Reset": {
+        "description": "The number of seconds left in the current period",
+        "type": "integer"
+    }
+}
+
+

+X-Rate-Limit-Limit:
+  description: The number of allowed requests in the current period
+  type: integer
+X-Rate-Limit-Remaining:
+  description: The number of remaining requests in the current period
+  type: integer
+X-Rate-Limit-Reset:
+  description: The number of seconds left in the current period
+  type: integer
+
+

Example Object

+

Allows sharing examples for operation responses.

+

Patterned Fields

+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
{mime type}AnyThe 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.
+
Example Object Example
+

Example response for application/json mimetype of a Pet data type:

+

+{
+  "application/json": {
+    "name": "Puma",
+    "type": "Dog",
+    "color": "Black",
+    "gender": "Female",
+    "breed": "Mixed"
+  }
+}
+
+

+application/json:
+  name: Puma
+  type: Dog
+  color: Black
+  gender: Female
+  breed: Mixed
+
+

Header Object

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
descriptionstringA short description of the header.
typestringRequired. The type of the object. The value MUST be one of "string", "number", "integer", "boolean", or "array".
formatstringThe extending format for the previously mentioned type. See Data Type Formats for further details.
itemsItems ObjectRequired if type is “array”. Describes the type of items in the array.
collectionFormatstringDetermines 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.
Default value is csv.
default*Declares the value of the header that the server will use if none is provided. (Note: “default” has no meaning for required headers.) 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 the header.
maximumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
exclusiveMaximumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
minimumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
exclusiveMinimumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
maxLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1.
minLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2.
patternstringSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.
maxItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2.
minItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3.
uniqueItemsbooleanhttps://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4.
enum[*]See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1.
multipleOfnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1.
+

Patterned Objects

+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+
Header Object Example
+

A simple header with of an integer type:

+

+{
+  "description": "The number of allowed requests in the current period",
+  "type": "integer"
+}
+
+

+description: The number of allowed requests in the current period
+type: integer
+
+

Tag Object

+

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.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
namestringRequired. The name of the tag.
descriptionstringA short description for the tag. GFM syntax can be used for rich text representation.
externalDocsExternal Documentation ObjectAdditional external documentation for this tag.
+
Patterned Fields
+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+
Tag Object Example
+

+{
+	"name": "pet",
+	"description": "Pets operations"
+}
+
+

+name: pet
+description: Pets operations
+
+

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

+

Fixed Fields

+ + + + + + + + + + + + + + + +
Field NameTypeDescription
$refstringRequired. The reference string.
+
Reference Object Example
+

+{
+	"$ref": "#/definitions/Pet"
+}
+
+

+$ref: '#/definitions/Pet'
+
+
Relative Schema File Example
+

+{
+  "$ref": "Pet.json"
+}
+
+

+$ref: 'Pet.yaml'
+
+
Relative Files With Embedded Schema Example
+

+{
+  "$ref": "definitions.json#/Pet"
+}
+
+

+$ref: 'definitions.yaml#/Pet'
+
+

Schema Object

+

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.

+

Further information about the properties can be found in JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here.

+

The following properties are taken directly from the JSON Schema definition and follow the same specifications:

+
    +
  • $ref - As a JSON Reference
  • +
  • format (See Data Type Formats for further details)
  • +
  • title
  • +
  • description (GFM syntax can be used for rich text representation)
  • +
  • default (Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object)
  • +
  • multipleOf
  • +
  • maximum
  • +
  • exclusiveMaximum
  • +
  • minimum
  • +
  • exclusiveMinimum
  • +
  • maxLength
  • +
  • minLength
  • +
  • pattern
  • +
  • maxItems
  • +
  • minItems
  • +
  • uniqueItems
  • +
  • maxProperties
  • +
  • minProperties
  • +
  • required
  • +
  • enum
  • +
  • type
  • +
+

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.

+
    +
  • items
  • +
  • allOf
  • +
  • properties
  • +
  • additionalProperties
  • +
+

Other than the JSON Schema subset fields, the following fields may be used for further schema documentation.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
discriminatorstringAdds 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.
readOnlybooleanRelevant 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.
xmlXML ObjectThis 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.
externalDocsExternal Documentation ObjectAdditional external documentation for this schema.
exampleAnyA free-form property to include an example of an instance for this schema.
+
Patterned Objects
+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+
Composition and Inheritance (Polymorphism)
+

Swagger allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. allOf takes in an array of object definitions that are validated independently but together compose a single object.

+

While composition offers model extensibility, it does not imply a hierarchy between the models. To support polymorphism, Swagger adds the support of the discriminator field. When used, the discriminator will be the name of the property used to decide which schema definition is used to validate the structure of the model. As such, the discriminator field MUST be a required field. The value of the chosen property has to be the friendly name given to the model under the definitions property. As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism.

+
XML Modeling
+

The xml property allows extra definitions when translating the JSON definition to XML. The XML Object contains additional information about the available options.

+
Schema Object Examples
+
Primitive Sample
+

Unlike previous versions of Swagger, Schema definitions can be used to describe primitive and arrays as well.

+

+{
+    "type": "string",
+    "format": "email"
+}
+
+

+type: string
+format: email
+
+
Simple Model
+

+{
+  "type": "object",
+  "required": [
+    "name"
+  ],
+  "properties": {
+    "name": {
+      "type": "string"
+    },
+    "address": {
+      "$ref": "#/definitions/Address"
+    },
+    "age": {
+      "type": "integer",
+      "format": "int32",
+      "minimum": 0
+    }
+  }
+}
+
+

+type: object
+required:
+- name
+properties:
+  name:
+    type: string
+  address:
+    $ref: '#/definitions/Address'
+  age:
+    type: integer
+    format: int32
+    minimum: 0
+
+
Model with Map/Dictionary Properties
+

For a simple string to string mapping:

+

+{
+  "type": "object",
+  "additionalProperties": {
+    "type": "string"
+  }
+}
+
+

+type: object
+additionalProperties:
+  type: string
+
+

For a string to model mapping:

+

+{
+  "type": "object",
+  "additionalProperties": {
+    "$ref": "#/definitions/ComplexModel"
+  }
+}
+
+

+type: object
+additionalProperties:
+  $ref: '#/definitions/ComplexModel'
+
+
Model with Example
+

+{
+  "type": "object",
+  "properties": {
+    "id": {
+      "type": "integer",
+      "format": "int64"
+    },
+    "name": {
+      "type": "string"
+    }
+  },
+  "required": [
+    "name"
+  ],
+  "example": {
+    "name": "Puma",
+    "id": 1
+  }
+}
+
+

+type: object
+properties:
+  id:
+    type: integer
+    format: int64
+  name:
+    type: string
+required:
+- name
+example:
+  name: Puma
+  id: 1
+
+
Models with Composition
+

+{
+  "definitions": {
+    "ErrorModel": {
+      "type": "object",
+      "required": [
+        "message",
+        "code"
+      ],
+      "properties": {
+        "message": {
+          "type": "string"
+        },
+        "code": {
+          "type": "integer",
+          "minimum": 100,
+          "maximum": 600
+        }
+      }
+    },
+    "ExtendedErrorModel": {
+      "allOf": [
+        {
+          "$ref": "#/definitions/ErrorModel"
+        },
+        {
+          "type": "object",
+          "required": [
+            "rootCause"
+          ],
+          "properties": {
+            "rootCause": {
+              "type": "string"
+            }
+          }
+        }
+      ]
+    }
+  }
+}
+
+

+definitions:
+  ErrorModel:
+    type: object
+    required:
+    - message
+    - code
+    properties:
+      message:
+        type: string
+      code:
+        type: integer
+        minimum: 100
+        maximum: 600
+  ExtendedErrorModel:
+    allOf:
+    - $ref: '#/definitions/ErrorModel'
+    - type: object
+      required:
+      - rootCause
+      properties:
+        rootCause:
+          type: string
+
+
Models with Polymorphism Support
+

+{
+  "definitions": {
+    "Pet": {
+      "type": "object",
+      "discriminator": "petType",
+      "properties": {
+        "name": {
+          "type": "string"
+        },
+        "petType": {
+          "type": "string"
+        }
+      },
+      "required": [
+        "name",
+        "petType"
+      ]
+    },
+    "Cat": {
+      "description": "A representation of a cat",
+      "allOf": [
+        {
+          "$ref": "#/definitions/Pet"
+        },
+        {
+          "type": "object",
+          "properties": {
+            "huntingSkill": {
+              "type": "string",
+              "description": "The measured skill for hunting",
+              "default": "lazy",
+              "enum": [
+                "clueless",
+                "lazy",
+                "adventurous",
+                "aggressive"
+              ]
+            }
+          },
+          "required": [
+            "huntingSkill"
+          ]
+        }
+      ]
+    },
+    "Dog": {
+      "description": "A representation of a dog",
+      "allOf": [
+        {
+          "$ref": "#/definitions/Pet"
+        },
+        {
+          "type": "object",
+          "properties": {
+            "packSize": {
+              "type": "integer",
+              "format": "int32",
+              "description": "the size of the pack the dog is from",
+              "default": 0,
+              "minimum": 0
+            }
+          },
+          "required": [
+            "packSize"
+          ]
+        }
+      ]
+    }
+  }
+}
+
+

+definitions:
+  Pet:
+    type: object
+    discriminator: petType
+    properties:
+      name:
+        type: string
+      petType:
+        type: string
+    required:
+    - name
+    - petType
+  Cat:
+    description: A representation of a cat
+    allOf:
+    - $ref: '#/definitions/Pet'
+    - type: object
+      properties:
+        huntingSkill:
+          type: string
+          description: The measured skill for hunting
+          default: lazy
+          enum:
+          - clueless
+          - lazy
+          - adventurous
+          - aggressive
+      required:
+      - huntingSkill
+  Dog:
+    description: A representation of a dog
+    allOf:
+    - $ref: '#/definitions/Pet'
+    - type: object
+      properties:
+        packSize:
+          type: integer
+          format: int32
+          description: the size of the pack the dog is from
+          default: 0
+          minimum: 0
+      required:
+      - packSize
+
+

XML Object

+

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.

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeDescription
namestringReplaces 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.
namespacestringThe URL of the namespace definition. Value SHOULD be in the form of a URL.
prefixstringThe prefix to be used for the name.
attributebooleanDeclares whether the property definition translates to an attribute instead of an element. Default value is false.
wrappedbooleanMAY 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).
+
Patterned Objects
+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+
XML Object Examples
+

The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

+
No XML Element
+

Basic string property:

+

+{
+    "animals": {
+        "type": "string"
+    }
+}
+
+

+animals:
+  type: string
+
+

+<animals>...</animals>
+
+

Basic string array property (wrapped is false by default):

+

+{
+    "animals": {
+        "type": "array",
+        "items": {
+            "type": "string"
+        }
+    }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+
+

+<animals>...</animals>
+<animals>...</animals>
+<animals>...</animals>
+
+
XML Name Replacement
+

+{
+  "animals": {
+    "type": "string",
+    "xml": {
+      "name": "animal"
+    }
+  }
+}
+
+

+animals:
+  type: string
+  xml:
+    name: animal
+
+

+<animal>...</animal>
+
+
XML Attribute, Prefix and Namespace
+

In this example, a full model definition is shown.

+

+{
+  "Person": {
+    "type": "object",
+    "properties": {
+      "id": {
+        "type": "integer",
+        "format": "int32",
+        "xml": {
+          "attribute": true
+        }
+      },
+      "name": {
+        "type": "string",
+        "xml": {
+          "namespace": "http://swagger.io/schema/sample",
+          "prefix": "sample"
+        }
+      }
+    }
+  }
+}
+
+

+Person:
+  type: object
+  properties:
+    id:
+      type: integer
+      format: int32
+      xml:
+        attribute: true
+    name:
+      type: string
+      xml:
+        namespace: http://swagger.io/schema/sample
+        prefix: sample
+
+

+<Person id="123">
+    <sample:name xmlns:sample="http://swagger.io/schema/sample">example</sample:name>
+</Person>
+
+
XML Arrays
+

Changing the element names:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+
+

+<animal>value</animal>
+<animal>value</animal>
+
+

The external name property has no effect on the XML:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    },
+    "xml": {
+      "name": "aliens"
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+  xml:
+    name: aliens
+
+

+<animal>value</animal>
+<animal>value</animal>
+
+

Even when the array is wrapped, if no name is explicitly defined, the same name will be used both internally and externally:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    },
+    "xml": {
+      "wrapped": true
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+  xml:
+    wrapped: true
+
+

+<animals>
+  <animals>value</animals>
+  <animals>value</animals>
+</animals>
+
+

To overcome the above example, the following definition can be used:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    },
+    "xml": {
+      "wrapped": true
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+  xml:
+    wrapped: true
+
+

+<animals>
+  <animal>value</animal>
+  <animal>value</animal>
+</animals>
+
+

Affecting both internal and external names:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    },
+    "xml": {
+      "name": "aliens",
+      "wrapped": true
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+  xml:
+    name: aliens
+    wrapped: true
+
+

+<aliens>
+  <animal>value</animal>
+  <animal>value</animal>
+</aliens>
+
+

If we change the external element but not the internal ones:

+

+{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    },
+    "xml": {
+      "name": "aliens",
+      "wrapped": true
+    }
+  }
+}
+
+

+animals:
+  type: array
+  items:
+    type: string
+  xml:
+    name: aliens
+    wrapped: true
+
+

+<aliens>
+  <aliens>value</aliens>
+  <aliens>value</aliens>
+</aliens>
+
+

Definitions Object

+

An object to hold data types that can be consumed and produced by operations. These data types can be primitives, arrays or models.

+

Patterned Fields

+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
{name}Schema ObjectA single definition, mapping a “name” to the schema it defines.
+
Definitions Object Example
+

+{
+  "Category": {
+    "type": "object",
+    "properties": {
+      "id": {
+        "type": "integer",
+        "format": "int64"
+      },
+      "name": {
+        "type": "string"
+      }
+    }
+  },
+  "Tag": {
+    "type": "object",
+    "properties": {
+      "id": {
+        "type": "integer",
+        "format": "int64"
+      },
+      "name": {
+        "type": "string"
+      }
+    }
+  }
+}
+
+

+Category:
+  type: object
+  properties:
+    id:
+      type: integer
+      format: int64
+    name:
+      type: string
+Tag:
+  type: object
+  properties:
+    id:
+      type: integer
+      format: int64
+    name:
+      type: string
+
+

Parameters Definitions Object

+

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.

+

Patterned Fields

+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
{name}Parameter ObjectA single parameter definition, mapping a “name” to the parameter it defines.
+
Parameters Definition Object Example
+

+{
+  "skipParam": {
+    "name": "skip",
+    "in": "query",
+    "description": "number of items to skip",
+    "required": true,
+    "type": "integer",
+    "format": "int32"
+  },
+  "limitParam": {
+    "name": "limit",
+    "in": "query",
+    "description": "max records to return",
+    "required": true,
+    "type": "integer",
+    "format": "int32"
+  }
+}
+
+

+skipParam:
+  name: skip
+  in: query
+  description: number of items to skip
+  required: true
+  type: integer
+  format: int32
+limitParam:
+  name: limit
+  in: query
+  description: max records to return
+  required: true
+  type: integer
+  format: int32
+
+

Responses Definitions Object

+

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.

+

Patterned Fields

+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
{name}Response ObjectA single response definition, mapping a “name” to the response it defines.
+
Responses Definitions Object Example
+

+{
+  "NotFound": {
+    "description": "Entity not found."
+  },
+  "IllegalInput": {
+  	"description": "Illegal input for operation."
+  },
+  "GeneralError": {
+  	"description": "General Error",
+  	"schema": {
+  		"$ref": "#/definitions/GeneralError"
+  	}
+  }
+}
+
+

+NotFound:
+  description: Entity not found.
+IllegalInput:
+  description: Illegal input for operation.
+GeneralError:
+  description: General Error
+  schema:
+    $ref: '#/definitions/GeneralError'
+
+

Security Definitions Object

+

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.

+

Patterned Fields

+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
{name}Security Scheme ObjectA single security scheme definition, mapping a “name” to the scheme it defines.
+
Security Definitions Object Example
+

+{
+  "api_key": {
+    "type": "apiKey",
+    "name": "api_key",
+    "in": "header"
+  },
+  "petstore_auth": {
+    "type": "oauth2",
+    "authorizationUrl": "http://swagger.io/api/oauth/dialog",
+    "flow": "implicit",
+    "scopes": {
+      "write:pets": "modify pets in your account",
+      "read:pets": "read your pets"
+    }
+  }
+}
+
+

+api_key:
+  type: apiKey
+  name: api_key
+  in: header
+petstore_auth:
+  type: oauth2
+  authorizationUrl: http://swagger.io/api/oauth/dialog
+  flow: implicit
+  scopes:
+    write:pets: modify pets in your account
+    read:pets: read your pets
+
+

Security Scheme Object

+

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

+

Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Field NameTypeValidityDescription
typestringAnyRequired. The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".
descriptionstringAnyA short description for security scheme.
namestringapiKeyRequired. The name of the header or query parameter to be used.
instringapiKeyRequired The location of the API key. Valid values are "query" or "header".
flowstringoauth2Required. The flow used by the OAuth2 security scheme. Valid values are "implicit", "password", "application" or "accessCode".
authorizationUrlstringoauth2 ("implicit", "accessCode")Required. The authorization URL to be used for this flow. This SHOULD be in the form of a URL.
tokenUrlstringoauth2 ("password", "application", "accessCode")Required. The token URL to be used for this flow. This SHOULD be in the form of a URL.
scopesScopes Objectoauth2Required. The available scopes for the OAuth2 security scheme.
+
Patterned Fields
+ + + + + + + + + + + + + + + +
Field NameTypeDescription
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+
Security Scheme Object Example
+
Basic Authentication Sample
+

+{
+  "type": "basic"
+}
+
+

+type: basic
+
+
API Key Sample
+

+{
+  "type": "apiKey",
+  "name": "api_key",
+  "in": "header"
+}
+
+

+type: apiKey
+name: api_key
+in: header
+
+
Implicit OAuth2 Sample
+

+{
+  "type": "oauth2",
+  "authorizationUrl": "http://swagger.io/api/oauth/dialog",
+  "flow": "implicit",
+  "scopes": {
+    "write:pets": "modify pets in your account",
+    "read:pets": "read your pets"
+  }
+}
+
+

+type: oauth2
+authorizationUrl: http://swagger.io/api/oauth/dialog
+flow: implicit
+scopes:
+  write:pets: modify pets in your account
+  read:pets: read your pets
+
+

Scopes Object

+

Lists the available scopes for an OAuth2 security scheme.

+

Patterned Fields

+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
{name}stringMaps between a name of a scope to a short description of it (as the value of the property).
+
Patterned Objects
+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
+
Scopes Object Example
+

+{
+  "write:pets": "modify pets in your account",
+  "read:pets": "read your pets"
+}
+
+

+write:pets: modify pets in your account
+read:pets: read your pets
+
+

Security Requirement Object

+

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.

+

Patterned Fields

+ + + + + + + + + + + + + + + +
Field PatternTypeDescription
{name}[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.
+
Security Requirement Object Examples
+
Non-OAuth2 Security Requirement
+

+{
+  "api_key": []
+}
+
+

+api_key: []
+
+
OAuth2 Security Requirement
+

+{
+  "petstore_auth": [
+    "write:pets",
+    "read:pets"
+  ]
+}
+
+

+petstore_auth:
+- write:pets
+- read:pets
+
+

Specification Extensions

+

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

+

Security Filtering

+

Some objects in the Swagger specification may be declared and remain empty, or completely be removed, even though they are inherently the core of the API documentation.

+

The reasoning behind it is to allow an additional layer of access control over the documentation itself. While not part of the specification itself, certain libraries may choose to allow access to parts of the documentation based on some form of authentication/authorization.

+

Two examples for this:

+
    +
  1. The Paths Object may be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication.
  2. +
  3. The Path Item Object may be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object so the user will not be aware of its existence. This allows the documentation provider a finer control over what the viewer can see.
  4. +
+ diff --git a/bikeshed/v2/oas_2.0.err b/bikeshed/v2/oas_2.0.err new file mode 100644 index 0000000000..a0e2887089 --- /dev/null +++ b/bikeshed/v2/oas_2.0.err @@ -0,0 +1,535 @@ +Error running preprocessor, returned code: 1. +\033[1;96mWARNING:\033[0m You should manually provide IDs for your headings: + <h3 class="heading" data-level="5.2" id="file-structure"><span class="content">File Structure</span></h3> + <h5 class="heading" data-level="5.4.48.1" id="patterned-fields"><span class="content">Patterned Fields</span></h5> + <h5 class="heading" data-level="5.4.34.2" id="relative-schema-file-example"><span class="content">Relative Schema File Example</span></h5> + <h5 class="heading" data-level="5.4.30.1" id="header-object-example"><span class="content">Header Object Example</span></h5> + <h6 class="heading" data-level="5.4.18.2.1" id="body-parameters"><span class="content">Body Parameters</span></h6> + <h4 class="heading" data-level="5.4.12" id="fixed-fields"><span class="content">Fixed Fields</span></h4> + <h5 class="heading" data-level="5.4.24.1" id="patterned-objects"><span class="content">Patterned Objects</span></h5> + <h6 class="heading" data-level="5.4.48.2.2" id="api-key-sample"><span class="content">API Key Sample</span></h6> + <h4 class="heading" data-level="5.4.21" id="responses-object"><span class="content"><a id="responsesObject">Responses Object</a></span></h4> + <h5 class="heading" data-level="5.4.12.1" id="patterned-fields"><span class="content">Patterned Fields</span></h5> + <h5 class="heading" data-level="5.4.8.1" id="patterned-objects"><span class="content">Patterned Objects</span></h5> + <h6 class="heading" data-level="5.4.36.1.2" id="xml-modeling"><span class="content">XML Modeling</span></h6> + <h5 class="heading" data-level="5.4.26.1" id="headers-object-example"><span class="content">Headers Object Example</span></h5> + <h5 class="heading" data-level="5.4.46.1" id="security-definitions-object-example"><span class="content">Security Definitions Object Example</span></h5> + <h4 class="heading" data-level="5.4.51" id="security-requirement-object"><span class="content"><a id="securityRequirementObject">Security Requirement Object</a></span></h4> + <h4 class="heading" data-level="5.4.31" id="tag-object"><span class="content"><a id="tagObject">Tag Object</a></span></h4> + <h4 class="heading" data-level="5.4.42" id="patterned-fields"><span class="content">Patterned Fields</span></h4> + <h4 class="heading" data-level="5.4.49" id="scopes-object"><span class="content"><a id="scopesObject">Scopes Object</a></span></h4> + <h4 class="heading" data-level="5.4.48" id="fixed-fields"><span class="content">Fixed Fields</span></h4> + <h5 class="heading" data-level="5.4.36.2" id="schema-object-examples"><span class="content">Schema Object Examples</span></h5> + <h5 class="heading" data-level="5.4.34.3" id="relative-files-with-embedded-schema-example"><span class="content">Relative Files With Embedded Schema Example</span></h5> + <h5 class="heading" data-level="5.4.18.2" id="parameter-object-examples"><span class="content">Parameter Object Examples</span></h5> + <h4 class="heading" data-level="5.4.5" id="contact-object"><span class="content"><a id="contactObject">Contact Object</a></span></h4> + <h4 class="heading" data-level="5.4.36" id="fixed-fields"><span class="content">Fixed Fields</span></h4> + <h6 class="heading" data-level="5.4.36.2.1" id="primitive-sample"><span class="content">Primitive Sample</span></h6> + <h5 class="heading" data-level="5.4.50.2" id="scopes-object-example"><span class="content">Scopes Object Example</span></h5> + <h4 class="heading" data-level="5.4.17" id="parameter-object"><span class="content"><a id="parameterObject">Parameter Object</a></span></h4> + <h3 class="heading" data-level="5.5" id="specification-extensions"><span class="content"><a id="vendorExtensions">Specification Extensions</a></span></h3> + <h4 class="heading" data-level="5.4.52" id="patterned-fields"><span class="content">Patterned Fields</span></h4> + <h4 class="heading" data-level="5.4.23" id="response-object"><span class="content"><a id="responseObject">Response Object</a></span></h4> + <h2 class="heading" data-level="1" id="-fka-swagger-restful-api-documentation-specification"><span class="content">(fka Swagger RESTful API Documentation Specification)</span></h2> + <h4 class="heading" data-level="5.4.37" id="xml-object"><span class="content"><a id="xmlObject">XML Object</a></span></h4> + <h4 class="heading" data-level="5.4.32" id="fixed-fields"><span class="content">Fixed Fields</span></h4> + <h5 class="heading" data-level="5.4.8.2" id="license-object-example"><span class="content">License Object Example:</span></h5> + <h3 class="heading" data-level="1.1" id="version-20"><span class="content">Version 2.0</span></h3> + <h5 class="heading" data-level="5.4.22.2" id="responses-object-example"><span class="content">Responses Object Example</span></h5> + <h5 class="heading" data-level="5.4.20.2" id="items-object-examples"><span class="content">Items Object Examples</span></h5> + <h4 class="heading" data-level="5.4.24" id="fixed-fields"><span class="content">Fixed Fields</span></h4> + <h4 class="heading" data-level="5.4.18" id="fixed-fields"><span class="content">Fixed Fields</span></h4> + <h6 class="heading" data-level="5.4.38.2.2" id="xml-name-replacement"><span class="content">XML Name Replacement</span></h6> + <h4 class="heading" data-level="5.4.39" id="definitions-object"><span class="content"><a id="definitionsObject">Definitions Object</a></span></h4> + <h4 class="heading" data-level="5.4.40" id="patterned-fields"><span class="content">Patterned Fields</span></h4> + <h4 class="heading" data-level="5.4.15" id="external-documentation-object"><span class="content"><a id="externalDocumentationObject">External Documentation Object</a></span></h4> + <h4 class="heading" data-level="5.4.35" id="schema-object"><span class="content"><a id="schemaObject">Schema Object</a></span></h4> + <h5 class="heading" data-level="5.4.32.1" id="patterned-fields"><span class="content">Patterned Fields</span></h5> + <h5 class="heading" data-level="5.4.16.1" id="patterned-objects"><span class="content">Patterned Objects</span></h5> + <h4 class="heading" data-level="5.4.46" id="patterned-fields"><span class="content">Patterned Fields</span></h4> + <h2 class="heading" data-level="2" id="introductions"><span class="content">Introductions</span></h2> + <h5 class="heading" data-level="5.4.12.2" id="path-item-object-example"><span class="content">Path Item Object Example</span></h5> + <h4 class="heading" data-level="5.4.16" id="fixed-fields"><span class="content">Fixed Fields</span></h4> + <h4 class="heading" data-level="5.4.34" id="fixed-fields"><span class="content">Fixed Fields</span></h4> + <h4 class="heading" data-level="5.4.27" id="example-object"><span class="content"><a id="exampleObject">Example Object</a></span></h4> + <h5 class="heading" data-level="5.4.24.2" id="response-object-examples"><span class="content">Response Object Examples</span></h5> + <h5 class="heading" data-level="5.4.50.1" id="patterned-objects"><span class="content">Patterned Objects</span></h5> + <h2 class="heading" data-level="3" id="revision-history"><span class="content">Revision History</span></h2> + <h6 class="heading" data-level="5.4.48.2.3" id="implicit-oauth2-sample"><span class="content">Implicit OAuth2 Sample</span></h6> + <h4 class="heading" data-level="5.4.30" id="patterned-objects"><span class="content">Patterned Objects</span></h4> + <h6 class="heading" data-level="5.4.52.1.2" id="oauth2-security-requirement"><span class="content">OAuth2 Security Requirement</span></h6> + <h4 class="heading" data-level="5.4.11" id="path-item-object"><span class="content"><a id="pathItemObject">Path Item Object</a></span></h4> + <h5 class="heading" data-level="5.4.32.2" id="tag-object-example"><span class="content">Tag Object Example</span></h5> + <h6 class="heading" data-level="5.4.38.2.4" id="xml-arrays"><span class="content">XML Arrays</span></h6> + <h4 class="heading" data-level="5.4.28" id="patterned-fields"><span class="content">Patterned Fields</span></h4> + <h3 class="heading" data-level="5.4" id="schema"><span class="content">Schema</span></h3> + <h5 class="heading" data-level="5.4.16.2" id="external-documentation-object-example"><span class="content">External Documentation Object Example</span></h5> + <h5 class="heading" data-level="5.4.2.1" id="patterned-objects"><span class="content">Patterned Objects</span></h5> + <h2 class="heading" data-level="5" id="specification"><span class="content">Specification</span></h2> + <h6 class="heading" data-level="5.4.36.2.2" id="simple-model"><span class="content">Simple Model</span></h6> + <h3 class="heading" data-level="5.1" id="format"><span class="content">Format</span></h3> + <h4 class="heading" data-level="5.4.13" id="operation-object"><span class="content"><a id="operationObject">Operation Object</a></span></h4> + <h4 class="heading" data-level="5.4.2" id="fixed-fields"><span class="content">Fixed Fields</span></h4> + <h5 class="heading" data-level="5.4.40.1" id="definitions-object-example"><span class="content">Definitions Object Example</span></h5> + <h4 class="heading" data-level="5.4.14" id="fixed-fields"><span class="content">Fixed Fields</span></h4> + <h5 class="heading" data-level="5.4.52.1" id="security-requirement-object-examples"><span class="content">Security Requirement Object Examples</span></h5> + <h5 class="heading" data-level="5.4.4.1" id="patterned-objects"><span class="content">Patterned Objects</span></h5> + <h4 class="heading" data-level="5.4.6" id="fixed-fields"><span class="content">Fixed Fields</span></h4> + <h5 class="heading" data-level="5.4.36.1" id="patterned-objects"><span class="content">Patterned Objects</span></h5> + <h6 class="heading" data-level="5.4.52.1.1" id="non-oauth2-security-requirement"><span class="content">Non-OAuth2 Security Requirement</span></h6> + <h4 class="heading" data-level="5.4.41" id="parameters-definitions-object"><span class="content"><a id="parametersDefinitionsObject">Parameters Definitions Object</a></span></h4> + <h5 class="heading" data-level="5.4.18.1" id="patterned-fields"><span class="content">Patterned Fields</span></h5> + <h4 class="heading" data-level="5.4.9" id="paths-object"><span class="content"><a id="pathsObject">Paths Object</a></span></h4> + <h5 class="heading" data-level="5.4.10.1" id="paths-object-example"><span class="content">Paths Object Example</span></h5> + <h4 class="heading" data-level="5.4.50" id="patterned-fields"><span class="content">Patterned Fields</span></h4> + <h6 class="heading" data-level="5.4.36.2.6" id="models-with-polymorphism-support"><span class="content">Models with Polymorphism Support</span></h6> + <h6 class="heading" data-level="5.4.38.2.3" id="xml-attribute-prefix-and-namespace"><span class="content">XML Attribute, Prefix and Namespace</span></h6> + <h4 class="heading" data-level="5.4.22" id="fixed-fields"><span class="content">Fixed Fields</span></h4> + <h6 class="heading" data-level="5.4.18.2.2" id="other-parameters"><span class="content">Other Parameters</span></h6> + <h4 class="heading" data-level="5.4.26" id="patterned-fields"><span class="content">Patterned Fields</span></h4> + <h5 class="heading" data-level="5.4.6.1" id="patterned-objects"><span class="content">Patterned Objects</span></h5> + <h5 class="heading" data-level="5.4.44.1" id="responses-definitions-object-example"><span class="content">Responses Definitions Object Example</span></h5> + <h4 class="heading" data-level="5.4.10" id="patterned-fields"><span class="content">Patterned Fields</span></h4> + <h4 class="heading" data-level="5.4.7" id="license-object"><span class="content"><a id="licenseObject">License Object</a></span></h4> + <h5 class="heading" data-level="5.4.14.1" id="patterned-objects"><span class="content">Patterned Objects</span></h5> + <h4 class="heading" data-level="5.4.43" id="responses-definitions-object"><span class="content"><a id="responsesDefinitionsObject">Responses Definitions Object</a></span></h4> + <h5 class="heading" data-level="5.4.38.2" id="xml-object-examples"><span class="content">XML Object Examples</span></h5> + <h5 class="heading" data-level="5.4.28.1" id="example-object-example"><span class="content">Example Object Example</span></h5> + <h4 class="heading" data-level="5.4.3" id="info-object"><span class="content"><a id="infoObject">Info Object</a></span></h4> + <h3 class="heading" data-level="5.3" id="data-types"><span class="content">Data Types</span></h3> + <h4 class="heading" data-level="5.4.8" id="fixed-fields"><span class="content">Fixed Fields</span></h4> + <h4 class="heading" data-level="5.4.45" id="security-definitions-object"><span class="content"><a id="securityDefinitionsObject">Security Definitions Object</a></span></h4> + <h2 class="heading" data-level="4" id="definitions"><span class="content">Definitions</span></h2> + <h4 class="heading" data-level="5.4.1" id="swagger-object"><span class="content"><a id="swaggerObject">Swagger Object</a></span></h4> + <h6 class="heading" data-level="5.4.38.2.1" id="no-xml-element"><span class="content">No XML Element</span></h6> + <h3 class="heading" data-level="4.1" id="path-templating"><span class="content"><a id="pathTemplating"><dfn>Path Templating</dfn></a></span></h3> + <h4 class="heading" data-level="5.4.4" id="fixed-fields"><span class="content">Fixed Fields</span></h4> + <h6 class="heading" data-level="5.4.36.2.3" id="model-with-map-dictionary-properties"><span class="content">Model with Map/Dictionary Properties</span></h6> + <h4 class="heading" data-level="5.4.29" id="header-object"><span class="content"><a id="headerObject">Header Object</a></span></h4> + <h4 class="heading" data-level="5.4.44" id="patterned-fields"><span class="content">Patterned Fields</span></h4> + <h5 class="heading" data-level="5.4.4.2" id="info-object-example"><span class="content">Info Object Example:</span></h5> + <h4 class="heading" data-level="5.4.47" id="security-scheme-object"><span class="content"><a id="securitySchemeObject">Security Scheme Object</a></span></h4> + <h3 class="heading" data-level="4.2" id="mime-types"><span class="content"><a id="mimeTypes"><dfn>Mime Types</dfn></a></span></h3> + <h5 class="heading" data-level="5.4.34.1" id="reference-object-example"><span class="content">Reference Object Example</span></h5> + <h4 class="heading" data-level="5.4.25" id="headers-object"><span class="content"><a id="headersObject">Headers Object</a></span></h4> + <h5 class="heading" data-level="5.4.48.2" id="security-scheme-object-example"><span class="content">Security Scheme Object Example</span></h5> + <h4 class="heading" data-level="5.4.19" id="items-object"><span class="content"><a id="itemsObject">Items Object</a></span></h4> + <h5 class="heading" data-level="5.4.38.1" id="patterned-objects"><span class="content">Patterned Objects</span></h5> + <h6 class="heading" data-level="5.4.48.2.1" id="basic-authentication-sample"><span class="content">Basic Authentication Sample</span></h6> + <h6 class="heading" data-level="5.4.36.1.1" id="composition-and-inheritance-polymorphism"><span class="content">Composition and Inheritance (Polymorphism)</span></h6> + <h6 class="heading" data-level="5.4.36.2.4" id="model-with-example"><span class="content">Model with Example</span></h6> + <h4 class="heading" data-level="5.4.33" id="reference-object"><span class="content"><a id="referenceObject">Reference Object</a></span></h4> + <h6 class="heading" data-level="5.4.36.2.5" id="models-with-composition"><span class="content">Models with Composition</span></h6> + <h5 class="heading" data-level="5.4.6.2" id="contact-object-example"><span class="content">Contact Object Example:</span></h5> + <h3 class="heading" data-level="5.6" id="security-filtering"><span class="content"><a id="securityFiltering">Security Filtering</a></span></h3> + <h3 class="heading" data-level="4.3" id="http-status-codes"><span class="content"><a id="httpCodes"><dfn>HTTP Status Codes</dfn></a></span></h3> + <h5 class="heading" data-level="5.4.20.1" id="patterned-objects"><span class="content">Patterned Objects</span></h5> + <h5 class="heading" data-level="5.4.22.1" id="patterned-fields"><span class="content">Patterned Fields</span></h5> + <h5 class="heading" data-level="5.4.42.1" id="parameters-definition-object-example"><span class="content">Parameters Definition Object Example</span></h5> + <h5 class="heading" data-level="5.4.14.2" id="operation-object-example"><span class="content">Operation Object Example</span></h5> + <h4 class="heading" data-level="5.4.38" id="fixed-fields"><span class="content">Fixed Fields</span></h4> + <h4 class="heading" data-level="5.4.20" id="fixed-fields"><span class="content">Fixed Fields</span></h4> +\033[1;96mWARNING:\033[0m Multiple elements have the same ID 'patterned-objects'. +Deduping, but this ID may not be stable across revisions. +\033[1;96mWARNING:\033[0m Multiple elements have the same ID 'patterned-fields'. +Deduping, but this ID may not be stable across revisions. +\033[1;96mWARNING:\033[0m Multiple elements have the same ID 'itemsMaximum'. +Deduping, but this ID may not be stable across revisions. +\033[1;96mWARNING:\033[0m Multiple elements have the same ID 'headerMaximum'. +Deduping, but this ID may not be stable across revisions. +\033[1;96mWARNING:\033[0m Multiple elements have the same ID 'fixed-fields'. +Deduping, but this ID may not be stable across revisions. +\033[1;96mWARNING:\033[0m Multiple elements have the same ID 'path-templating'. +Deduping, but this ID may not be stable across revisions. +\033[1;96mWARNING:\033[0m Multiple elements have the same ID 'http-status-codes'. +Deduping, but this ID may not be stable across revisions. +\033[1;96mWARNING:\033[0m Multiple elements have the same ID 'mime-types'. +Deduping, but this ID may not be stable across revisions. +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="dataTypeFormat" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'swagger object'. +<a id="swaggerObject" data-link-type="dfn" data-lt="Swagger Object">Swagger Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="swaggerSwagger" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="swaggerInfo" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="swaggerHost" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="swaggerBasePath" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="swaggerSchemes" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="swaggerConsumes" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="swaggerProduces" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="swaggerPaths" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="swaggerDefinitions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="swaggerParameters" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="swaggerResponses" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="swaggerSecurityDefinitions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="swaggerSecurity" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="swaggerTags" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="swaggerExternalDocs" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="swaggerExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'info object'. +<a id="infoObject" data-link-type="dfn" data-lt="Info Object">Info Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="infoTitle" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="infoDescription" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="infoTermsOfService" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="infoContact" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="infoLicense" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="infoVersion" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="infoExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'contact object'. +<a id="contactObject" data-link-type="dfn" data-lt="Contact Object">Contact Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="contactName" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="contactUrl" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="contactEmail" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="contactExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'license object'. +<a id="licenseObject" data-link-type="dfn" data-lt="License Object">License Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="licenseName" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="licenseUrl" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="licenseExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'paths object'. +<a id="pathsObject" data-link-type="dfn" data-lt="Paths Object">Paths Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="pathsPath" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="pathsExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'path item object'. +<a id="pathItemObject" data-link-type="dfn" data-lt="Path Item Object">Path Item Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="pathItemRef" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="pathItemGet" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="pathItemPut" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="pathItemPost" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="pathItemDelete" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="pathItemOptions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="pathItemHead" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="pathItemPatch" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="pathItemParameters" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="pathItemExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'operation object'. +<a id="operationObject" data-link-type="dfn" data-lt="Operation Object">Operation Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="operationTags" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="operationSummary" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="operationDescription" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="operationExternalDocs" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="operationId" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="operationConsumes" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="operationProduces" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="operationParameters" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="operationResponses" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="operationSchemes" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="operationDeprecated" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="operationSecurity" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="operationExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'external documentation object'. +<a id="externalDocumentationObject" data-link-type="dfn" data-lt="External Documentation Object">External Documentation Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="externalDocDescription" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="externalDocUrl" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="externalDocExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'parameter object'. +<a id="parameterObject" data-link-type="dfn" data-lt="Parameter Object">Parameter Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterName" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterIn" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterDescription" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterRequired" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterSchema" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterType" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterFormat" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'allowemptyvalue'. +<a name="parameterAllowEmptyValue" data-link-type="dfn" data-lt="allowEmptyValue">allowEmptyValue</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterItems" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterCollectionFormat" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterDefault" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterMaximum" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterExclusiveMaximum" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterMinimum" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterExclusiveMinimum" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterMaxLength" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterMinLength" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterPattern" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterMaxItems" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterMinItems" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterUniqueItems" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterEnum" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterMultipleOf" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="parameterExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'items object'. +<a id="itemsObject" data-link-type="dfn" data-lt="Items Object">Items Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsType" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsFormat" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsItems" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsCollectionFormat" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsDefault" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsMaximum" data-link-type="dfn" data-lt=" "> </a> +\033[1;96mWARNING:\033[0m Your console does not understand Unicode. + Messages may be slightly corrupted. +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsMaximum①" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsMinimum" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsExclusiveMinimum" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsMaxLength" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsMinLength" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsPattern" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsMaxItems" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsMinItems" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsUniqueItems" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsEnum" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsMultipleOf" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="itemsExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'responses object'. +<a id="responsesObject" data-link-type="dfn" data-lt="Responses Object">Responses Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="responsesDefault" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="responsesCode" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="responsesExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'response object' that are marked for export. +<a id="responseObject" data-link-type="dfn" data-lt="Response Object">Response Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="responseDescription" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="responseSchema" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="responseHeaders" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="responseExamples" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="responseExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'headers object'. +<a id="headersObject" data-link-type="dfn" data-lt="Headers Object">Headers Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headersName" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'example object'. +<a id="exampleObject" data-link-type="dfn" data-lt="Example Object">Example Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="exampleMimeType" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'header object'. +<a id="headerObject" data-link-type="dfn" data-lt="Header Object">Header Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerDescription" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerType" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerFormat" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerItems" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerCollectionFormat" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerDefault" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerMaximum" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerMaximum①" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerMinimum" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerExclusiveMinimum" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerMaxLength" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerMinLength" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerPattern" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerMaxItems" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerMinItems" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerUniqueItems" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerEnum" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerMultipleOf" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="headerExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'tag object'. +<a id="tagObject" data-link-type="dfn" data-lt="Tag Object">Tag Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="tagName" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="tagDescription" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="tagExternalDocs" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="tagExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'reference object'. +<a id="referenceObject" data-link-type="dfn" data-lt="Reference Object">Reference Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="referenceRef" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'schema object'. +<a id="schemaObject" data-link-type="dfn" data-lt="Schema Object">Schema Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="schemaDiscriminator" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="schemaReadOnly" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="schemaXml" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="schemaExternalDocs" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="schemaExample" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="schemaExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'xml object'. +<a id="xmlObject" data-link-type="dfn" data-lt="XML Object">XML Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="xmlName" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="xmlNamespace" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="xmlPrefix" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="xmlAttribute" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="xmlWrapped" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="xmlExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'definitions object'. +<a id="definitionsObject" data-link-type="dfn" data-lt="Definitions Object">Definitions Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="definitionsName" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'parameters definitions object'. +<a id="parametersDefinitionsObject" data-link-type="dfn" data-lt="Parameters Definitions Object">Parameters Definitions Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="pdName" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'responses definitions object'. +<a id="responsesDefinitionsObject" data-link-type="dfn" data-lt="Responses Definitions Object">Responses Definitions Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="rdName" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'security definitions object'. +<a id="securityDefinitionsObject" data-link-type="dfn" data-lt="Security Definitions Object">Security Definitions Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="sdName" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'security scheme object'. +<a id="securitySchemeObject" data-link-type="dfn" data-lt="Security Scheme Object">Security Scheme Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="securitySchemeType" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="securitySchemeDescription" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="securitySchemeName" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="securitySchemeIn" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="securitySchemeFlow" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="securitySchemeAuthorizationUrl" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="securitySchemeTokenUrl" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="securitySchemeScopes" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="securitySchemeExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'scopes object'. +<a id="scopesObject" data-link-type="dfn" data-lt="Scopes Object">Scopes Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="scopesName" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="scopesExtensions" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'security requirement object'. +<a id="securityRequirementObject" data-link-type="dfn" data-lt="Security Requirement Object">Security Requirement Object</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. +<a id="securityRequirementsName" data-link-type="dfn" data-lt=" "> </a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'specification extensions'. +<a id="vendorExtensions" data-link-type="dfn" data-lt="Specification Extensions">Specification Extensions</a> +\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'security filtering'. +<a id="securityFiltering" data-link-type="dfn" data-lt="Security Filtering">Security Filtering</a> +\033[1;96mWARNING:\033[0m This specification has neither a 'Security Considerations' nor a 'Privacy Considerations' section. Please consider adding both, see https://w3ctag.github.io/security-questionnaire/. +\033[1;31mFATAL ERROR:\033[0m Couldn't find target anchor dataTypeType: +<a href="#dataTypeType"><code>type</code></a> +\033[7;31m ✘ \033[0m Did not generate, due to fatal errors \ No newline at end of file diff --git a/bikeshed/v2/oas_2.0.html b/bikeshed/v2/oas_2.0.html new file mode 100644 index 0000000000..77bcfa4aef --- /dev/null +++ b/bikeshed/v2/oas_2.0.html @@ -0,0 +1,4565 @@ + + + + + + OpenAPI Specification + + + + + + + + + + + + + +
+
+

+

OpenAPI Specification

+

Final Community Group Report,

+
+
+
+
This version: +
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md +
Issue Tracking: +
GitHub +
Editors: +
Darrel Miller +
Jason Harmon +
Jeremy Whitlock +
Marsh Gardiner +
Ron Ratovsky +
Tony Tam +
+
+
+ +
+
+
+

Abstract

+

The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

+
+

Status of this document

+
+

+
+
+ +
+ + + +

Open API Initiative logo

+

1. (fka Swagger RESTful API Documentation Specification)

+

1.1. Version 2.0

+

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [!rfc2119].

+

The Swagger specification is licensed under The Apache License, Version 2.0.

+

2. Introductions

+

Swagger™ is a project used to describe and document RESTful APIs.

+

The Swagger specification defines a set of files required to describe such an API. These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various languages. Additional utilities can also take advantage of the resulting files, such as testing tools.

+

3. Revision History

+ + + + + + + + +
Version + Date + Notes +
2.0 + 2014-09-08 + Release of Swagger 2.0 +
1.2 + 2014-03-14 + Initial release of the formal document. +
1.1 + 2012-08-22 + Release of Swagger 1.1 +
1.0 + 2011-08-10 + First release of the Swagger Specification +
+

4. Definitions

+

4.1. Path Templating

+ Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. +

4.2. Mime Types

+ Mime type definitions are spread across several resources. The mime type definitions should be in compliance with [rfc6838]. +

Some examples of possible mime type definitions:

+
text/plain; charset=utf-8
+application/json
+application/vnd.github+json
+application/vnd.github.v3+json
+application/vnd.github.v3.raw+json
+application/vnd.github.v3.text+json
+application/vnd.github.v3.html+json
+application/vnd.github.v3.full+json
+application/vnd.github.v3.diff
+application/vnd.github.v3.patch
+
+

4.3. HTTP Status Codes

+ The HTTP Status Codes are used to indicate the status of the executed operation. The available status codes are described by [rfc7231]section-6) and in the IANA Status Code Registry. +

5. Specification

+

5.1. Format

+

The files describing the RESTful API in accordance with the Swagger specification are represented as JSON objects and conform to the JSON standards. YAML, being a superset of JSON, can be used as well to +represent a Swagger specification file.

+

For example, if a field is said to have an array value, the JSON array representation will be used:

+
{
+   "field" : [...]
+}
+
+

While the API is described using JSON it does not impose a JSON input/output to the API itself.

+

All field names in the specification are case sensitive.

+

The schema exposes two types of fields. Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. Patterned fields can have multiple occurrences as long as each has a unique name.

+

5.2. File Structure

+

The Swagger representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for $ref fields in the specification as follows from the JSON Schema definitions.

+

By convention, the Swagger specification file is named swagger.json.

+

5.3. Data Types

+

Primitive data types in the Swagger Specification are based on the types supported by the JSON-Schema Draft 4. Models are described using the Schema Object which is a subset of JSON Schema Draft 4.

+

An additional primitive data type "file" is used by the Parameter Object and the Response Object to set the parameter type or the response as being a file.

+

Primitives have an optional modifier property format. Swagger uses several known formats to more finely define the data type being used. However, the format property is an open string-valued property, and can have any value to support documentation needs. Formats such as "email", "uuid", etc., can be used even though they are not defined by this specification. Types that are not accompanied by a format property follow their definition from the JSON Schema (except for file type which is defined above). The formats defined by the Swagger Specification are:

+ + + + + + + + + + + + + + + +
Common Name + type + format + Comments +
integer + integer + int32 + signed 32 bits +
long + integer + int64 + signed 64 bits +
float + number + float + +
double + number + double + +
string + string + + +
byte + string + byte + base64 encoded characters +
binary + string + binary + any sequence of octets +
boolean + boolean + + +
date + string + date + As defined by full-date - [!rfc3339] +
dateTime + string + date-time + As defined by date-time - [!rfc3339] +
password + string + password + Used to hint UIs the input needs to be obscured. +
+

5.4. Schema

+

5.4.1. Swagger Object

+

This is the root document object for the API specification. It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document.

+

5.4.2. Fixed Fields

+ + + + + + + + + + + + + + + + + + + +
Field Name + Type + Description +
swagger + string + Required. 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". +
info + Info Object + Required. Provides metadata about the API. The metadata can be used by the clients if needed. +
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. +
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. +
schemes + [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. +
consumes + [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. +
produces + [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. +
paths + Paths Object + Required. The available paths and operations for the API. +
definitions + Definitions Object + An object to hold data types produced and consumed by operations. +
parameters + Parameters Definitions Object + An object to hold parameters that can be used across operations. This property does not define global parameters for all operations. +
responses + Responses Definitions Object + An object to hold responses that can be used across operations. This property does not define global responses for all operations. +
securityDefinitions + Security Definitions Object + Security scheme definitions that can be used across the specification. +
security + [Security Requirement Object] + 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. +
tags + [Tag Object] + 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. +
externalDocs + External Documentation Object + Additional external documentation. +
+
5.4.2.1. Patterned Objects
+ + + + + +
Field Pattern + Type + Description +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+

5.4.3. Info Object

+

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.

+

5.4.4. Fixed Fields

+ + + + + + + + + + +
Field Name + Type + Description +
title + string + Required. The title of the application. +
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. +
contact + Contact Object + The contact information for the exposed API. +
license + License Object + The license information for the exposed API. +
version + string + Required Provides the version of the application API (not to be confused with the specification version). +
+
5.4.4.1. Patterned Objects
+ + + + + +
Field Pattern + Type + Description +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+
5.4.4.2. Info Object Example:
+
{
+  "title": "Swagger Sample App",
+  "description": "This is a sample server Petstore server.",
+  "termsOfService": "http://swagger.io/terms/",
+  "contact": {
+    "name": "API Support",
+    "url": "http://www.swagger.io/support",
+    "email": "support@swagger.io"
+  },
+  "license": {
+    "name": "Apache 2.0",
+    "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
+  },
+  "version": "1.0.1"
+}
+
+
title: Swagger Sample App
+description: This is a sample server Petstore server.
+termsOfService: http://swagger.io/terms/
+contact:
+  name: API Support
+  url: http://www.swagger.io/support
+  email: support@swagger.io
+license:
+  name: Apache 2.0
+  url: http://www.apache.org/licenses/LICENSE-2.0.html
+version: 1.0.1
+
+

5.4.5. Contact Object

+

Contact information for the exposed API.

+

5.4.6. Fixed Fields

+ + + + + + + +
Field Name + Type + Description +
name + string + The identifying name of the contact person/organization. +
url + string + The URL pointing to the contact information. MUST be in the format of a URL. +
email + string + The email address of the contact person/organization. MUST be in the format of an email address. +
+
5.4.6.1. Patterned Objects
+ + + + + +
Field Pattern + Type + Description +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+
5.4.6.2. Contact Object Example:
+
{
+  "name": "API Support",
+  "url": "http://www.swagger.io/support",
+  "email": "support@swagger.io"
+}
+
+
name: API Support
+url: http://www.swagger.io/support
+email: support@swagger.io
+
+

5.4.7. License Object

+

License information for the exposed API.

+

5.4.8. Fixed Fields

+ + + + + + +
Field Name + Type + Description +
name + string + Required. The license name used for the API. +
url + string + A URL to the license used for the API. MUST be in the format of a URL. +
+
5.4.8.1. Patterned Objects
+ + + + + +
Field Pattern + Type + Description +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+
5.4.8.2. License Object Example:
+
{
+  "name": "Apache 2.0",
+  "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
+}
+
+
name: Apache 2.0
+url: http://www.apache.org/licenses/LICENSE-2.0.html
+
+

5.4.9. Paths Object

+

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.

+

5.4.10. Patterned Fields

+ + + + + + +
Field Pattern + Type + Description +
/{path} + Path Item Object + A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended to the basePath in order to construct the full URL. Path templating is allowed. +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+
5.4.10.1. Paths Object Example
+
{
+  "/pets": {
+    "get": {
+      "description": "Returns all pets from the system that the user has access to",
+      "produces": [
+        "application/json"
+      ],
+      "responses": {
+        "200": {
+          "description": "A list of pets.",
+          "schema": {
+            "type": "array",
+            "items": {
+              "$ref": "#/definitions/pet"
+            }
+          }
+        }
+      }
+    }
+  }
+}
+
+
/pets:
+  get:
+    description: Returns all pets from the system that the user has access to
+    produces:
+    - application/json
+    responses:
+      '200':
+        description: A list of pets.
+        schema:
+          type: array
+          items:
+            $ref: '#/definitions/pet'
+
+

5.4.11. Path Item Object

+

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.

+

5.4.12. Fixed Fields

+ + + + + + + + + + + + + +
Field Name + Type + Description +
$ref + string + 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. +
get + Operation Object + A definition of a GET operation on this path. +
put + Operation Object + A definition of a PUT operation on this path. +
post + Operation Object + A definition of a POST operation on this path. +
delete + Operation Object + A definition of a DELETE operation on this path. +
options + Operation Object + A definition of a OPTIONS operation on this path. +
head + Operation Object + A definition of a HEAD operation on this path. +
patch + Operation Object + A definition of a PATCH operation on this path. +
parameters + [Parameter Object | Reference Object] + 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. +
+
5.4.12.1. Patterned Fields
+ + + + + +
Field Pattern + Type + Description +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+
5.4.12.2. Path Item Object Example
+
{
+  "get": {
+    "description": "Returns pets based on ID",
+    "summary": "Find pets by ID",
+    "operationId": "getPetsById",
+    "produces": [
+      "application/json",
+      "text/html"
+    ],
+    "responses": {
+      "200": {
+        "description": "pet response",
+        "schema": {
+          "type": "array",
+          "items": {
+            "$ref": "#/definitions/Pet"
+          }
+        }
+      },
+      "default": {
+        "description": "error payload",
+        "schema": {
+          "$ref": "#/definitions/ErrorModel"
+        }
+      }
+    }
+  },
+  "parameters": [
+    {
+      "name": "id",
+      "in": "path",
+      "description": "ID of pet to use",
+      "required": true,
+      "type": "array",
+      "items": {
+        "type": "string"
+      },
+      "collectionFormat": "csv"
+    }
+  ]
+}
+
+
get:
+  description: Returns pets based on ID
+  summary: Find pets by ID
+  operationId: getPetsById
+  produces:
+  - application/json
+  - text/html
+  responses:
+    '200':
+      description: pet response
+      schema:
+        type: array
+        items:
+          $ref: '#/definitions/Pet'
+    default:
+      description: error payload
+      schema:
+        $ref: '#/definitions/ErrorModel'
+parameters:
+- name: id
+  in: path
+  description: ID of pet to use
+  required: true
+  type: array
+  items:
+    type: string
+  collectionFormat: csv
+
+

5.4.13. Operation Object

+

Describes a single API operation on a path.

+

5.4.14. Fixed Fields

+ + + + + + + + + + + + + + + + +
Field Name + Type + Description +
tags + [string] + A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. +
summary + string + A short summary of what the operation does. For maximum readability in the swagger-ui, this field SHOULD be less than 120 characters. +
description + string + A verbose explanation of the operation behavior. GFM syntax can be used for rich text representation. +
externalDocs + External Documentation Object + Additional external documentation for this operation. +
operationId + string + 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. +
consumes + [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. +
produces + [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. +
parameters + [Parameter Object | Reference Object] + 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 + Responses Object + Required. The list of possible responses as they are returned from executing this operation. +
schemes + [string] + The transfer protocol for the operation. Values MUST be from the list: "http", "https", "ws", "wss". The value overrides the Swagger Object schemes definition. +
deprecated + boolean + Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is false. +
security + [Security Requirement Object] + 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. +
+
5.4.14.1. Patterned Objects
+ + + + + +
Field Pattern + Type + Description +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+
5.4.14.2. Operation Object Example
+
{
+  "tags": [
+    "pet"
+  ],
+  "summary": "Updates a pet in the store with form data",
+  "description": "",
+  "operationId": "updatePetWithForm",
+  "consumes": [
+    "application/x-www-form-urlencoded"
+  ],
+  "produces": [
+    "application/json",
+    "application/xml"
+  ],
+  "parameters": [
+    {
+      "name": "petId",
+      "in": "path",
+      "description": "ID of pet that needs to be updated",
+      "required": true,
+      "type": "string"
+    },
+    {
+      "name": "name",
+      "in": "formData",
+      "description": "Updated name of the pet",
+      "required": false,
+      "type": "string"
+    },
+    {
+      "name": "status",
+      "in": "formData",
+      "description": "Updated status of the pet",
+      "required": false,
+      "type": "string"
+    }
+  ],
+  "responses": {
+    "200": {
+      "description": "Pet updated."
+    },
+    "405": {
+      "description": "Invalid input"
+    }
+  },
+  "security": [
+    {
+      "petstore_auth": [
+        "write:pets",
+        "read:pets"
+      ]
+    }
+  ]
+}
+
+
tags:
+- pet
+summary: Updates a pet in the store with form data
+description: ""
+operationId: updatePetWithForm
+consumes:
+- application/x-www-form-urlencoded
+produces:
+- application/json
+- application/xml
+parameters:
+- name: petId
+  in: path
+  description: ID of pet that needs to be updated
+  required: true
+  type: string
+- name: name
+  in: formData
+  description: Updated name of the pet
+  required: false
+  type: string
+- name: status
+  in: formData
+  description: Updated status of the pet
+  required: false
+  type: string
+responses:
+  '200':
+    description: Pet updated.
+  '405':
+    description: Invalid input
+security:
+- petstore_auth:
+  - write:pets
+  - read:pets
+
+

5.4.15. External Documentation Object

+

Allows referencing an external resource for extended documentation.

+

5.4.16. Fixed Fields

+ + + + + + +
Field Name + Type + Description +
description + string + A short description of the target documentation. GFM syntax can be used for rich text representation. +
url + string + Required. The URL for the target documentation. Value MUST be in the format of a URL. +
+
5.4.16.1. Patterned Objects
+ + + + + +
Field Pattern + Type + Description +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+
5.4.16.2. External Documentation Object Example
+
{
+  "description": "Find more info here",
+  "url": "https://swagger.io"
+}
+
+
description: Find more info here
+url: https://swagger.io
+
+

5.4.17. Parameter Object

+

Describes a single operation parameter.

+

A unique parameter is defined by a combination of a name and location.

+

There are five possible parameter types.

+
    +
  • Path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId. +
  • Query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id. +
  • Header - Custom headers that are expected as part of the request. +
  • Body - The payload that’s appended to the HTTP request. Since there can only be one payload, there can only be one body parameter. The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation. +
  • + Form - Used to describe the payload of an HTTP request when either application/x-www-form-urlencoded, multipart/form-data or both are used as the content type of the request (in Swagger’s definition, the consumes property of an operation). This is the only parameter type that can be used to send files, thus supporting the file type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): +
      +
    • application/x-www-form-urlencoded - Similar to the format of Query parameters but as a payload. For example, foo=1&bar=swagger - both foo and bar are form parameters. This is normally used for simple parameters that are being transferred. +
    • multipart/form-data - each parameter takes a section in the payload with an internal header. For example, for the header Content-Disposition: form-data; name="submit-name" the name of the parameter is submit-name. This type of form parameters is more commonly used for file transfers. +
    +
+

5.4.18. Fixed Fields

+ + + + + + + + +
Field Name + Type + Description +
name + string + + Required. 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. +
+
in + string + Required. The location of the parameter. Possible values are “query”, “header”, “path”, “formData” or “body”. +
description + string + A brief description of the parameter. This could contain examples of use. GFM syntax can be used for rich text representation. +
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. +
+

If in is "body":

+ + + + + +
Field Name + Type + Description +
schema + Schema Object + Required. The schema defining the type used for the body parameter. +
+

If in is any value other than "body":

+ + + + + + + + + + + + + + + + + + + + + + +
Field Name + Type + Description +
type + string + Required. 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". +
format + string + The extending format for the previously mentioned type. See Data Type Formats for further details. +
allowEmptyValue + boolean + 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. +
items + Items Object + Required if type is “array”. Describes the type of items in the array. +
collectionFormat + string + + 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. +
default + * + 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. +
maximum + number + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. +
exclusiveMaximum + boolean + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. +
minimum + number + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. +
exclusiveMinimum + boolean + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. +
maxLength + integer + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1. +
minLength + integer + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2. +
pattern + string + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. +
maxItems + integer + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2. +
minItems + integer + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3. +
uniqueItems + boolean + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4. +
enum + [*] + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1. +
multipleOf + number + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1. +
+
5.4.18.1. Patterned Fields
+ + + + + +
Field Pattern + Type + Description +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+
5.4.18.2. Parameter Object Examples
+
5.4.18.2.1. Body Parameters
+

A body parameter with a referenced schema definition (normally for a model definition):

+
{
+  "name": "user",
+  "in": "body",
+  "description": "user to add to the system",
+  "required": true,
+  "schema": {
+    "$ref": "#/definitions/User"
+  }
+}
+
+
name: user
+in: body
+description: user to add to the system
+required: true
+schema:
+  $ref: '#/definitions/User'
+
+

A body parameter that is an array of string values:

+
{
+  "name": "user",
+  "in": "body",
+  "description": "user to add to the system",
+  "required": true,
+  "schema": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    }
+  }
+}
+
+
name: user
+in: body
+description: user to add to the system
+required: true
+schema:
+  type: array
+  items:
+    type: string
+
+
5.4.18.2.2. Other Parameters
+

A header parameter with an array of 64 bit integer numbers:

+
{
+  "name": "token",
+  "in": "header",
+  "description": "token to be passed as a header",
+  "required": true,
+  "type": "array",
+  "items": {
+    "type": "integer",
+    "format": "int64"
+  },
+  "collectionFormat": "csv"
+}
+
+
name: token
+in: header
+description: token to be passed as a header
+required: true
+type: array
+items:
+  type: integer
+  format: int64
+collectionFormat: csv
+
+

A path parameter of a string value:

+
{
+  "name": "username",
+  "in": "path",
+  "description": "username to fetch",
+  "required": true,
+  "type": "string"
+}
+
+
name: username
+in: path
+description: username to fetch
+required: true
+type: string
+
+

An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

+
{
+  "name": "id",
+  "in": "query",
+  "description": "ID of the object to fetch",
+  "required": false,
+  "type": "array",
+  "items": {
+    "type": "string"
+  },
+  "collectionFormat": "multi"
+}
+
+
name: id
+in: query
+description: ID of the object to fetch
+required: false
+type: array
+items:
+  type: string
+collectionFormat: multi
+
+

A form data with file type for a file upload:

+
{
+  "name": "avatar",
+  "in": "formData",
+  "description": "The avatar of the user",
+  "required": true,
+  "type": "file"
+}
+
+
name: avatar
+in: formData
+description: The avatar of the user
+required: true
+type: file
+
+

5.4.19. Items Object

+

A limited subset of JSON-Schema’s items object. It is used by parameter definitions that are not located in "body".

+

5.4.20. Fixed Fields

+ + + + + + + + + + + + + + + + + + + + + +
Field Name + Type + Description +
type + string + Required. The internal type of the array. The value MUST be one of "string", "number", "integer", "boolean", or "array". Files and models are not allowed. +
format + string + The extending format for the previously mentioned type. See Data Type Formats for further details. +
items + Items Object + Required if type is “array”. Describes the type of items in the array. +
collectionFormat + string + + 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. +
+ Default value is csv. +
default + * + Declares the value of the item that the server will use if none is provided. (Note: “default” has no meaning for required items.) 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 the data type. +
maximum + number + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. +
exclusiveMaximum + boolean + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. +
minimum + number + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. +
exclusiveMinimum + boolean + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. +
maxLength + integer + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1. +
minLength + integer + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2. +
pattern + string + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. +
maxItems + integer + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2. +
minItems + integer + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3. +
uniqueItems + boolean + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4. +
enum + [*] + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1. +
multipleOf + number + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1. +
+
5.4.20.1. Patterned Objects
+ + + + + +
Field Pattern + Type + Description +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+
5.4.20.2. Items Object Examples
+

Items must be of type string and have the minimum length of 2 characters:

+
{
+    "type": "string",
+    "minLength": 2
+}
+
+
type: string
+minLength: 2
+
+

An array of arrays, the internal array being of type integer, numbers must be between 0 and 63 (inclusive):

+
{
+    "type": "array",
+    "items": {
+        "type": "integer",
+        "minimum": 0,
+        "maximum": 63
+    }
+}
+
+
type: array
+items:
+  type: integer
+  minimum: 0
+  maximum: 63
+
+

5.4.21. Responses Object

+

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 Responses Object MUST contain at least one response code, and it SHOULD be the response for a successful operation call.

+

5.4.22. Fixed Fields

+ + + + + +
Field Name + Type + Description +
default + Response Object | Reference Object + 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. +
+
5.4.22.1. Patterned Fields
+ + + + + + +
Field Pattern + Type + Description +
{HTTP Status Code} + Response Object | Reference Object + Any HTTP status code can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. Reference Object can be used to link to a response that is defined at the Swagger Object’s responses section. +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+
5.4.22.2. Responses Object Example
+

A 200 response for successful operation and a default response for others (implying an error):

+
{
+  "200": {
+    "description": "a pet to be returned",
+    "schema": {
+      "$ref": "#/definitions/Pet"
+    }
+  },
+  "default": {
+    "description": "Unexpected error",
+    "schema": {
+      "$ref": "#/definitions/ErrorModel"
+    }
+  }
+}
+
+
'200':
+  description: a pet to be returned
+  schema:
+    $ref: '#/definitions/Pet'
+default:
+  description: Unexpected error
+  schema:
+    $ref: '#/definitions/ErrorModel'
+
+

5.4.23. Response Object

+ Describes a single response from an API Operation. +

5.4.24. Fixed Fields

+ + + + + + + + +
Field Name + Type + Description +
description + string + Required. A short description of the response. GFM syntax can be used for rich text representation. +
schema + Schema Object + 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 Schema Object, its root type value may also be "file". This SHOULD be accompanied by a relevant produces mime-type. +
headers + Headers Object + A list of headers that are sent with the response. +
examples + Example Object + An example of the response message. +
+
5.4.24.1. Patterned Objects
+ + + + + +
Field Pattern + Type + Description +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+
5.4.24.2. Response Object Examples
+

Response of an array of a complex type:

+
{
+  "description": "A complex object array response",
+  "schema": {
+    "type": "array",
+    "items": {
+      "$ref": "#/definitions/VeryComplexType"
+    }
+  }
+}
+
+
description: A complex object array response
+schema:
+  type: array
+  items:
+    $ref: '#/definitions/VeryComplexType'
+
+

Response with a string type:

+
{
+  "description": "A simple string response",
+  "schema": {
+    "type": "string"
+  }
+}
+
+
description: A simple string response
+schema:
+  type: string
+
+

Response with headers:

+
{
+  "description": "A simple string response",
+  "schema": {
+    "type": "string"
+  },
+  "headers": {
+    "X-Rate-Limit-Limit": {
+      "description": "The number of allowed requests in the current period",
+      "type": "integer"
+    },
+    "X-Rate-Limit-Remaining": {
+      "description": "The number of remaining requests in the current period",
+      "type": "integer"
+    },
+    "X-Rate-Limit-Reset": {
+      "description": "The number of seconds left in the current period",
+      "type": "integer"
+    }
+  }
+}
+
+
description: A simple string response
+schema:
+  type: string
+headers:
+  X-Rate-Limit-Limit:
+    description: The number of allowed requests in the current period
+    type: integer
+  X-Rate-Limit-Remaining:
+    description: The number of remaining requests in the current period
+    type: integer
+  X-Rate-Limit-Reset:
+    description: The number of seconds left in the current period
+    type: integer
+
+

Response with no return value:

+
{
+  "description": "object created"
+}
+
+
description: object created
+
+

5.4.25. Headers Object

+ Lists the headers that can be sent as part of a response. +

5.4.26. Patterned Fields

+ + + + + +
Field Pattern + Type + Description +
{name} + Header Object + The name of the property corresponds to the name of the header. The value describes the type of the header. +
+
5.4.26.1. Headers Object Example
+

Rate-limit headers:

+
{
+    "X-Rate-Limit-Limit": {
+        "description": "The number of allowed requests in the current period",
+        "type": "integer"
+    },
+    "X-Rate-Limit-Remaining": {
+        "description": "The number of remaining requests in the current period",
+        "type": "integer"
+    },
+    "X-Rate-Limit-Reset": {
+        "description": "The number of seconds left in the current period",
+        "type": "integer"
+    }
+}
+
+
X-Rate-Limit-Limit:
+  description: The number of allowed requests in the current period
+  type: integer
+X-Rate-Limit-Remaining:
+  description: The number of remaining requests in the current period
+  type: integer
+X-Rate-Limit-Reset:
+  description: The number of seconds left in the current period
+  type: integer
+
+

5.4.27. Example Object

+

Allows sharing examples for operation responses.

+

5.4.28. Patterned Fields

+ + + + + +
Field Pattern + Type + Description +
{mime type} + Any + 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. +
+
5.4.28.1. Example Object Example
+

Example response for application/json mimetype of a Pet data type:

+
{
+  "application/json": {
+    "name": "Puma",
+    "type": "Dog",
+    "color": "Black",
+    "gender": "Female",
+    "breed": "Mixed"
+  }
+}
+
+
application/json:
+  name: Puma
+  type: Dog
+  color: Black
+  gender: Female
+  breed: Mixed
+
+

5.4.29. Header Object

+ + + + + + + + + + + + + + + + + + + + + + +
Field Name + Type + Description +
description + string + A short description of the header. +
type + string + Required. The type of the object. The value MUST be one of "string", "number", "integer", "boolean", or "array". +
format + string + The extending format for the previously mentioned type. See Data Type Formats for further details. +
items + Items Object + Required if type is “array”. Describes the type of items in the array. +
collectionFormat + string + + 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. +
+ Default value is csv. +
default + * + Declares the value of the header that the server will use if none is provided. (Note: “default” has no meaning for required headers.) 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 the header. +
maximum + number + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. +
exclusiveMaximum + boolean + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. +
minimum + number + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. +
exclusiveMinimum + boolean + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. +
maxLength + integer + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1. +
minLength + integer + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2. +
pattern + string + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. +
maxItems + integer + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2. +
minItems + integer + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3. +
uniqueItems + boolean + https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4. +
enum + [*] + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1. +
multipleOf + number + See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1. +
+

5.4.30. Patterned Objects

+ + + + + +
Field Pattern + Type + Description +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+
5.4.30.1. Header Object Example
+

A simple header with of an integer type:

+
{
+  "description": "The number of allowed requests in the current period",
+  "type": "integer"
+}
+
+
description: The number of allowed requests in the current period
+type: integer
+
+

5.4.31. Tag Object

+

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.

+

5.4.32. Fixed Fields

+ + + + + + + +
Field Name + Type + Description +
name + string + Required. The name of the tag. +
description + string + A short description for the tag. GFM syntax can be used for rich text representation. +
externalDocs + External Documentation Object + Additional external documentation for this tag. +
+
5.4.32.1. Patterned Fields
+ + + + + +
Field Pattern + Type + Description +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+
5.4.32.2. Tag Object Example
+
{
+  "name": "pet",
+  "description": "Pets operations"
+}
+
+
name: pet
+description: Pets operations
+
+

5.4.33. Reference 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.

+

5.4.34. Fixed Fields

+ + + + + +
Field Name + Type + Description +
$ref + string + Required. The reference string. +
+
5.4.34.1. Reference Object Example
+
{
+  "$ref": "#/definitions/Pet"
+}
+
+
$ref: '#/definitions/Pet'
+
+
5.4.34.2. Relative Schema File Example
+
{
+  "$ref": "Pet.json"
+}
+
+
$ref: 'Pet.yaml'
+
+
5.4.34.3. Relative Files With Embedded Schema Example
+
{
+  "$ref": "definitions.json#/Pet"
+}
+
+
$ref: 'definitions.yaml#/Pet'
+
+

5.4.35. Schema Object

+

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.

+

Further information about the properties can be found in JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here.

+

The following properties are taken directly from the JSON Schema definition and follow the same specifications:

+
    +
  • $ref - As a JSON Reference +
  • format (See Data Type Formats for further details) +
  • title +
  • description (GFM syntax can be used for rich text representation) +
  • default (Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object) +
  • multipleOf +
  • maximum +
  • exclusiveMaximum +
  • minimum +
  • exclusiveMinimum +
  • maxLength +
  • minLength +
  • pattern +
  • maxItems +
  • minItems +
  • uniqueItems +
  • maxProperties +
  • minProperties +
  • required +
  • enum +
  • type +
+

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.

+
    +
  • items +
  • allOf +
  • properties +
  • additionalProperties +
+

Other than the JSON Schema subset fields, the following fields may be used for further schema documentation.

+

5.4.36. Fixed Fields

+ + + + + + + + + +
Field Name + Type + Description +
discriminator + string + 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. +
readOnly + boolean + 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. +
xml + XML Object + 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. +
externalDocs + External Documentation Object + Additional external documentation for this schema. +
example + Any + A free-form property to include an example of an instance for this schema. +
+
5.4.36.1. Patterned Objects
+ + + + + +
Field Pattern + Type + Description +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+
5.4.36.1.1. Composition and Inheritance (Polymorphism)
+

Swagger allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. allOf takes in an array of object definitions that are validated independently but together compose a single object.

+

While composition offers model extensibility, it does not imply a hierarchy between the models. To support polymorphism, Swagger adds the support of the discriminator field. When used, the discriminator will be the name of the property used to decide which schema definition is used to validate the structure of the model. As such, the discriminator field MUST be a required field. The value of the chosen property has to be the friendly name given to the model under the definitions property. As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism.

+
5.4.36.1.2. XML Modeling
+

The xml property allows extra definitions when translating the JSON definition to XML. The XML Object contains additional information about the available options.

+
5.4.36.2. Schema Object Examples
+
5.4.36.2.1. Primitive Sample
+

Unlike previous versions of Swagger, Schema definitions can be used to describe primitive and arrays as well.

+
{
+    "type": "string",
+    "format": "email"
+}
+
+
type: string
+format: email
+
+
5.4.36.2.2. Simple Model
+
{
+  "type": "object",
+  "required": [
+    "name"
+  ],
+  "properties": {
+    "name": {
+      "type": "string"
+    },
+    "address": {
+      "$ref": "#/definitions/Address"
+    },
+    "age": {
+      "type": "integer",
+      "format": "int32",
+      "minimum": 0
+    }
+  }
+}
+
+
type: object
+required:
+- name
+properties:
+  name:
+    type: string
+  address:
+    $ref: '#/definitions/Address'
+  age:
+    type: integer
+    format: int32
+    minimum: 0
+
+
5.4.36.2.3. Model with Map/Dictionary Properties
+

For a simple string to string mapping:

+
{
+  "type": "object",
+  "additionalProperties": {
+    "type": "string"
+  }
+}
+
+
type: object
+additionalProperties:
+  type: string
+
+

For a string to model mapping:

+
{
+  "type": "object",
+  "additionalProperties": {
+    "$ref": "#/definitions/ComplexModel"
+  }
+}
+
+
type: object
+additionalProperties:
+  $ref: '#/definitions/ComplexModel'
+
+
5.4.36.2.4. Model with Example
+
{
+  "type": "object",
+  "properties": {
+    "id": {
+      "type": "integer",
+      "format": "int64"
+    },
+    "name": {
+      "type": "string"
+    }
+  },
+  "required": [
+    "name"
+  ],
+  "example": {
+    "name": "Puma",
+    "id": 1
+  }
+}
+
+
type: object
+properties:
+  id:
+    type: integer
+    format: int64
+  name:
+    type: string
+required:
+- name
+example:
+  name: Puma
+  id: 1
+
+
5.4.36.2.5. Models with Composition
+
{
+  "definitions": {
+    "ErrorModel": {
+      "type": "object",
+      "required": [
+        "message",
+        "code"
+      ],
+      "properties": {
+        "message": {
+          "type": "string"
+        },
+        "code": {
+          "type": "integer",
+          "minimum": 100,
+          "maximum": 600
+        }
+      }
+    },
+    "ExtendedErrorModel": {
+      "allOf": [
+        {
+          "$ref": "#/definitions/ErrorModel"
+        },
+        {
+          "type": "object",
+          "required": [
+            "rootCause"
+          ],
+          "properties": {
+            "rootCause": {
+              "type": "string"
+            }
+          }
+        }
+      ]
+    }
+  }
+}
+
+
definitions:
+  ErrorModel:
+    type: object
+    required:
+    - message
+    - code
+    properties:
+      message:
+        type: string
+      code:
+        type: integer
+        minimum: 100
+        maximum: 600
+  ExtendedErrorModel:
+    allOf:
+    - $ref: '#/definitions/ErrorModel'
+    - type: object
+      required:
+      - rootCause
+      properties:
+        rootCause:
+          type: string
+
+
5.4.36.2.6. Models with Polymorphism Support
+
{
+  "definitions": {
+    "Pet": {
+      "type": "object",
+      "discriminator": "petType",
+      "properties": {
+        "name": {
+          "type": "string"
+        },
+        "petType": {
+          "type": "string"
+        }
+      },
+      "required": [
+        "name",
+        "petType"
+      ]
+    },
+    "Cat": {
+      "description": "A representation of a cat",
+      "allOf": [
+        {
+          "$ref": "#/definitions/Pet"
+        },
+        {
+          "type": "object",
+          "properties": {
+            "huntingSkill": {
+              "type": "string",
+              "description": "The measured skill for hunting",
+              "default": "lazy",
+              "enum": [
+                "clueless",
+                "lazy",
+                "adventurous",
+                "aggressive"
+              ]
+            }
+          },
+          "required": [
+            "huntingSkill"
+          ]
+        }
+      ]
+    },
+    "Dog": {
+      "description": "A representation of a dog",
+      "allOf": [
+        {
+          "$ref": "#/definitions/Pet"
+        },
+        {
+          "type": "object",
+          "properties": {
+            "packSize": {
+              "type": "integer",
+              "format": "int32",
+              "description": "the size of the pack the dog is from",
+              "default": 0,
+              "minimum": 0
+            }
+          },
+          "required": [
+            "packSize"
+          ]
+        }
+      ]
+    }
+  }
+}
+
+
definitions:
+  Pet:
+    type: object
+    discriminator: petType
+    properties:
+      name:
+        type: string
+      petType:
+        type: string
+    required:
+    - name
+    - petType
+  Cat:
+    description: A representation of a cat
+    allOf:
+    - $ref: '#/definitions/Pet'
+    - type: object
+      properties:
+        huntingSkill:
+          type: string
+          description: The measured skill for hunting
+          default: lazy
+          enum:
+          - clueless
+          - lazy
+          - adventurous
+          - aggressive
+      required:
+      - huntingSkill
+  Dog:
+    description: A representation of a dog
+    allOf:
+    - $ref: '#/definitions/Pet'
+    - type: object
+      properties:
+        packSize:
+          type: integer
+          format: int32
+          description: the size of the pack the dog is from
+          default: 0
+          minimum: 0
+      required:
+      - packSize
+
+

5.4.37. XML Object

+

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.

+

5.4.38. Fixed Fields

+ + + + + + + + + +
Field Name + Type + Description +
name + string + 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. +
namespace + string + The URL of the namespace definition. Value SHOULD be in the form of a URL. +
prefix + string + The prefix to be used for the name. +
attribute + boolean + Declares whether the property definition translates to an attribute instead of an element. Default value is false. +
wrapped + 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). +
+
5.4.38.1. Patterned Objects
+ + + + + +
Field Pattern + Type + Description +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+
5.4.38.2. XML Object Examples
+

The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

+
5.4.38.2.1. No XML Element
+

Basic string property:

+
{
+    "animals": {
+        "type": "string"
+    }
+}
+
+
animals:
+  type: string
+
+
<animals>...</animals>
+
+

Basic string array property (wrapped is false by default):

+
{
+    "animals": {
+        "type": "array",
+        "items": {
+            "type": "string"
+        }
+    }
+}
+
+
animals:
+  type: array
+  items:
+    type: string
+
+
<animals>...</animals>
+<animals>...</animals>
+<animals>...</animals>
+
+
5.4.38.2.2. XML Name Replacement
+
{
+  "animals": {
+    "type": "string",
+    "xml": {
+      "name": "animal"
+    }
+  }
+}
+
+
animals:
+  type: string
+  xml:
+    name: animal
+
+
<animal>...</animal>
+
+
5.4.38.2.3. XML Attribute, Prefix and Namespace
+

In this example, a full model definition is shown.

+
{
+  "Person": {
+    "type": "object",
+    "properties": {
+      "id": {
+        "type": "integer",
+        "format": "int32",
+        "xml": {
+          "attribute": true
+        }
+      },
+      "name": {
+        "type": "string",
+        "xml": {
+          "namespace": "http://swagger.io/schema/sample",
+          "prefix": "sample"
+        }
+      }
+    }
+  }
+}
+
+
Person:
+  type: object
+  properties:
+    id:
+      type: integer
+      format: int32
+      xml:
+        attribute: true
+    name:
+      type: string
+      xml:
+        namespace: http://swagger.io/schema/sample
+        prefix: sample
+
+
<Person id="123">
+    <sample:name xmlns:sample="http://swagger.io/schema/sample">example</sample:name>
+</Person>
+
+
5.4.38.2.4. XML Arrays
+

Changing the element names:

+
{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    }
+  }
+}
+
+
animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+
+
<animal>value</animal>
+<animal>value</animal>
+
+

The external name property has no effect on the XML:

+
{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    },
+    "xml": {
+      "name": "aliens"
+    }
+  }
+}
+
+
animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+  xml:
+    name: aliens
+
+
<animal>value</animal>
+<animal>value</animal>
+
+

Even when the array is wrapped, if no name is explicitly defined, the same name will be used both internally and externally:

+
{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    },
+    "xml": {
+      "wrapped": true
+    }
+  }
+}
+
+
animals:
+  type: array
+  items:
+    type: string
+  xml:
+    wrapped: true
+
+
<animals>
+  <animals>value</animals>
+  <animals>value</animals>
+</animals>
+
+

To overcome the above example, the following definition can be used:

+
{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    },
+    "xml": {
+      "wrapped": true
+    }
+  }
+}
+
+
animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+  xml:
+    wrapped: true
+
+
<animals>
+  <animal>value</animal>
+  <animal>value</animal>
+</animals>
+
+

Affecting both internal and external names:

+
{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string",
+      "xml": {
+        "name": "animal"
+      }
+    },
+    "xml": {
+      "name": "aliens",
+      "wrapped": true
+    }
+  }
+}
+
+
animals:
+  type: array
+  items:
+    type: string
+    xml:
+      name: animal
+  xml:
+    name: aliens
+    wrapped: true
+
+
<aliens>
+  <animal>value</animal>
+  <animal>value</animal>
+</aliens>
+
+

If we change the external element but not the internal ones:

+
{
+  "animals": {
+    "type": "array",
+    "items": {
+      "type": "string"
+    },
+    "xml": {
+      "name": "aliens",
+      "wrapped": true
+    }
+  }
+}
+
+
animals:
+  type: array
+  items:
+    type: string
+  xml:
+    name: aliens
+    wrapped: true
+
+
<aliens>
+  <aliens>value</aliens>
+  <aliens>value</aliens>
+</aliens>
+
+

5.4.39. Definitions Object

+

An object to hold data types that can be consumed and produced by operations. These data types can be primitives, arrays or models.

+

5.4.40. Patterned Fields

+ + + + + +
Field Pattern + Type + Description +
{name} + Schema Object + A single definition, mapping a “name” to the schema it defines. +
+
5.4.40.1. Definitions Object Example
+
{
+  "Category": {
+    "type": "object",
+    "properties": {
+      "id": {
+        "type": "integer",
+        "format": "int64"
+      },
+      "name": {
+        "type": "string"
+      }
+    }
+  },
+  "Tag": {
+    "type": "object",
+    "properties": {
+      "id": {
+        "type": "integer",
+        "format": "int64"
+      },
+      "name": {
+        "type": "string"
+      }
+    }
+  }
+}
+
+
Category:
+  type: object
+  properties:
+    id:
+      type: integer
+      format: int64
+    name:
+      type: string
+Tag:
+  type: object
+  properties:
+    id:
+      type: integer
+      format: int64
+    name:
+      type: string
+
+

5.4.41. Parameters Definitions Object

+

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.

+

5.4.42. Patterned Fields

+ + + + + +
Field Pattern + Type + Description +
{name} + Parameter Object + A single parameter definition, mapping a “name” to the parameter it defines. +
+
5.4.42.1. Parameters Definition Object Example
+
{
+  "skipParam": {
+    "name": "skip",
+    "in": "query",
+    "description": "number of items to skip",
+    "required": true,
+    "type": "integer",
+    "format": "int32"
+  },
+  "limitParam": {
+    "name": "limit",
+    "in": "query",
+    "description": "max records to return",
+    "required": true,
+    "type": "integer",
+    "format": "int32"
+  }
+}
+
+
skipParam:
+  name: skip
+  in: query
+  description: number of items to skip
+  required: true
+  type: integer
+  format: int32
+limitParam:
+  name: limit
+  in: query
+  description: max records to return
+  required: true
+  type: integer
+  format: int32
+
+

5.4.43. Responses Definitions Object

+

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.

+

5.4.44. Patterned Fields

+ + + + + +
Field Pattern + Type + Description +
{name} + Response Object + A single response definition, mapping a “name” to the response it defines. +
+
5.4.44.1. Responses Definitions Object Example
+
{
+  "NotFound": {
+    "description": "Entity not found."
+  },
+  "IllegalInput": {
+    "description": "Illegal input for operation."
+  },
+  "GeneralError": {
+    "description": "General Error",
+    "schema": {
+      "$ref": "#/definitions/GeneralError"
+    }
+  }
+}
+
+
NotFound:
+  description: Entity not found.
+IllegalInput:
+  description: Illegal input for operation.
+GeneralError:
+  description: General Error
+  schema:
+    $ref: '#/definitions/GeneralError'
+
+

5.4.45. Security Definitions Object

+

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.

+

5.4.46. Patterned Fields

+ + + + + +
Field Pattern + Type + Description +
{name} + Security Scheme Object + A single security scheme definition, mapping a “name” to the scheme it defines. +
+
5.4.46.1. Security Definitions Object Example
+
{
+  "api_key": {
+    "type": "apiKey",
+    "name": "api_key",
+    "in": "header"
+  },
+  "petstore_auth": {
+    "type": "oauth2",
+    "authorizationUrl": "http://swagger.io/api/oauth/dialog",
+    "flow": "implicit",
+    "scopes": {
+      "write:pets": "modify pets in your account",
+      "read:pets": "read your pets"
+    }
+  }
+}
+
+
api_key:
+  type: apiKey
+  name: api_key
+  in: header
+petstore_auth:
+  type: oauth2
+  authorizationUrl: http://swagger.io/api/oauth/dialog
+  flow: implicit
+  scopes:
+    write:pets: modify pets in your account
+    read:pets: read your pets
+
+

5.4.47. Security Scheme Object

+

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

+

5.4.48. Fixed Fields

+ + + + + + + + + + + + +
Field Name + Type + Validity + Description +
type + string + Any + Required. The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2". +
description + string + Any + A short description for security scheme. +
name + string + apiKey + Required. The name of the header or query parameter to be used. +
in + string + apiKey + Required The location of the API key. Valid values are "query" or "header". +
flow + string + oauth2 + Required. The flow used by the OAuth2 security scheme. Valid values are "implicit", "password", "application" or "accessCode". +
authorizationUrl + string + oauth2 ("implicit", "accessCode") + Required. The authorization URL to be used for this flow. This SHOULD be in the form of a URL. +
tokenUrl + string + oauth2 ("password", "application", "accessCode") + Required. The token URL to be used for this flow. This SHOULD be in the form of a URL. +
scopes + Scopes Object + oauth2 + Required. The available scopes for the OAuth2 security scheme. +
+
5.4.48.1. Patterned Fields
+ + + + + +
Field Name + Type + Description +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+
5.4.48.2. Security Scheme Object Example
+
5.4.48.2.1. Basic Authentication Sample
+
{
+  "type": "basic"
+}
+
+
type: basic
+
+
5.4.48.2.2. API Key Sample
+
{
+  "type": "apiKey",
+  "name": "api_key",
+  "in": "header"
+}
+
+
type: apiKey
+name: api_key
+in: header
+
+
5.4.48.2.3. Implicit OAuth2 Sample
+
{
+  "type": "oauth2",
+  "authorizationUrl": "http://swagger.io/api/oauth/dialog",
+  "flow": "implicit",
+  "scopes": {
+    "write:pets": "modify pets in your account",
+    "read:pets": "read your pets"
+  }
+}
+
+
type: oauth2
+authorizationUrl: http://swagger.io/api/oauth/dialog
+flow: implicit
+scopes:
+  write:pets: modify pets in your account
+  read:pets: read your pets
+
+

5.4.49. Scopes Object

+

Lists the available scopes for an OAuth2 security scheme.

+

5.4.50. Patterned Fields

+ + + + + +
Field Pattern + Type + Description +
{name} + string + Maps between a name of a scope to a short description of it (as the value of the property). +
+
5.4.50.1. Patterned Objects
+ + + + + +
Field Pattern + Type + Description +
^x- + Any + Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. +
+
5.4.50.2. Scopes Object Example
+
{
+  "write:pets": "modify pets in your account",
+  "read:pets": "read your pets"
+}
+
+
write:pets: modify pets in your account
+read:pets: read your pets
+
+

5.4.51. Security Requirement Object

+

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.

+

5.4.52. Patterned Fields

+ + + + + +
Field Pattern + Type + Description +
{name} + [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. +
+
5.4.52.1. Security Requirement Object Examples
+
5.4.52.1.1. Non-OAuth2 Security Requirement
+
{
+  "api_key": []
+}
+
+
api_key: []
+
+
5.4.52.1.2. OAuth2 Security Requirement
+
{
+  "petstore_auth": [
+    "write:pets",
+    "read:pets"
+  ]
+}
+
+
petstore_auth:
+- write:pets
+- read:pets
+
+

5.5. Specification Extensions

+

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

+

5.6. Security Filtering

+

Some objects in the Swagger specification may be declared and remain empty, or completely be removed, even though they are inherently the core of the API documentation.

+

The reasoning behind it is to allow an additional layer of access control over the documentation itself. While not part of the specification itself, certain libraries may choose to allow access to parts of the documentation based on some form of authentication/authorization.

+

Two examples for this:

+
    +
  1. The Paths Object may be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication. +
  2. The Path Item Object may be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object so the user will not be aware of its existence. This allows the documentation provider a finer control over what the viewer can see. +
+
+ +

Index

+

Terms defined by this specification

+ +

References

+

Normative References

+
+
[RFC6838] +
N. Freed; J. Klensin; T. Hansen. Media Type Specifications and Registration Procedures. January 2013. Best Current Practice. URL: https://tools.ietf.org/html/rfc6838 +
[RFC7231] +
R. Fielding, Ed.; J. Reschke, Ed.. Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content. June 2014. Proposed Standard. URL: https://tools.ietf.org/html/rfc7231 +
+ + + + \ No newline at end of file diff --git a/bikeshed/3.0.0.bs b/bikeshed/v3/3.0.0.bs similarity index 99% rename from bikeshed/3.0.0.bs rename to bikeshed/v3/3.0.0.bs index d667e09442..672f284924 100644 --- a/bikeshed/3.0.0.bs +++ b/bikeshed/v3/3.0.0.bs @@ -2607,7 +2607,7 @@ This mechanism is used by Link Objects and Link Objects and Date: Wed, 6 Dec 2017 09:04:29 +0000 Subject: [PATCH 05/34] bikeshed; fixes to TOC,code blocks and indent levels --- bikeshed/md2bs.js | 37 ++- bikeshed/v2/2.0.bs | 62 ++--- bikeshed/v2/input.bs | 62 ++--- bikeshed/v2/oas_2.0.err | 244 +++++++++--------- bikeshed/v2/oas_2.0.html | 464 +++++++++++++++++---------------- bikeshed/v3/3.0.0.bs | 87 +++---- bikeshed/v3/3.0.0.md | 55 +++- bikeshed/v3/input.bs | 87 +++---- bikeshed/v3/oas_3.0.0.html | 507 ++++++++++++++++++------------------- 9 files changed, 826 insertions(+), 779 deletions(-) diff --git a/bikeshed/md2bs.js b/bikeshed/md2bs.js index 2b42016d67..cdfd725708 100644 --- a/bikeshed/md2bs.js +++ b/bikeshed/md2bs.js @@ -30,24 +30,33 @@ let s = fs.readFileSync(process.argv[2],'utf8'); let lines = s.split('\r').join().split('\n'); let prevIndent = 0; +let inTOC = false; +let inCodeBlock = false; for (let l in lines) { let line = lines[l]; + if (line.startsWith('## Table of Contents')) inTOC = true; + if (line.startsWith('

Definitions

OpenAPI Document

A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification. @@ -211,7 +212,7 @@ Relative references are resolved using the URLs defined in the Info Object

The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.

-

Fixed Fields

+
Fixed Fields
@@ -287,7 +288,7 @@ The metadata MAY be used by the clients if needed, and MAY be presented in editi

Contact Object

Contact information for the exposed API.

-

Fixed Fields

+
Fixed Fields
@@ -330,7 +331,7 @@ The metadata MAY be used by the clients if needed, and MAY be presented in editi

License Object

License information for the exposed API.

-

Fixed Fields

+
Fixed Fields
@@ -366,7 +367,7 @@ The metadata MAY be used by the clients if needed, and MAY be presented in editi

Server Object

An object representing a Server.

-

Fixed Fields

+
Fixed Fields
@@ -481,7 +482,7 @@ The metadata MAY be used by the clients if needed, and MAY be presented in editi

Server Variable Object

An object representing a Server Variable for server URL template substitution.

-

Fixed Fields

+
Fixed Fields
@@ -512,7 +513,7 @@ The metadata MAY be used by the clients if needed, and MAY be presented in editi

Components Object

Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.

-

Fixed Fields

+
Fixed Fields
@@ -733,7 +734,7 @@ my.org.User

Paths Object

Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.

-

Patterned Fields

+
Patterned Fields
@@ -810,7 +811,7 @@ The path is appended to the URL from the Server Ob

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.

-

Fixed Fields

+
Fixed Fields
@@ -971,7 +972,7 @@ The path itself is still exposed to the documentation viewer but they will not k

Operation Object

Describes a single API operation on a path.

-

Fixed Fields

+
Fixed Fields
@@ -1152,7 +1153,7 @@ The path itself is still exposed to the documentation viewer but they will not k

External Documentation Object

Allows referencing an external resource for extended documentation.

-

Fixed Fields

+
Fixed Fields
@@ -1189,7 +1190,7 @@ The path itself is still exposed to the documentation viewer but they will not k

Parameter Object

Describes a single operation parameter.

A unique parameter is defined by a combination of a name and location.

-

Parameter Locations

+
Parameter Locations

There are four possible parameter locations specified by the in field:

  • path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId.
  • @@ -1614,7 +1615,7 @@ When example or examples are provided in conjunction w

    Request Body Object

    Describes a single request body.

    -

    Fixed Fields

    +
    Fixed Fields
@@ -1745,7 +1746,7 @@ When example or examples are provided in conjunction w

Media Type Object

Each Media Type Object provides schema and examples for the media type identified by its key. -

Fixed Fields

+
Fixed Fields
@@ -1894,7 +1895,7 @@ Each Media Type Object provides schema and examples for the media type identifie format:binary -

Support for x-www-form-urlencoded Request Bodies

+
Support for x-www-form-urlencoded Request Bodies

To submit content using form url encoding via [[!rfc1866]], the following definition may be used:


@@ -1914,7 +1915,7 @@ definition may be used:

In this example, the contents in the requestBody MUST be stringified per [[!rfc1866]]) when passed to the server. In addition, the address field complex object will be stringified.

When passing complex objects in the application/x-www-form-urlencoded content type, the default serialization strategy of such properties is described in the Encoding Object's style property as form.

-

Special Considerations for multipart Content

+
Special Considerations for multipart Content

It is common to use multipart/form-data as a Content-Type when transferring request bodies to operations. In contrast to 2.0, a schema is REQUIRED to define the input parameters to the operation when using multipart content. This supports complex structures as well as supporting mechanisms for multiple file uploads.

When passing in multipart types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default Content-Types are defined for multipart:

    @@ -1955,7 +1956,7 @@ definition may be used:

    An encoding attribute is introduced to give you control over the serialization of parts of multipart request bodies. This attribute is only applicable to multipart and application/x-www-form-urlencoded request bodies.

    Encoding Object

    A single encoding definition applied to a single schema property.

    -

    Fixed Fields

    +
    Fixed Fields
@@ -2040,7 +2041,7 @@ However, documentation is expected to cover a successful operation response and that are not covered individually by the specification.

The Responses Object MUST contain at least one response code, and it SHOULD be the response for a successful operation call.

-

Fixed Fields

+
Fixed Fields
@@ -2118,7 +2119,7 @@ SHOULD be the response for a successful operation call.

Response Object

Describes a single response from an API Operation, including design-time, static `links` to operations based on the response. -

Fixed Fields

+
Fixed Fields
@@ -2265,7 +2266,7 @@ Describes a single response from an API Operation, including design-time, static

A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

-

Patterned Fields

+
Patterned Fields
@@ -2367,7 +2368,7 @@ This includes accessing any part of a body that a JSON Pointer [[!rfc6901]] can description:webhooksuccessfullyprocessedandnoretrieswillbeperformed

Example Object

-

Fixed Fields

+
Fixed Fields
@@ -2462,12 +2463,12 @@ validate compatibility automatically, and reject the example value(s) if incompa confirmation-success:$ref:'#/components/examples/confirmation-success' -

Link Object

+

Link Object

The Link object represents a possible design-time link for a response. The presence of a link does not guarantee the caller’s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.

Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.

For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.

-

Fixed Fields

+
Fixed Fields
@@ -2514,7 +2515,7 @@ The presence of a link does not guarantee the caller’s ability to successfully In the case of an operationId, it MUST be unique and resolved in the scope of the OAS document. Because of the potential for name clashes, the operationRef syntax is preferred for specifications with external references.

-

Examples

+
Examples

Computing a link from a request operation where the $request.path.id is used to pass a request parameter to the linked operation.


 paths:
@@ -2574,7 +2575,7 @@ for specifications with external references.

Clients follow all links at their discretion. Neither permissions, nor the capability to make a successful call to that link, is guaranteed solely by the existence of a relationship.

-

OperationRef Examples

+
OperationRef Examples

As references to operationId MAY NOT be possible (the operationId is an optional value), references MAY also be made through a relative operationRef:


@@ -2670,7 +2671,7 @@ Expressions can be embedded into string values by surrounding the expression wit
 
  • in MUST NOT be specified, it is implicitly in header.
  • All traits that are affected by the location MUST be applicable to a location of header (for example, style).
  • -

    Header Object Example

    +
    Header Object Example

    A simple header of type integer:

    
     {
    @@ -2688,7 +2689,7 @@ Expressions can be embedded into string values by surrounding the expression wit
     

    Tag Object

    Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -2786,11 +2787,11 @@ are incompatible.

    example: $ref: http://foo.bar#/examples/address-example.json
    -

    Reference Object

    +

    Reference Object

    A simple object to allow referencing other components in the specification, internally and externally.

    The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.

    For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -2808,7 +2809,7 @@ are incompatible.

    This object cannot be extended with additional properties and any properties added SHALL be ignored.

    -

    Reference Object Example

    +
    Reference Object Example
    
     {
     	"$ref": "#/components/schemas/Pet"
    @@ -2817,7 +2818,7 @@ are incompatible.

    
     $ref: '#/components/schemas/Pet'
     
    -

    Relative Schema Document Example

    +
    Relative Schema Document Example
    
     {
       "$ref": "Pet.json"
    @@ -2841,7 +2842,7 @@ These types can be objects, but also primitives and arrays.
     This object is an extended subset of the JSON Schema Specification Wright Draft 00.

    For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.

    -

    Properties

    +
    Properties

    The following properties are taken directly from the JSON Schema definition and follow the same specifications:

    • title
    • @@ -3252,10 +3253,10 @@ The XML Object contains additional information about th required: - packSize
    -

    Discriminator Object

    +
    Discriminator Object

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    When using the discriminator, inline schemas will not be considered.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -3380,7 +3381,7 @@ components:

    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.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -3707,10 +3708,10 @@ See examples for expected behavior.

    <aliens>value</aliens></aliens> -

    Security Scheme Object

    +
    Security Scheme Object

    Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [[!rfc6749]], and OpenID Connect Discovery.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -3834,9 +3835,9 @@ Supported schemes are HTTP authentication, an API key (either as a header or as write:pets:modifypetsinyouraccount read:pets:readyourpets -

    OAuth Flows Object

    +
    OAuth Flows Object

    Allows configuration of the supported OAuth Flows.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -3871,7 +3872,7 @@ Supported schemes are HTTP authentication, an API key (either as a header or as

    This object MAY be extended with Specification Extensions.

    OAuth Flow Object

    Configuration details for a supported OAuth Flow

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -3953,7 +3954,7 @@ The name used for each property MUST correspond to a security scheme declared in

    Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.

    When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.

    -

    Patterned Fields

    +
    Patterned Fields
    @@ -3994,7 +3995,7 @@ This enables support for scenarios where multiple query parameters or HTTP heade - write:pets- read:pets -

    Specification Extensions

    +
    Specification Extensions

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    The extensions properties are implemented as patterned fields that are always prefixed by "x-".

    @@ -4014,7 +4015,7 @@ This enables support for scenarios where multiple query parameters or HTTP heade

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

    -

    Security Filtering

    +
    Security Filtering

    Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.

    The reasoning is to allow an additional layer of access control over the documentation. While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.

    @@ -4023,7 +4024,7 @@ While not part of the specification itself, certain libraries MAY choose to allo
  • The Paths Object MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication.
  • The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object, so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see.
  • -

    Appendix A: Revision History

    +
    Appendix A: Revision History
    diff --git a/bikeshed/v3/3.0.0.md b/bikeshed/v3/3.0.0.md index e47f28c13f..d8c5dad307 100644 --- a/bikeshed/v3/3.0.0.md +++ b/bikeshed/v3/3.0.0.md @@ -12,6 +12,59 @@ The OpenAPI Specification (OAS) defines a standard, language-agnostic interface An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases. +## Table of Contents + + +- [Definitions](#definitions) + - [OpenAPI Document](#oasDocument) + - [Path Templating](#pathTemplating) + - [Media Types](#mediaTypes) + - [HTTP Status Codes](#httpCodes) +- [Specification](#specification) + - [Versions](#versions) + - [Format](#format) + - [Document Structure](#documentStructure) + - [Data Types](#dataTypes) + - [Rich Text Formatting](#richText) + - [Relative References In URLs](#relativeReferences) + - [Schema](#schema) + - [OpenAPI Object](#oasObject) + - [Info Object](#infoObject) + - [Contact Object](#contactObject) + - [License Object](#licenseObject) + - [Server Object](#serverObject) + - [Server Variable Object](#serverVariableObject) + - [Components Object](#componentsObject) + - [Paths Object](#pathsObject) + - [Path Item Object](#pathItemObject) + - [Operation Object](#operationObject) + - [External Documentation Object](#externalDocumentationObject) + - [Parameter Object](#parameterObject) + - [Request Body Object](#requestBodyObject) + - [Media Type Object](#mediaTypeObject) + - [Encoding Object](#encodingObject) + - [Responses Object](#responsesObject) + - [Response Object](#responseObject) + - [Callback Object](#callbackObject) + - [Example Object](#exampleObject) + - [Link Object](#linkObject) + - [Header Object](#headerObject) + - [Tag Object](#tagObject) + - [Reference Object](#referenceObject) + - [Schema Object](#schemaObject) + - [Discriminator Object](#discriminatorObject) + - [XML Object](#xmlObject) + - [Security Scheme Object](#securitySchemeObject) + - [OAuth Flows Object](#oauthFlowsObject) + - [OAuth Flow Object](#oauthFlowObject) + - [Security Requirement Object](#securityRequirementObject) + - [Specification Extensions](#specificationExtensions) + - [Security Filtering](#securityFiltering) +- [Appendix A: Revision History](#revisionHistory) + + + + ## Definitions ##### OpenAPI Document @@ -1001,7 +1054,7 @@ simple | false | n/a | blue | blue,black,brown | R,100,G,200,B,150 simple | true | n/a | blue | blue,black,brown | R=100,G=200,B=150 spaceDelimited | false | n/a | n/a | blue%20black%20brown | R%20100%20G%20200%20B%20150 pipeDelimited | false | n/a | n/a | blue\|black\|brown | R\|100\|G\|200|G\|150 -deepObject | true | n/a | n/a | n/a | color\[R]=100&color\[G]=200&color\[B]=150 +deepObject | true | n/a | n/a | n/a | color[R]=100&color[G]=200&color[B]=150 This object MAY be extended with [Specification Extensions](#specificationExtensions). diff --git a/bikeshed/v3/input.bs b/bikeshed/v3/input.bs index f65e1f6279..b2587293d7 100644 --- a/bikeshed/v3/input.bs +++ b/bikeshed/v3/input.bs @@ -171,6 +171,7 @@ github.com style (c) Vasily Polovnyov

    Introduction

    The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.

    An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.

    +

    Definitions

    OpenAPI Document

    A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification. @@ -377,7 +378,7 @@ Relative references are resolved using the URLs defined in the Info Object

    The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -453,7 +454,7 @@ The metadata MAY be used by the clients if needed, and MAY be presented in editi

    Contact Object

    Contact information for the exposed API.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -496,7 +497,7 @@ The metadata MAY be used by the clients if needed, and MAY be presented in editi

    License Object

    License information for the exposed API.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -532,7 +533,7 @@ The metadata MAY be used by the clients if needed, and MAY be presented in editi

    Server Object

    An object representing a Server.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -647,7 +648,7 @@ The metadata MAY be used by the clients if needed, and MAY be presented in editi

    Server Variable Object

    An object representing a Server Variable for server URL template substitution.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -678,7 +679,7 @@ The metadata MAY be used by the clients if needed, and MAY be presented in editi

    Components Object

    Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -899,7 +900,7 @@ my.org.User

    Paths Object

    Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.

    -

    Patterned Fields

    +
    Patterned Fields
    @@ -976,7 +977,7 @@ The path is appended to the URL from the Server Ob

    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.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -1137,7 +1138,7 @@ The path itself is still exposed to the documentation viewer but they will not k

    Operation Object

    Describes a single API operation on a path.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -1318,7 +1319,7 @@ The path itself is still exposed to the documentation viewer but they will not k

    External Documentation Object

    Allows referencing an external resource for extended documentation.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -1355,7 +1356,7 @@ The path itself is still exposed to the documentation viewer but they will not k

    Parameter Object

    Describes a single operation parameter.

    A unique parameter is defined by a combination of a name and location.

    -

    Parameter Locations

    +
    Parameter Locations

    There are four possible parameter locations specified by the in field:

    • path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId.
    • @@ -1780,7 +1781,7 @@ When example or examples are provided in conjunction w

      Request Body Object

      Describes a single request body.

      -

      Fixed Fields

      +
      Fixed Fields
    @@ -1911,7 +1912,7 @@ When example or examples are provided in conjunction w

    Media Type Object

    Each Media Type Object provides schema and examples for the media type identified by its key. -

    Fixed Fields

    +
    Fixed Fields
    @@ -2060,7 +2061,7 @@ Each Media Type Object provides schema and examples for the media type identifie format:binary -

    Support for x-www-form-urlencoded Request Bodies

    +
    Support for x-www-form-urlencoded Request Bodies

    To submit content using form url encoding via [[!rfc1866]], the following definition may be used:

    
    @@ -2080,7 +2081,7 @@ definition may be used:

    In this example, the contents in the requestBody MUST be stringified per [[!rfc1866]]) when passed to the server. In addition, the address field complex object will be stringified.

    When passing complex objects in the application/x-www-form-urlencoded content type, the default serialization strategy of such properties is described in the Encoding Object's style property as form.

    -

    Special Considerations for multipart Content

    +
    Special Considerations for multipart Content

    It is common to use multipart/form-data as a Content-Type when transferring request bodies to operations. In contrast to 2.0, a schema is REQUIRED to define the input parameters to the operation when using multipart content. This supports complex structures as well as supporting mechanisms for multiple file uploads.

    When passing in multipart types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default Content-Types are defined for multipart:

      @@ -2121,7 +2122,7 @@ definition may be used:

      An encoding attribute is introduced to give you control over the serialization of parts of multipart request bodies. This attribute is only applicable to multipart and application/x-www-form-urlencoded request bodies.

      Encoding Object

      A single encoding definition applied to a single schema property.

      -

      Fixed Fields

      +
      Fixed Fields
    @@ -2206,7 +2207,7 @@ However, documentation is expected to cover a successful operation response and that are not covered individually by the specification.

    The Responses Object MUST contain at least one response code, and it SHOULD be the response for a successful operation call.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -2284,7 +2285,7 @@ SHOULD be the response for a successful operation call.

    Response Object

    Describes a single response from an API Operation, including design-time, static `links` to operations based on the response. -

    Fixed Fields

    +
    Fixed Fields
    @@ -2431,7 +2432,7 @@ Describes a single response from an API Operation, including design-time, static

    A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

    -

    Patterned Fields

    +
    Patterned Fields
    @@ -2533,7 +2534,7 @@ This includes accessing any part of a body that a JSON Pointer [[!rfc6901]] can description:webhooksuccessfullyprocessedandnoretrieswillbeperformed

    Example Object

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -2628,12 +2629,12 @@ validate compatibility automatically, and reject the example value(s) if incompa confirmation-success:$ref:'#/components/examples/confirmation-success' -

    Link Object

    +

    Link Object

    The Link object represents a possible design-time link for a response. The presence of a link does not guarantee the caller’s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.

    Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.

    For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -2680,7 +2681,7 @@ The presence of a link does not guarantee the caller’s ability to successfully In the case of an operationId, it MUST be unique and resolved in the scope of the OAS document. Because of the potential for name clashes, the operationRef syntax is preferred for specifications with external references.

    -

    Examples

    +
    Examples

    Computing a link from a request operation where the $request.path.id is used to pass a request parameter to the linked operation.

    
     paths:
    @@ -2740,7 +2741,7 @@ for specifications with external references.

    Clients follow all links at their discretion. Neither permissions, nor the capability to make a successful call to that link, is guaranteed solely by the existence of a relationship.

    -

    OperationRef Examples

    +
    OperationRef Examples

    As references to operationId MAY NOT be possible (the operationId is an optional value), references MAY also be made through a relative operationRef:

    
    @@ -2836,7 +2837,7 @@ Expressions can be embedded into string values by surrounding the expression wit
     
  • in MUST NOT be specified, it is implicitly in header.
  • All traits that are affected by the location MUST be applicable to a location of header (for example, style).
  • -

    Header Object Example

    +
    Header Object Example

    A simple header of type integer:

    
     {
    @@ -2854,7 +2855,7 @@ Expressions can be embedded into string values by surrounding the expression wit
     

    Tag Object

    Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -2952,11 +2953,11 @@ are incompatible.

    example: $ref: http://foo.bar#/examples/address-example.json
    -

    Reference Object

    +

    Reference Object

    A simple object to allow referencing other components in the specification, internally and externally.

    The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.

    For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -2974,7 +2975,7 @@ are incompatible.

    This object cannot be extended with additional properties and any properties added SHALL be ignored.

    -

    Reference Object Example

    +
    Reference Object Example
    
     {
     	"$ref": "#/components/schemas/Pet"
    @@ -2983,7 +2984,7 @@ are incompatible.

    
     $ref: '#/components/schemas/Pet'
     
    -

    Relative Schema Document Example

    +
    Relative Schema Document Example
    
     {
       "$ref": "Pet.json"
    @@ -3007,7 +3008,7 @@ These types can be objects, but also primitives and arrays.
     This object is an extended subset of the JSON Schema Specification Wright Draft 00.

    For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.

    -

    Properties

    +
    Properties

    The following properties are taken directly from the JSON Schema definition and follow the same specifications:

    • title
    • @@ -3418,10 +3419,10 @@ The XML Object contains additional information about th required: - packSize
    -

    Discriminator Object

    +
    Discriminator Object

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    When using the discriminator, inline schemas will not be considered.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -3546,7 +3547,7 @@ components:

    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.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -3873,10 +3874,10 @@ See examples for expected behavior.

    <aliens>value</aliens></aliens> -

    Security Scheme Object

    +
    Security Scheme Object

    Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [[!rfc6749]], and OpenID Connect Discovery.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -4000,9 +4001,9 @@ Supported schemes are HTTP authentication, an API key (either as a header or as write:pets:modifypetsinyouraccount read:pets:readyourpets -

    OAuth Flows Object

    +
    OAuth Flows Object

    Allows configuration of the supported OAuth Flows.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -4037,7 +4038,7 @@ Supported schemes are HTTP authentication, an API key (either as a header or as

    This object MAY be extended with Specification Extensions.

    OAuth Flow Object

    Configuration details for a supported OAuth Flow

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -4119,7 +4120,7 @@ The name used for each property MUST correspond to a security scheme declared in

    Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.

    When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.

    -

    Patterned Fields

    +
    Patterned Fields
    @@ -4160,7 +4161,7 @@ This enables support for scenarios where multiple query parameters or HTTP heade - write:pets- read:pets -

    Specification Extensions

    +
    Specification Extensions

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    The extensions properties are implemented as patterned fields that are always prefixed by "x-".

    @@ -4180,7 +4181,7 @@ This enables support for scenarios where multiple query parameters or HTTP heade

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

    -

    Security Filtering

    +
    Security Filtering

    Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.

    The reasoning is to allow an additional layer of access control over the documentation. While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.

    @@ -4189,7 +4190,7 @@ While not part of the specification itself, certain libraries MAY choose to allo
  • The Paths Object MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication.
  • The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object, so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see.
  • -

    Appendix A: Revision History

    +
    Appendix A: Revision History
    diff --git a/bikeshed/v3/oas_3.0.0.html b/bikeshed/v3/oas_3.0.0.html index fa938d65f5..bf86cd2fa3 100644 --- a/bikeshed/v3/oas_3.0.0.html +++ b/bikeshed/v3/oas_3.0.0.html @@ -1176,7 +1176,7 @@ } } - + - - - - - - - -Open API Initiative logo - -

    OpenAPI Specification

    -

    (fka Swagger RESTful API Documentation Specification)

    -

    Version 2.0

    -

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [!rfc2119].

    -

    The Swagger specification is licensed under The Apache License, Version 2.0.

    -

    Introductions

    -

    Swagger™ is a project used to describe and document RESTful APIs.

    -

    The Swagger specification defines a set of files required to describe such an API. These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various languages. Additional utilities can also take advantage of the resulting files, such as testing tools.

    -

    Revision History

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    VersionDateNotes
    2.02014-09-08Release of Swagger 2.0
    1.22014-03-14Initial release of the formal document.
    1.12012-08-22Release of Swagger 1.1
    1.02011-08-10First release of the Swagger Specification
    -

    Definitions

    -

    Path Templating

    -Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. -

    Mime Types

    -Mime type definitions are spread across several resources. The mime type definitions should be in compliance with [[!rfc6838]]. -

    Some examples of possible mime type definitions:

    -
    
    -  text/plain; charset=utf-8
    -  application/json
    -  application/vnd.github+json
    -  application/vnd.github.v3+json
    -  application/vnd.github.v3.raw+json
    -  application/vnd.github.v3.text+json
    -  application/vnd.github.v3.html+json
    -  application/vnd.github.v3.full+json
    -  application/vnd.github.v3.diff
    -  application/vnd.github.v3.patch
    -
    -

    HTTP Status Codes

    -The HTTP Status Codes are used to indicate the status of the executed operation. The available status codes are described by [[!rfc7231]]section-6) and in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). -

    Specification

    -

    Format

    -

    The files describing the RESTful API in accordance with the Swagger specification are represented as JSON objects and conform to the JSON standards. YAML, being a superset of JSON, can be used as well to -represent a Swagger specification file.

    -

    For example, if a field is said to have an array value, the JSON array representation will be used:

    -
    
    -{
    -   "field" : [...]
    -}
    -
    -

    While the API is described using JSON it does not impose a JSON input/output to the API itself.

    -

    All field names in the specification are case sensitive.

    -

    The schema exposes two types of fields. Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. Patterned fields can have multiple occurrences as long as each has a unique name.

    -

    File Structure

    -

    The Swagger representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for $ref fields in the specification as follows from the JSON Schema definitions.

    -

    By convention, the Swagger specification file is named swagger.json.

    -

    Data Types

    -

    Primitive data types in the Swagger Specification are based on the types supported by the JSON-Schema Draft 4. Models are described using the Schema Object which is a subset of JSON Schema Draft 4.

    -

    An additional primitive data type "file" is used by the Parameter Object and the Response Object to set the parameter type or the response as being a file.

    -

    Primitives have an optional modifier property format. Swagger uses several known formats to more finely define the data type being used. However, the format property is an open string-valued property, and can have any value to support documentation needs. Formats such as "email", "uuid", etc., can be used even though they are not defined by this specification. Types that are not accompanied by a format property follow their definition from the JSON Schema (except for file type which is defined above). The formats defined by the Swagger Specification are:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Common NametypeformatComments
    integerintegerint32signed 32 bits
    longintegerint64signed 64 bits
    floatnumberfloat
    doublenumberdouble
    stringstring
    bytestringbytebase64 encoded characters
    binarystringbinaryany sequence of octets
    booleanboolean
    datestringdateAs defined by full-date - [!rfc3339]
    dateTimestringdate-timeAs defined by date-time - [!rfc3339]
    passwordstringpasswordUsed to hint UIs the input needs to be obscured.
    -

    Schema

    -

    Swagger Object

    -

    This is the root document object for the API specification. It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    swaggerstringRequired. 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".
    infoInfo ObjectRequired. Provides metadata about the API. The metadata can be used by the clients if needed.
    hoststringThe 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.
    basePathstringThe 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.
    schemes[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.
    consumes[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.
    produces[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.
    pathsPaths ObjectRequired. The available paths and operations for the API.
    definitionsDefinitions ObjectAn object to hold data types produced and consumed by operations.
    parametersParameters Definitions ObjectAn object to hold parameters that can be used across operations. This property does not define global parameters for all operations.
    responsesResponses Definitions ObjectAn object to hold responses that can be used across operations. This property does not define global responses for all operations.
    securityDefinitionsSecurity Definitions ObjectSecurity scheme definitions that can be used across the specification.
    security[Security Requirement Object]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.
    tags[Tag Object]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.
    externalDocsExternal Documentation ObjectAdditional external documentation.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -

    Info Object

    -

    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.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    titlestringRequired. The title of the application.
    descriptionstringA short description of the application. GFM syntax can be used for rich text representation.
    termsOfServicestringThe Terms of Service for the API.
    contactContact ObjectThe contact information for the exposed API.
    licenseLicense ObjectThe license information for the exposed API.
    versionstringRequired Provides the version of the application API (not to be confused with the specification version).
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Info Object Example:
    -
    
    -{
    -  "title": "Swagger Sample App",
    -  "description": "This is a sample server Petstore server.",
    -  "termsOfService": "http://swagger.io/terms/",
    -  "contact": {
    -    "name": "API Support",
    -    "url": "http://www.swagger.io/support",
    -    "email": "support@swagger.io"
    -  },
    -  "license": {
    -    "name": "Apache 2.0",
    -    "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    -  },
    -  "version": "1.0.1"
    -}
    -
    -
    
    -title: Swagger Sample App
    -description: This is a sample server Petstore server.
    -termsOfService: http://swagger.io/terms/
    -contact:
    -  name: API Support
    -  url: http://www.swagger.io/support
    -  email: support@swagger.io
    -license:
    -  name: Apache 2.0
    -  url: http://www.apache.org/licenses/LICENSE-2.0.html
    -version: 1.0.1
    -
    -

    Contact Object

    -

    Contact information for the exposed API.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringThe identifying name of the contact person/organization.
    urlstringThe URL pointing to the contact information. MUST be in the format of a URL.
    emailstringThe email address of the contact person/organization. MUST be in the format of an email address.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Contact Object Example:
    -
    
    -{
    -  "name": "API Support",
    -  "url": "http://www.swagger.io/support",
    -  "email": "support@swagger.io"
    -}
    -
    -
    
    -name: API Support
    -url: http://www.swagger.io/support
    -email: support@swagger.io
    -
    -

    License Object

    -

    License information for the exposed API.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringRequired. The license name used for the API.
    urlstringA URL to the license used for the API. MUST be in the format of a URL.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    License Object Example:
    -
    
    -{
    -  "name": "Apache 2.0",
    -  "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    -}
    -
    -
    
    -name: Apache 2.0
    -url: http://www.apache.org/licenses/LICENSE-2.0.html
    -
    -

    Paths Object

    -

    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.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    /{path}Path Item ObjectA relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended to the basePath in order to construct the full URL. Path templating is allowed.
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Paths Object Example
    -
    
    -{
    -  "/pets": {
    -    "get": {
    -      "description": "Returns all pets from the system that the user has access to",
    -      "produces": [
    -        "application/json"
    -      ],
    -      "responses": {
    -        "200": {
    -          "description": "A list of pets.",
    -          "schema": {
    -            "type": "array",
    -            "items": {
    -              "$ref": "#/definitions/pet"
    -            }
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -/pets:
    -  get:
    -    description: Returns all pets from the system that the user has access to
    -    produces:
    -    - application/json
    -    responses:
    -      '200':
    -        description: A list of pets.
    -        schema:
    -          type: array
    -          items:
    -            $ref: '#/definitions/pet'
    -
    -

    Path Item Object

    -

    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.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    $refstringAllows 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.
    getOperation ObjectA definition of a GET operation on this path.
    putOperation ObjectA definition of a PUT operation on this path.
    postOperation ObjectA definition of a POST operation on this path.
    deleteOperation ObjectA definition of a DELETE operation on this path.
    optionsOperation ObjectA definition of a OPTIONS operation on this path.
    headOperation ObjectA definition of a HEAD operation on this path.
    patchOperation ObjectA definition of a PATCH operation on this path.
    parameters[Parameter Object | Reference Object]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.
    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Path Item Object Example
    -
    
    -{
    -  "get": {
    -    "description": "Returns pets based on ID",
    -    "summary": "Find pets by ID",
    -    "operationId": "getPetsById",
    -    "produces": [
    -      "application/json",
    -      "text/html"
    -    ],
    -    "responses": {
    -      "200": {
    -        "description": "pet response",
    -        "schema": {
    -          "type": "array",
    -          "items": {
    -            "$ref": "#/definitions/Pet"
    -          }
    -        }
    -      },
    -      "default": {
    -        "description": "error payload",
    -        "schema": {
    -          "$ref": "#/definitions/ErrorModel"
    -        }
    -      }
    -    }
    -  },
    -  "parameters": [
    -    {
    -      "name": "id",
    -      "in": "path",
    -      "description": "ID of pet to use",
    -      "required": true,
    -      "type": "array",
    -      "items": {
    -        "type": "string"
    -      },
    -      "collectionFormat": "csv"
    -    }
    -  ]
    -}
    -
    -
    
    -get:
    -  description: Returns pets based on ID
    -  summary: Find pets by ID
    -  operationId: getPetsById
    -  produces:
    -  - application/json
    -  - text/html
    -  responses:
    -    '200':
    -      description: pet response
    -      schema:
    -        type: array
    -        items:
    -          $ref: '#/definitions/Pet'
    -    default:
    -      description: error payload
    -      schema:
    -        $ref: '#/definitions/ErrorModel'
    -parameters:
    -- name: id
    -  in: path
    -  description: ID of pet to use
    -  required: true
    -  type: array
    -  items:
    -    type: string
    -  collectionFormat: csv
    -
    -

    Operation Object

    -

    Describes a single API operation on a path.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    tags[string]A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
    summarystringA short summary of what the operation does. For maximum readability in the swagger-ui, this field SHOULD be less than 120 characters.
    descriptionstringA verbose explanation of the operation behavior. GFM syntax can be used for rich text representation.
    externalDocsExternal Documentation ObjectAdditional external documentation for this operation.
    operationIdstringUnique 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.
    consumes[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.
    produces[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.
    parameters[Parameter Object | Reference Object]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.
    responsesResponses ObjectRequired. The list of possible responses as they are returned from executing this operation.
    schemes[string]The transfer protocol for the operation. Values MUST be from the list: "http", "https", "ws", "wss". The value overrides the Swagger Object schemes definition.
    deprecatedbooleanDeclares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is false.
    security[Security Requirement Object]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.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Operation Object Example
    -
    
    -{
    -  "tags": [
    -    "pet"
    -  ],
    -  "summary": "Updates a pet in the store with form data",
    -  "description": "",
    -  "operationId": "updatePetWithForm",
    -  "consumes": [
    -    "application/x-www-form-urlencoded"
    -  ],
    -  "produces": [
    -    "application/json",
    -    "application/xml"
    -  ],
    -  "parameters": [
    -    {
    -      "name": "petId",
    -      "in": "path",
    -      "description": "ID of pet that needs to be updated",
    -      "required": true,
    -      "type": "string"
    -    },
    -    {
    -      "name": "name",
    -      "in": "formData",
    -      "description": "Updated name of the pet",
    -      "required": false,
    -      "type": "string"
    -    },
    -    {
    -      "name": "status",
    -      "in": "formData",
    -      "description": "Updated status of the pet",
    -      "required": false,
    -      "type": "string"
    -    }
    -  ],
    -  "responses": {
    -    "200": {
    -      "description": "Pet updated."
    -    },
    -    "405": {
    -      "description": "Invalid input"
    -    }
    -  },
    -  "security": [
    -    {
    -      "petstore_auth": [
    -        "write:pets",
    -        "read:pets"
    -      ]
    -    }
    -  ]
    -}
    -
    -
    
    -tags:
    -- pet
    -summary: Updates a pet in the store with form data
    -description: ""
    -operationId: updatePetWithForm
    -consumes:
    -- application/x-www-form-urlencoded
    -produces:
    -- application/json
    -- application/xml
    -parameters:
    -- name: petId
    -  in: path
    -  description: ID of pet that needs to be updated
    -  required: true
    -  type: string
    -- name: name
    -  in: formData
    -  description: Updated name of the pet
    -  required: false
    -  type: string
    -- name: status
    -  in: formData
    -  description: Updated status of the pet
    -  required: false
    -  type: string
    -responses:
    -  '200':
    -    description: Pet updated.
    -  '405':
    -    description: Invalid input
    -security:
    -- petstore_auth:
    -  - write:pets
    -  - read:pets
    -
    -

    External Documentation Object

    -

    Allows referencing an external resource for extended documentation.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringA short description of the target documentation. GFM syntax can be used for rich text representation.
    urlstringRequired. The URL for the target documentation. Value MUST be in the format of a URL.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    External Documentation Object Example
    -
    
    -{
    -  "description": "Find more info here",
    -  "url": "https://swagger.io"
    -}
    -
    -
    
    -description: Find more info here
    -url: https://swagger.io
    -
    -

    Parameter Object

    -

    Describes a single operation parameter.

    -

    A unique parameter is defined by a combination of a name and location.

    -

    There are five possible parameter types.

    -
      -
    • Path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId.
    • -
    • Query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id.
    • -
    • Header - Custom headers that are expected as part of the request.
    • -
    • Body - The payload that’s appended to the HTTP request. Since there can only be one payload, there can only be one body parameter. The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation.
    • -
    • Form - Used to describe the payload of an HTTP request when either application/x-www-form-urlencoded, multipart/form-data or both are used as the content type of the request (in Swagger’s definition, the consumes property of an operation). This is the only parameter type that can be used to send files, thus supporting the file type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): -
        -
      • application/x-www-form-urlencoded - Similar to the format of Query parameters but as a payload. For example, foo=1&bar=swagger - both foo and bar are form parameters. This is normally used for simple parameters that are being transferred.
      • -
      • multipart/form-data - each parameter takes a section in the payload with an internal header. For example, for the header Content-Disposition: form-data; name="submit-name" the name of the parameter is submit-name. This type of form parameters is more commonly used for file transfers.
      • -
      -
    • -
    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringRequired. 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.
    instringRequired. The location of the parameter. Possible values are “query”, “header”, “path”, “formData” or “body”.
    descriptionstringA brief description of the parameter. This could contain examples of use. GFM syntax can be used for rich text representation.
    requiredbooleanDetermines 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.
    -

    If in is "body":

    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    schemaSchema ObjectRequired. The schema defining the type used for the body parameter.
    -

    If in is any value other than "body":

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    typestringRequired. 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".
    formatstringThe extending format for the previously mentioned type. See Data Type Formats for further details.
    allowEmptyValuebooleanSets 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.
    itemsItems ObjectRequired if type is “array”. Describes the type of items in the array.
    collectionFormatstringDetermines 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.
    default*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.
    maximumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
    exclusiveMaximumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
    minimumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
    exclusiveMinimumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
    maxLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1.
    minLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2.
    patternstringSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.
    maxItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2.
    minItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3.
    uniqueItemsbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4.
    enum[*]See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1.
    multipleOfnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1.
    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Parameter Object Examples
    -
    Body Parameters
    -

    A body parameter with a referenced schema definition (normally for a model definition):

    -
    
    -{
    -  "name": "user",
    -  "in": "body",
    -  "description": "user to add to the system",
    -  "required": true,
    -  "schema": {
    -    "$ref": "#/definitions/User"
    -  }
    -}
    -
    -
    
    -name: user
    -in: body
    -description: user to add to the system
    -required: true
    -schema:
    -  $ref: '#/definitions/User'
    -
    -

    A body parameter that is an array of string values:

    -
    
    -{
    -  "name": "user",
    -  "in": "body",
    -  "description": "user to add to the system",
    -  "required": true,
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    }
    -  }
    -}
    -
    -
    
    -name: user
    -in: body
    -description: user to add to the system
    -required: true
    -schema:
    -  type: array
    -  items:
    -    type: string
    -
    -
    Other Parameters
    -

    A header parameter with an array of 64 bit integer numbers:

    -
    
    -{
    -  "name": "token",
    -  "in": "header",
    -  "description": "token to be passed as a header",
    -  "required": true,
    -  "type": "array",
    -  "items": {
    -    "type": "integer",
    -    "format": "int64"
    -  },
    -  "collectionFormat": "csv"
    -}
    -
    -
    
    -name: token
    -in: header
    -description: token to be passed as a header
    -required: true
    -type: array
    -items:
    -  type: integer
    -  format: int64
    -collectionFormat: csv
    -
    -

    A path parameter of a string value:

    -
    
    -{
    -  "name": "username",
    -  "in": "path",
    -  "description": "username to fetch",
    -  "required": true,
    -  "type": "string"
    -}
    -
    -
    
    -name: username
    -in: path
    -description: username to fetch
    -required: true
    -type: string
    -
    -

    An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

    -
    
    -{
    -  "name": "id",
    -  "in": "query",
    -  "description": "ID of the object to fetch",
    -  "required": false,
    -  "type": "array",
    -  "items": {
    -    "type": "string"
    -  },
    -  "collectionFormat": "multi"
    -}
    -
    -
    
    -name: id
    -in: query
    -description: ID of the object to fetch
    -required: false
    -type: array
    -items:
    -  type: string
    -collectionFormat: multi
    -
    -

    A form data with file type for a file upload:

    -
    
    -{
    -  "name": "avatar",
    -  "in": "formData",
    -  "description": "The avatar of the user",
    -  "required": true,
    -  "type": "file"
    -}
    -
    -
    
    -name: avatar
    -in: formData
    -description: The avatar of the user
    -required: true
    -type: file
    -
    -
    Items Object
    -

    A limited subset of JSON-Schema’s items object. It is used by parameter definitions that are not located in "body".

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    typestringRequired. The internal type of the array. The value MUST be one of "string", "number", "integer", "boolean", or "array". Files and models are not allowed.
    formatstringThe extending format for the previously mentioned type. See Data Type Formats for further details.
    itemsItems ObjectRequired if type is “array”. Describes the type of items in the array.
    collectionFormatstringDetermines 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.
    Default value is csv.
    default*Declares the value of the item that the server will use if none is provided. (Note: “default” has no meaning for required items.) 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 the data type.
    maximumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
    exclusiveMaximumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
    minimumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
    exclusiveMinimumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
    maxLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1.
    minLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2.
    patternstringSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.
    maxItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2.
    minItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3.
    uniqueItemsbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4.
    enum[*]See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1.
    multipleOfnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Items Object Examples
    -

    Items must be of type string and have the minimum length of 2 characters:

    -
    
    -{
    -    "type": "string",
    -    "minLength": 2
    -}
    -
    -
    
    -type: string
    -minLength: 2
    -
    -

    An array of arrays, the internal array being of type integer, numbers must be between 0 and 63 (inclusive):

    -
    
    -{
    -    "type": "array",
    -    "items": {
    -        "type": "integer",
    -        "minimum": 0,
    -        "maximum": 63
    -    }
    -}
    -
    -
    
    -type: array
    -items:
    -  type: integer
    -  minimum: 0
    -  maximum: 63
    -
    -

    Responses Object

    -

    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 Responses Object MUST contain at least one response code, and it SHOULD be the response for a successful operation call.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    defaultResponse Object | Reference ObjectThe 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.
    -
    Patterned Fields
    - - - - - - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {HTTP Status Code}Response Object | Reference ObjectAny HTTP status code can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. Reference Object can be used to link to a response that is defined at the Swagger Object’s responses section.
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Responses Object Example
    -

    A 200 response for successful operation and a default response for others (implying an error):

    -
    
    -{
    -  "200": {
    -    "description": "a pet to be returned",
    -    "schema": {
    -      "$ref": "#/definitions/Pet"
    -    }
    -  },
    -  "default": {
    -    "description": "Unexpected error",
    -    "schema": {
    -      "$ref": "#/definitions/ErrorModel"
    -    }
    -  }
    -}
    -
    -
    
    -'200':
    -  description: a pet to be returned
    -  schema:
    -    $ref: '#/definitions/Pet'
    -default:
    -  description: Unexpected error
    -  schema:
    -    $ref: '#/definitions/ErrorModel'
    -
    -

    Response Object

    -Describes a single response from an API Operation. -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringRequired. A short description of the response. GFM syntax can be used for rich text representation.
    schemaSchema ObjectA 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 Schema Object, its root type value may also be "file". This SHOULD be accompanied by a relevant produces mime-type.
    headersHeaders ObjectA list of headers that are sent with the response.
    examplesExample ObjectAn example of the response message.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Response Object Examples
    -

    Response of an array of a complex type:

    -
    
    -{
    -  "description": "A complex object array response",
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "$ref": "#/definitions/VeryComplexType"
    -    }
    -  }
    -}
    -
    -
    
    -description: A complex object array response
    -schema:
    -  type: array
    -  items:
    -    $ref: '#/definitions/VeryComplexType'
    -
    -

    Response with a string type:

    -
    
    -{
    -  "description": "A simple string response",
    -  "schema": {
    -    "type": "string"
    -  }
    -}
    -
    -
    
    -description: A simple string response
    -schema:
    -  type: string
    -
    -

    Response with headers:

    -
    
    -{
    -  "description": "A simple string response",
    -  "schema": {
    -    "type": "string"
    -  },
    -  "headers": {
    -    "X-Rate-Limit-Limit": {
    -      "description": "The number of allowed requests in the current period",
    -      "type": "integer"
    -    },
    -    "X-Rate-Limit-Remaining": {
    -      "description": "The number of remaining requests in the current period",
    -      "type": "integer"
    -    },
    -    "X-Rate-Limit-Reset": {
    -      "description": "The number of seconds left in the current period",
    -      "type": "integer"
    -    }
    -  }
    -}
    -
    -
    
    -description: A simple string response
    -schema:
    -  type: string
    -headers:
    -  X-Rate-Limit-Limit:
    -    description: The number of allowed requests in the current period
    -    type: integer
    -  X-Rate-Limit-Remaining:
    -    description: The number of remaining requests in the current period
    -    type: integer
    -  X-Rate-Limit-Reset:
    -    description: The number of seconds left in the current period
    -    type: integer
    -
    -

    Response with no return value:

    -
    
    -{
    -  "description": "object created"
    -}
    -
    -
    
    -description: object created
    -
    -

    Headers Object

    -Lists the headers that can be sent as part of a response. -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}Header ObjectThe name of the property corresponds to the name of the header. The value describes the type of the header.
    -
    Headers Object Example
    -

    Rate-limit headers:

    -
    
    -{
    -    "X-Rate-Limit-Limit": {
    -        "description": "The number of allowed requests in the current period",
    -        "type": "integer"
    -    },
    -    "X-Rate-Limit-Remaining": {
    -        "description": "The number of remaining requests in the current period",
    -        "type": "integer"
    -    },
    -    "X-Rate-Limit-Reset": {
    -        "description": "The number of seconds left in the current period",
    -        "type": "integer"
    -    }
    -}
    -
    -
    
    -X-Rate-Limit-Limit:
    -  description: The number of allowed requests in the current period
    -  type: integer
    -X-Rate-Limit-Remaining:
    -  description: The number of remaining requests in the current period
    -  type: integer
    -X-Rate-Limit-Reset:
    -  description: The number of seconds left in the current period
    -  type: integer
    -
    -

    Example Object

    -

    Allows sharing examples for operation responses.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {mime type}AnyThe 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.
    -
    Example Object Example
    -

    Example response for application/json mimetype of a Pet data type:

    -
    
    -{
    -  "application/json": {
    -    "name": "Puma",
    -    "type": "Dog",
    -    "color": "Black",
    -    "gender": "Female",
    -    "breed": "Mixed"
    -  }
    -}
    -
    -
    
    -application/json:
    -  name: Puma
    -  type: Dog
    -  color: Black
    -  gender: Female
    -  breed: Mixed
    -
    -

    Header Object

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringA short description of the header.
    typestringRequired. The type of the object. The value MUST be one of "string", "number", "integer", "boolean", or "array".
    formatstringThe extending format for the previously mentioned type. See Data Type Formats for further details.
    itemsItems ObjectRequired if type is “array”. Describes the type of items in the array.
    collectionFormatstringDetermines 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.
    Default value is csv.
    default*Declares the value of the header that the server will use if none is provided. (Note: “default” has no meaning for required headers.) 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 the header.
    maximumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
    exclusiveMaximumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
    minimumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
    exclusiveMinimumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
    maxLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1.
    minLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2.
    patternstringSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.
    maxItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2.
    minItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3.
    uniqueItemsbooleanhttps://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4.
    enum[*]See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1.
    multipleOfnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Header Object Example
    -

    A simple header with of an integer type:

    -
    
    -{
    -  "description": "The number of allowed requests in the current period",
    -  "type": "integer"
    -}
    -
    -
    
    -description: The number of allowed requests in the current period
    -type: integer
    -
    -

    Tag Object

    -

    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.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringRequired. The name of the tag.
    descriptionstringA short description for the tag. GFM syntax can be used for rich text representation.
    externalDocsExternal Documentation ObjectAdditional external documentation for this tag.
    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Tag Object Example
    -
    
    -{
    -	"name": "pet",
    -	"description": "Pets operations"
    -}
    -
    -
    
    -name: pet
    -description: Pets operations
    -
    -

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

    -
    Fixed Fields
    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    $refstringRequired. The reference string.
    -
    Reference Object Example
    -
    
    -{
    -	"$ref": "#/definitions/Pet"
    -}
    -
    -
    
    -$ref: '#/definitions/Pet'
    -
    -
    Relative Schema File Example
    -
    
    -{
    -  "$ref": "Pet.json"
    -}
    -
    -
    
    -$ref: 'Pet.yaml'
    -
    -
    Relative Files With Embedded Schema Example
    -
    
    -{
    -  "$ref": "definitions.json#/Pet"
    -}
    -
    -
    
    -$ref: 'definitions.yaml#/Pet'
    -
    -

    Schema Object

    -

    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.

    -

    Further information about the properties can be found in JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here.

    -

    The following properties are taken directly from the JSON Schema definition and follow the same specifications:

    -
      -
    • $ref - As a JSON Reference
    • -
    • format (See Data Type Formats for further details)
    • -
    • title
    • -
    • description (GFM syntax can be used for rich text representation)
    • -
    • default (Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object)
    • -
    • multipleOf
    • -
    • maximum
    • -
    • exclusiveMaximum
    • -
    • minimum
    • -
    • exclusiveMinimum
    • -
    • maxLength
    • -
    • minLength
    • -
    • pattern
    • -
    • maxItems
    • -
    • minItems
    • -
    • uniqueItems
    • -
    • maxProperties
    • -
    • minProperties
    • -
    • required
    • -
    • enum
    • -
    • type
    • -
    -

    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.

    -
      -
    • items
    • -
    • allOf
    • -
    • properties
    • -
    • additionalProperties
    • -
    -

    Other than the JSON Schema subset fields, the following fields may be used for further schema documentation.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    discriminatorstringAdds 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.
    readOnlybooleanRelevant 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.
    xmlXML ObjectThis 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.
    externalDocsExternal Documentation ObjectAdditional external documentation for this schema.
    exampleAnyA free-form property to include an example of an instance for this schema.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Composition and Inheritance (Polymorphism)
    -

    Swagger allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. allOf takes in an array of object definitions that are validated independently but together compose a single object.

    -

    While composition offers model extensibility, it does not imply a hierarchy between the models. To support polymorphism, Swagger adds the support of the discriminator field. When used, the discriminator will be the name of the property used to decide which schema definition is used to validate the structure of the model. As such, the discriminator field MUST be a required field. The value of the chosen property has to be the friendly name given to the model under the definitions property. As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism.

    -
    XML Modeling
    -

    The xml property allows extra definitions when translating the JSON definition to XML. The XML Object contains additional information about the available options.

    -
    Schema Object Examples
    -
    Primitive Sample
    -

    Unlike previous versions of Swagger, Schema definitions can be used to describe primitive and arrays as well.

    -
    
    -{
    -    "type": "string",
    -    "format": "email"
    -}
    -
    -
    
    -type: string
    -format: email
    -
    -
    Simple Model
    -
    
    -{
    -  "type": "object",
    -  "required": [
    -    "name"
    -  ],
    -  "properties": {
    -    "name": {
    -      "type": "string"
    -    },
    -    "address": {
    -      "$ref": "#/definitions/Address"
    -    },
    -    "age": {
    -      "type": "integer",
    -      "format": "int32",
    -      "minimum": 0
    -    }
    -  }
    -}
    -
    -
    
    -type: object
    -required:
    -- name
    -properties:
    -  name:
    -    type: string
    -  address:
    -    $ref: '#/definitions/Address'
    -  age:
    -    type: integer
    -    format: int32
    -    minimum: 0
    -
    -
    Model with Map/Dictionary Properties
    -

    For a simple string to string mapping:

    -
    
    -{
    -  "type": "object",
    -  "additionalProperties": {
    -    "type": "string"
    -  }
    -}
    -
    -
    
    -type: object
    -additionalProperties:
    -  type: string
    -
    -

    For a string to model mapping:

    -
    
    -{
    -  "type": "object",
    -  "additionalProperties": {
    -    "$ref": "#/definitions/ComplexModel"
    -  }
    -}
    -
    -
    
    -type: object
    -additionalProperties:
    -  $ref: '#/definitions/ComplexModel'
    -
    -
    Model with Example
    -
    
    -{
    -  "type": "object",
    -  "properties": {
    -    "id": {
    -      "type": "integer",
    -      "format": "int64"
    -    },
    -    "name": {
    -      "type": "string"
    -    }
    -  },
    -  "required": [
    -    "name"
    -  ],
    -  "example": {
    -    "name": "Puma",
    -    "id": 1
    -  }
    -}
    -
    -
    
    -type: object
    -properties:
    -  id:
    -    type: integer
    -    format: int64
    -  name:
    -    type: string
    -required:
    -- name
    -example:
    -  name: Puma
    -  id: 1
    -
    -
    Models with Composition
    -
    
    -{
    -  "definitions": {
    -    "ErrorModel": {
    -      "type": "object",
    -      "required": [
    -        "message",
    -        "code"
    -      ],
    -      "properties": {
    -        "message": {
    -          "type": "string"
    -        },
    -        "code": {
    -          "type": "integer",
    -          "minimum": 100,
    -          "maximum": 600
    -        }
    -      }
    -    },
    -    "ExtendedErrorModel": {
    -      "allOf": [
    -        {
    -          "$ref": "#/definitions/ErrorModel"
    -        },
    -        {
    -          "type": "object",
    -          "required": [
    -            "rootCause"
    -          ],
    -          "properties": {
    -            "rootCause": {
    -              "type": "string"
    -            }
    -          }
    -        }
    -      ]
    -    }
    -  }
    -}
    -
    -
    
    -definitions:
    -  ErrorModel:
    -    type: object
    -    required:
    -    - message
    -    - code
    -    properties:
    -      message:
    -        type: string
    -      code:
    -        type: integer
    -        minimum: 100
    -        maximum: 600
    -  ExtendedErrorModel:
    -    allOf:
    -    - $ref: '#/definitions/ErrorModel'
    -    - type: object
    -      required:
    -      - rootCause
    -      properties:
    -        rootCause:
    -          type: string
    -
    -
    Models with Polymorphism Support
    -
    
    -{
    -  "definitions": {
    -    "Pet": {
    -      "type": "object",
    -      "discriminator": "petType",
    -      "properties": {
    -        "name": {
    -          "type": "string"
    -        },
    -        "petType": {
    -          "type": "string"
    -        }
    -      },
    -      "required": [
    -        "name",
    -        "petType"
    -      ]
    -    },
    -    "Cat": {
    -      "description": "A representation of a cat",
    -      "allOf": [
    -        {
    -          "$ref": "#/definitions/Pet"
    -        },
    -        {
    -          "type": "object",
    -          "properties": {
    -            "huntingSkill": {
    -              "type": "string",
    -              "description": "The measured skill for hunting",
    -              "default": "lazy",
    -              "enum": [
    -                "clueless",
    -                "lazy",
    -                "adventurous",
    -                "aggressive"
    -              ]
    -            }
    -          },
    -          "required": [
    -            "huntingSkill"
    -          ]
    -        }
    -      ]
    -    },
    -    "Dog": {
    -      "description": "A representation of a dog",
    -      "allOf": [
    -        {
    -          "$ref": "#/definitions/Pet"
    -        },
    -        {
    -          "type": "object",
    -          "properties": {
    -            "packSize": {
    -              "type": "integer",
    -              "format": "int32",
    -              "description": "the size of the pack the dog is from",
    -              "default": 0,
    -              "minimum": 0
    -            }
    -          },
    -          "required": [
    -            "packSize"
    -          ]
    -        }
    -      ]
    -    }
    -  }
    -}
    -
    -
    
    -definitions:
    -  Pet:
    -    type: object
    -    discriminator: petType
    -    properties:
    -      name:
    -        type: string
    -      petType:
    -        type: string
    -    required:
    -    - name
    -    - petType
    -  Cat:
    -    description: A representation of a cat
    -    allOf:
    -    - $ref: '#/definitions/Pet'
    -    - type: object
    -      properties:
    -        huntingSkill:
    -          type: string
    -          description: The measured skill for hunting
    -          default: lazy
    -          enum:
    -          - clueless
    -          - lazy
    -          - adventurous
    -          - aggressive
    -      required:
    -      - huntingSkill
    -  Dog:
    -    description: A representation of a dog
    -    allOf:
    -    - $ref: '#/definitions/Pet'
    -    - type: object
    -      properties:
    -        packSize:
    -          type: integer
    -          format: int32
    -          description: the size of the pack the dog is from
    -          default: 0
    -          minimum: 0
    -      required:
    -      - packSize
    -
    -
    XML Object
    -

    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.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringReplaces 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.
    namespacestringThe URL of the namespace definition. Value SHOULD be in the form of a URL.
    prefixstringThe prefix to be used for the name.
    attributebooleanDeclares whether the property definition translates to an attribute instead of an element. Default value is false.
    wrappedbooleanMAY 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).
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    XML Object Examples
    -

    The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

    -
    No XML Element
    -

    Basic string property:

    -
    
    -{
    -    "animals": {
    -        "type": "string"
    -    }
    -}
    -
    -
    
    -animals:
    -  type: string
    -
    -
    
    -<animals>...</animals>
    -
    -

    Basic string array property (wrapped is false by default):

    -
    
    -{
    -    "animals": {
    -        "type": "array",
    -        "items": {
    -            "type": "string"
    -        }
    -    }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -
    -
    
    -<animals>...</animals>
    -<animals>...</animals>
    -<animals>...</animals>
    -
    -
    XML Name Replacement
    -
    
    -{
    -  "animals": {
    -    "type": "string",
    -    "xml": {
    -      "name": "animal"
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: string
    -  xml:
    -    name: animal
    -
    -
    
    -<animal>...</animal>
    -
    -
    XML Attribute, Prefix and Namespace
    -

    In this example, a full model definition is shown.

    -
    
    -{
    -  "Person": {
    -    "type": "object",
    -    "properties": {
    -      "id": {
    -        "type": "integer",
    -        "format": "int32",
    -        "xml": {
    -          "attribute": true
    -        }
    -      },
    -      "name": {
    -        "type": "string",
    -        "xml": {
    -          "namespace": "http://swagger.io/schema/sample",
    -          "prefix": "sample"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -Person:
    -  type: object
    -  properties:
    -    id:
    -      type: integer
    -      format: int32
    -      xml:
    -        attribute: true
    -    name:
    -      type: string
    -      xml:
    -        namespace: http://swagger.io/schema/sample
    -        prefix: sample
    -
    -
    
    -<Person id="123">
    -    <sample:name xmlns:sample="http://swagger.io/schema/sample">example</sample:name>
    -</Person>
    -
    -
    XML Arrays
    -

    Changing the element names:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -
    -
    
    -<animal>value</animal>
    -<animal>value</animal>
    -
    -

    The external name property has no effect on the XML:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens"
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -
    -
    
    -<animal>value</animal>
    -<animal>value</animal>
    -
    -

    Even when the array is wrapped, if no name is explicitly defined, the same name will be used both internally and externally:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    wrapped: true
    -
    -
    
    -<animals>
    -  <animals>value</animals>
    -  <animals>value</animals>
    -</animals>
    -
    -

    To overcome the above example, the following definition can be used:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    wrapped: true
    -
    -
    
    -<animals>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</animals>
    -
    -

    Affecting both internal and external names:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    
    -<aliens>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</aliens>
    -
    -

    If we change the external element but not the internal ones:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    
    -<aliens>
    -  <aliens>value</aliens>
    -  <aliens>value</aliens>
    -</aliens>
    -
    -
    Definitions Object
    -

    An object to hold data types that can be consumed and produced by operations. These data types can be primitives, arrays or models.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}Schema ObjectA single definition, mapping a “name” to the schema it defines.
    -
    Definitions Object Example
    -
    
    -{
    -  "Category": {
    -    "type": "object",
    -    "properties": {
    -      "id": {
    -        "type": "integer",
    -        "format": "int64"
    -      },
    -      "name": {
    -        "type": "string"
    -      }
    -    }
    -  },
    -  "Tag": {
    -    "type": "object",
    -    "properties": {
    -      "id": {
    -        "type": "integer",
    -        "format": "int64"
    -      },
    -      "name": {
    -        "type": "string"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -Category:
    -  type: object
    -  properties:
    -    id:
    -      type: integer
    -      format: int64
    -    name:
    -      type: string
    -Tag:
    -  type: object
    -  properties:
    -    id:
    -      type: integer
    -      format: int64
    -    name:
    -      type: string
    -
    -

    Parameters Definitions Object

    -

    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.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}Parameter ObjectA single parameter definition, mapping a “name” to the parameter it defines.
    -
    Parameters Definition Object Example
    -
    
    -{
    -  "skipParam": {
    -    "name": "skip",
    -    "in": "query",
    -    "description": "number of items to skip",
    -    "required": true,
    -    "type": "integer",
    -    "format": "int32"
    -  },
    -  "limitParam": {
    -    "name": "limit",
    -    "in": "query",
    -    "description": "max records to return",
    -    "required": true,
    -    "type": "integer",
    -    "format": "int32"
    -  }
    -}
    -
    -
    
    -skipParam:
    -  name: skip
    -  in: query
    -  description: number of items to skip
    -  required: true
    -  type: integer
    -  format: int32
    -limitParam:
    -  name: limit
    -  in: query
    -  description: max records to return
    -  required: true
    -  type: integer
    -  format: int32
    -
    -

    Responses Definitions Object

    -

    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.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}Response ObjectA single response definition, mapping a “name” to the response it defines.
    -
    Responses Definitions Object Example
    -
    
    -{
    -  "NotFound": {
    -    "description": "Entity not found."
    -  },
    -  "IllegalInput": {
    -  	"description": "Illegal input for operation."
    -  },
    -  "GeneralError": {
    -  	"description": "General Error",
    -  	"schema": {
    -  		"$ref": "#/definitions/GeneralError"
    -  	}
    -  }
    -}
    -
    -
    
    -NotFound:
    -  description: Entity not found.
    -IllegalInput:
    -  description: Illegal input for operation.
    -GeneralError:
    -  description: General Error
    -  schema:
    -    $ref: '#/definitions/GeneralError'
    -
    -

    Security Definitions Object

    -

    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.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}Security Scheme ObjectA single security scheme definition, mapping a “name” to the scheme it defines.
    -
    Security Definitions Object Example
    -
    
    -{
    -  "api_key": {
    -    "type": "apiKey",
    -    "name": "api_key",
    -    "in": "header"
    -  },
    -  "petstore_auth": {
    -    "type": "oauth2",
    -    "authorizationUrl": "http://swagger.io/api/oauth/dialog",
    -    "flow": "implicit",
    -    "scopes": {
    -      "write:pets": "modify pets in your account",
    -      "read:pets": "read your pets"
    -    }
    -  }
    -}
    -
    -
    
    -api_key:
    -  type: apiKey
    -  name: api_key
    -  in: header
    -petstore_auth:
    -  type: oauth2
    -  authorizationUrl: http://swagger.io/api/oauth/dialog
    -  flow: implicit
    -  scopes:
    -    write:pets: modify pets in your account
    -    read:pets: read your pets
    -
    -

    Security Scheme Object

    -

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

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeValidityDescription
    typestringAnyRequired. The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".
    descriptionstringAnyA short description for security scheme.
    namestringapiKeyRequired. The name of the header or query parameter to be used.
    instringapiKeyRequired The location of the API key. Valid values are "query" or "header".
    flowstringoauth2Required. The flow used by the OAuth2 security scheme. Valid values are "implicit", "password", "application" or "accessCode".
    authorizationUrlstringoauth2 ("implicit", "accessCode")Required. The authorization URL to be used for this flow. This SHOULD be in the form of a URL.
    tokenUrlstringoauth2 ("password", "application", "accessCode")Required. The token URL to be used for this flow. This SHOULD be in the form of a URL.
    scopesScopes Objectoauth2Required. The available scopes for the OAuth2 security scheme.
    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Security Scheme Object Example
    -
    Basic Authentication Sample
    -
    
    -{
    -  "type": "basic"
    -}
    -
    -
    
    -type: basic
    -
    -
    API Key Sample
    -
    
    -{
    -  "type": "apiKey",
    -  "name": "api_key",
    -  "in": "header"
    -}
    -
    -
    
    -type: apiKey
    -name: api_key
    -in: header
    -
    -
    Implicit OAuth2 Sample
    -
    
    -{
    -  "type": "oauth2",
    -  "authorizationUrl": "http://swagger.io/api/oauth/dialog",
    -  "flow": "implicit",
    -  "scopes": {
    -    "write:pets": "modify pets in your account",
    -    "read:pets": "read your pets"
    -  }
    -}
    -
    -
    
    -type: oauth2
    -authorizationUrl: http://swagger.io/api/oauth/dialog
    -flow: implicit
    -scopes:
    -  write:pets: modify pets in your account
    -  read:pets: read your pets
    -
    -
    Scopes Object
    -

    Lists the available scopes for an OAuth2 security scheme.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}stringMaps between a name of a scope to a short description of it (as the value of the property).
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Scopes Object Example
    -
    
    -{
    -  "write:pets": "modify pets in your account",
    -  "read:pets": "read your pets"
    -}
    -
    -
    
    -write:pets: modify pets in your account
    -read:pets: read your pets
    -
    -

    Security Requirement Object

    -

    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.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}[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.
    -
    Security Requirement Object Examples
    -
    Non-OAuth2 Security Requirement
    -
    
    -{
    -  "api_key": []
    -}
    -
    -
    
    -api_key: []
    -
    -
    OAuth2 Security Requirement
    -
    
    -{
    -  "petstore_auth": [
    -    "write:pets",
    -    "read:pets"
    -  ]
    -}
    -
    -
    
    -petstore_auth:
    -- write:pets
    -- read:pets
    -
    -
    Specification Extensions
    -

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

    -
    Security Filtering
    -

    Some objects in the Swagger specification may be declared and remain empty, or completely be removed, even though they are inherently the core of the API documentation.

    -

    The reasoning behind it is to allow an additional layer of access control over the documentation itself. While not part of the specification itself, certain libraries may choose to allow access to parts of the documentation based on some form of authentication/authorization.

    -

    Two examples for this:

    -
      -
    1. The Paths Object may be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication.
    2. -
    3. The Path Item Object may be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object so the user will not be aware of its existence. This allows the documentation provider a finer control over what the viewer can see.
    4. -
    - diff --git a/bikeshed/v2/oas_2.0.err b/bikeshed/v2/oas_2.0.err deleted file mode 100644 index d8e2c96a77..0000000000 --- a/bikeshed/v2/oas_2.0.err +++ /dev/null @@ -1,535 +0,0 @@ -Error running preprocessor, returned code: 1. -\033[1;96mWARNING:\033[0m You should manually provide IDs for your headings: - <h5 class="heading" data-level="5.4.18.8" id="definitions-object"><span class="content"><a id="definitionsObject">Definitions Object</a></span></h5> - <h5 class="heading" data-level="5.4.11.2" id="patterned-fields"><span class="content">Patterned Fields</span></h5> - <h6 class="heading" data-level="5.4.18.3.2" id="simple-model"><span class="content">Simple Model</span></h6> - <h5 class="heading" data-level="5.4.7.1" id="fixed-fields"><span class="content">Fixed Fields</span></h5> - <h5 class="heading" data-level="5.4.23.3" id="specification-extensions"><span class="content"><a id="vendorExtensions">Specification Extensions</a></span></h5> - <h5 class="heading" data-level="5.4.10.3" id="parameter-object-examples"><span class="content">Parameter Object Examples</span></h5> - <h5 class="heading" data-level="5.4.3.3" id="info-object-example"><span class="content">Info Object Example:</span></h5> - <h5 class="heading" data-level="5.4.17.3" id="relative-schema-file-example"><span class="content">Relative Schema File Example</span></h5> - <h6 class="heading" data-level="5.4.10.3.1" id="body-parameters"><span class="content">Body Parameters</span></h6> - <h5 class="heading" data-level="5.4.12.2" id="patterned-objects"><span class="content">Patterned Objects</span></h5> - <h5 class="heading" data-level="5.4.17.1" id="fixed-fields"><span class="content">Fixed Fields</span></h5> - <h5 class="heading" data-level="5.4.3.2" id="patterned-objects"><span class="content">Patterned Objects</span></h5> - <h5 class="heading" data-level="5.4.18.2" id="patterned-objects"><span class="content">Patterned Objects</span></h5> - <h6 class="heading" data-level="5.4.22.3.2" id="api-key-sample"><span class="content">API Key Sample</span></h6> - <h4 class="heading" data-level="5.4.6" id="paths-object"><span class="content"><a id="pathsObject">Paths Object</a></span></h4> - <h5 class="heading" data-level="5.4.20.2" id="responses-definitions-object-example"><span class="content">Responses Definitions Object Example</span></h5> - <h4 class="heading" data-level="5.4.22" id="security-scheme-object"><span class="content"><a id="securitySchemeObject">Security Scheme Object</a></span></h4> - <h4 class="heading" data-level="5.4.23" id="security-requirement-object"><span class="content"><a id="securityRequirementObject">Security Requirement Object</a></span></h4> - <h6 class="heading" data-level="5.4.10.3.2" id="other-parameters"><span class="content">Other Parameters</span></h6> - <h5 class="heading" data-level="5.4.4.2" id="patterned-objects"><span class="content">Patterned Objects</span></h5> - <h5 class="heading" data-level="5.4.21.1" id="patterned-fields"><span class="content">Patterned Fields</span></h5> - <h5 class="heading" data-level="5.4.6.1" id="patterned-fields"><span class="content">Patterned Fields</span></h5> - <h5 class="heading" data-level="5.4.22.1" id="fixed-fields"><span class="content">Fixed Fields</span></h5> - <h5 class="heading" data-level="5.4.17.4" id="relative-files-with-embedded-schema-example"><span class="content">Relative Files With Embedded Schema Example</span></h5> - <h5 class="heading" data-level="5.4.18.1" id="fixed-fields"><span class="content">Fixed Fields</span></h5> - <h5 class="heading" data-level="5.4.17.2" id="reference-object-example"><span class="content">Reference Object Example</span></h5> - <h5 class="heading" data-level="5.4.13.2" id="headers-object-example"><span class="content">Headers Object Example</span></h5> - <h4 class="heading" data-level="5.4.20" id="responses-definitions-object"><span class="content"><a id="responsesDefinitionsObject">Responses Definitions Object</a></span></h4> - <h4 class="heading" data-level="5.4.10" id="parameter-object"><span class="content"><a id="parameterObject">Parameter Object</a></span></h4> - <h5 class="heading" data-level="5.4.18.7" id="xml-object-examples"><span class="content">XML Object Examples</span></h5> - <h5 class="heading" data-level="5.4.23.1" id="patterned-fields"><span class="content">Patterned Fields</span></h5> - <h2 class="heading" data-level="1" id="-fka-swagger-restful-api-documentation-specification"><span class="content">(fka Swagger RESTful API Documentation Specification)</span></h2> - <h5 class="heading" data-level="5.4.10.2" id="patterned-fields"><span class="content">Patterned Fields</span></h5> - <h5 class="heading" data-level="5.4.5.1" id="fixed-fields"><span class="content">Fixed Fields</span></h5> - <h3 class="heading" data-level="1.1" id="version-20"><span class="content">Version 2.0</span></h3> - <h5 class="heading" data-level="5.4.10.7" id="items-object-examples"><span class="content">Items Object Examples</span></h5> - <h6 class="heading" data-level="5.4.18.7.1" id="no-xml-element"><span class="content">No XML Element</span></h6> - <h5 class="heading" data-level="5.4.3.1" id="fixed-fields"><span class="content">Fixed Fields</span></h5> - <h5 class="heading" data-level="5.4.2.1" id="patterned-objects"><span class="content">Patterned Objects</span></h5> - <h4 class="heading" data-level="5.4.9" id="external-documentation-object"><span class="content"><a id="externalDocumentationObject">External Documentation Object</a></span></h4> - <h5 class="heading" data-level="5.4.16.2" id="patterned-fields"><span class="content">Patterned Fields</span></h5> - <h4 class="heading" data-level="5.4.5" id="license-object"><span class="content"><a id="licenseObject">License Object</a></span></h4> - <h2 class="heading" data-level="2" id="introductions"><span class="content">Introductions</span></h2> - <h5 class="heading" data-level="5.4.12.3" id="response-object-examples"><span class="content">Response Object Examples</span></h5> - <h5 class="heading" data-level="5.4.9.1" id="fixed-fields"><span class="content">Fixed Fields</span></h5> - <h5 class="heading" data-level="5.4.18.10" id="definitions-object-example"><span class="content">Definitions Object Example</span></h5> - <h5 class="heading" data-level="5.4.8.2" id="patterned-objects"><span class="content">Patterned Objects</span></h5> - <h4 class="heading" data-level="5.4.14" id="example-object"><span class="content"><a id="exampleObject">Example Object</a></span></h4> - <h4 class="heading" data-level="5.4.13" id="headers-object"><span class="content"><a id="headersObject">Headers Object</a></span></h4> - <h5 class="heading" data-level="5.4.10.4" id="items-object"><span class="content"><a id="itemsObject">Items Object</a></span></h5> - <h2 class="heading" data-level="3" id="revision-history"><span class="content">Revision History</span></h2> - <h6 class="heading" data-level="5.4.18.2.1" id="composition-and-inheritance-polymorphism"><span class="content">Composition and Inheritance (Polymorphism)</span></h6> - <h5 class="heading" data-level="5.4.22.4" id="scopes-object"><span class="content"><a id="scopesObject">Scopes Object</a></span></h5> - <h6 class="heading" data-level="5.4.22.3.3" id="implicit-oauth2-sample"><span class="content">Implicit OAuth2 Sample</span></h6> - <h5 class="heading" data-level="5.4.15.1" id="patterned-objects"><span class="content">Patterned Objects</span></h5> - <h4 class="heading" data-level="5.4.7" id="path-item-object"><span class="content"><a id="pathItemObject">Path Item Object</a></span></h4> - <h5 class="heading" data-level="5.4.4.3" id="contact-object-example"><span class="content">Contact Object Example:</span></h5> - <h5 class="heading" data-level="5.4.13.1" id="patterned-fields"><span class="content">Patterned Fields</span></h5> - <h5 class="heading" data-level="5.4.22.7" id="scopes-object-example"><span class="content">Scopes Object Example</span></h5> - <h5 class="heading" data-level="5.4.10.6" id="patterned-objects"><span class="content">Patterned Objects</span></h5> - <h5 class="heading" data-level="5.4.14.1" id="patterned-fields"><span class="content">Patterned Fields</span></h5> - <h3 class="heading" data-level="5.4" id="schema"><span class="content">Schema</span></h3> - <h4 class="heading" data-level="5.4.18" id="schema-object"><span class="content"><a id="schemaObject">Schema Object</a></span></h4> - <h4 class="heading" data-level="5.4.1" id="swagger-object"><span class="content"><a id="swaggerObject">Swagger Object</a></span></h4> - <h5 class="heading" data-level="5.4.10.5" id="fixed-fields"><span class="content">Fixed Fields</span></h5> - <h3 class="heading" data-level="5.1" id="format"><span class="content">Format</span></h3> - <h4 class="heading" data-level="5.4.8" id="operation-object"><span class="content"><a id="operationObject">Operation Object</a></span></h4> - <h4 class="heading" data-level="5.4.11" id="responses-object"><span class="content"><a id="responsesObject">Responses Object</a></span></h4> - <h5 class="heading" data-level="5.4.18.4" id="xml-object"><span class="content"><a id="xmlObject">XML Object</a></span></h5> - <h4 class="heading" data-level="5.4.2" id="fixed-fields"><span class="content">Fixed Fields</span></h4> - <h5 class="heading" data-level="5.4.11.3" id="responses-object-example"><span class="content">Responses Object Example</span></h5> - <h5 class="heading" data-level="5.4.8.1" id="fixed-fields"><span class="content">Fixed Fields</span></h5> - <h5 class="heading" data-level="5.4.22.2" id="patterned-fields"><span class="content">Patterned Fields</span></h5> - <h5 class="heading" data-level="5.4.23.2" id="security-requirement-object-examples"><span class="content">Security Requirement Object Examples</span></h5> - <h6 class="heading" data-level="5.4.23.2.1" id="non-oauth2-security-requirement"><span class="content">Non-OAuth2 Security Requirement</span></h6> - <h4 class="heading" data-level="5.4.3" id="info-object"><span class="content"><a id="infoObject">Info Object</a></span></h4> - <h5 class="heading" data-level="5.4.7.2" id="patterned-fields"><span class="content">Patterned Fields</span></h5> - <h4 class="heading" data-level="5.4.19" id="parameters-definitions-object"><span class="content"><a id="parametersDefinitionsObject">Parameters Definitions Object</a></span></h4> - <h5 class="heading" data-level="5.4.6.2" id="paths-object-example"><span class="content">Paths Object Example</span></h5> - <h5 class="heading" data-level="5.4.5.2" id="patterned-objects"><span class="content">Patterned Objects</span></h5> - <h5 class="heading" data-level="5.4.15.2" id="header-object-example"><span class="content">Header Object Example</span></h5> - <h5 class="heading" data-level="5.4.22.5" id="patterned-fields"><span class="content">Patterned Fields</span></h5> - <h6 class="heading" data-level="5.4.18.3.6" id="models-with-polymorphism-support"><span class="content">Models with Polymorphism Support</span></h6> - <h6 class="heading" data-level="5.4.18.2.2" id="xml-modeling"><span class="content">XML Modeling</span></h6> - <h5 class="heading" data-level="5.4.18.9" id="patterned-fields"><span class="content">Patterned Fields</span></h5> - <h5 class="heading" data-level="5.4.21.2" id="security-definitions-object-example"><span class="content">Security Definitions Object Example</span></h5> - <h6 class="heading" data-level="5.4.18.3.4" id="model-with-example"><span class="content">Model with Example</span></h6> - <h5 class="heading" data-level="5.4.11.1" id="fixed-fields"><span class="content">Fixed Fields</span></h5> - <h3 class="heading" data-level="5.2" id="file-structure"><span class="content">File Structure</span></h3> - <h5 class="heading" data-level="5.4.16.3" id="tag-object-example"><span class="content">Tag Object Example</span></h5> - <h4 class="heading" data-level="5.4.16" id="tag-object"><span class="content"><a id="tagObject">Tag Object</a></span></h4> - <h6 class="heading" data-level="5.4.18.7.3" id="xml-attribute-prefix-and-namespace"><span class="content">XML Attribute, Prefix and Namespace</span></h6> - <h5 class="heading" data-level="5.4.19.1" id="patterned-fields"><span class="content">Patterned Fields</span></h5> - <h5 class="heading" data-level="5.4.18.3" id="schema-object-examples"><span class="content">Schema Object Examples</span></h5> - <h4 class="heading" data-level="5.4.4" id="contact-object"><span class="content"><a id="contactObject">Contact Object</a></span></h4> - <h5 class="heading" data-level="5.4.14.2" id="example-object-example"><span class="content">Example Object Example</span></h5> - <h5 class="heading" data-level="5.4.9.2" id="patterned-objects"><span class="content">Patterned Objects</span></h5> - <h5 class="heading" data-level="5.4.23.4" id="security-filtering"><span class="content"><a id="securityFiltering">Security Filtering</a></span></h5> - <h6 class="heading" data-level="5.4.18.3.1" id="primitive-sample"><span class="content">Primitive Sample</span></h6> - <h6 class="heading" data-level="5.4.23.2.2" id="oauth2-security-requirement"><span class="content">OAuth2 Security Requirement</span></h6> - <h4 class="heading" data-level="5.4.12" id="response-object"><span class="content"><a id="responseObject">Response Object</a></span></h4> - <h5 class="heading" data-level="5.4.4.1" id="fixed-fields"><span class="content">Fixed Fields</span></h5> - <h3 class="heading" data-level="5.3" id="data-types"><span class="content">Data Types</span></h3> - <h5 class="heading" data-level="5.4.16.1" id="fixed-fields"><span class="content">Fixed Fields</span></h5> - <h2 class="heading" data-level="4" id="definitions"><span class="content">Definitions</span></h2> - <h5 class="heading" data-level="5.4.10.1" id="fixed-fields"><span class="content">Fixed Fields</span></h5> - <h6 class="heading" data-level="5.4.18.3.5" id="models-with-composition"><span class="content">Models with Composition</span></h6> - <h3 class="heading" data-level="4.1" id="path-templating"><span class="content"><a id="pathTemplating"><dfn>Path Templating</dfn></a></span></h3> - <h5 class="heading" data-level="5.4.12.1" id="fixed-fields"><span class="content">Fixed Fields</span></h5> - <h4 class="heading" data-level="5.4.15" id="header-object"><span class="content"><a id="headerObject">Header Object</a></span></h4> - <h4 class="heading" data-level="5.4.21" id="security-definitions-object"><span class="content"><a id="securityDefinitionsObject">Security Definitions Object</a></span></h4> - <h6 class="heading" data-level="5.4.18.3.3" id="model-with-map-dictionary-properties"><span class="content">Model with Map/Dictionary Properties</span></h6> - <h5 class="heading" data-level="5.4.18.5" id="fixed-fields"><span class="content">Fixed Fields</span></h5> - <h5 class="heading" data-level="5.4.20.1" id="patterned-fields"><span class="content">Patterned Fields</span></h5> - <h3 class="heading" data-level="4.2" id="mime-types"><span class="content"><a id="mimeTypes"><dfn>Mime Types</dfn></a></span></h3> - <h5 class="heading" data-level="5.4.7.3" id="path-item-object-example"><span class="content">Path Item Object Example</span></h5> - <h6 class="heading" data-level="5.4.18.7.2" id="xml-name-replacement"><span class="content">XML Name Replacement</span></h6> - <h5 class="heading" data-level="5.4.5.3" id="license-object-example"><span class="content">License Object Example:</span></h5> - <h5 class="heading" data-level="5.4.22.3" id="security-scheme-object-example"><span class="content">Security Scheme Object Example</span></h5> - <h5 class="heading" data-level="5.4.22.6" id="patterned-objects"><span class="content">Patterned Objects</span></h5> - <h5 class="heading" data-level="5.4.18.6" id="patterned-objects"><span class="content">Patterned Objects</span></h5> - <h6 class="heading" data-level="5.4.22.3.1" id="basic-authentication-sample"><span class="content">Basic Authentication Sample</span></h6> - <h4 class="heading" data-level="5.4.17" id="reference-object"><span class="content"><a id="referenceObject">Reference Object</a></span></h4> - <h3 class="heading" data-level="4.3" id="http-status-codes"><span class="content"><a id="httpCodes"><dfn>HTTP Status Codes</dfn></a></span></h3> - <h6 class="heading" data-level="5.4.18.7.4" id="xml-arrays"><span class="content">XML Arrays</span></h6> - <h5 class="heading" data-level="5.4.8.3" id="operation-object-example"><span class="content">Operation Object Example</span></h5> - <h5 class="heading" data-level="5.4.19.2" id="parameters-definition-object-example"><span class="content">Parameters Definition Object Example</span></h5> - <h5 class="heading" data-level="5.4.9.3" id="external-documentation-object-example"><span class="content">External Documentation Object Example</span></h5> - <h2 class="heading" data-level="5" id="specification"><span class="content">Specification</span></h2> -\033[1;96mWARNING:\033[0m Multiple elements have the same ID 'patterned-objects'. -Deduping, but this ID may not be stable across revisions. -\033[1;96mWARNING:\033[0m Multiple elements have the same ID 'patterned-fields'. -Deduping, but this ID may not be stable across revisions. -\033[1;96mWARNING:\033[0m Multiple elements have the same ID 'itemsMaximum'. -Deduping, but this ID may not be stable across revisions. -\033[1;96mWARNING:\033[0m Multiple elements have the same ID 'headerMaximum'. -Deduping, but this ID may not be stable across revisions. -\033[1;96mWARNING:\033[0m Multiple elements have the same ID 'fixed-fields'. -Deduping, but this ID may not be stable across revisions. -\033[1;96mWARNING:\033[0m Multiple elements have the same ID 'path-templating'. -Deduping, but this ID may not be stable across revisions. -\033[1;96mWARNING:\033[0m Multiple elements have the same ID 'http-status-codes'. -Deduping, but this ID may not be stable across revisions. -\033[1;96mWARNING:\033[0m Multiple elements have the same ID 'mime-types'. -Deduping, but this ID may not be stable across revisions. -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="dataTypeFormat" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'swagger object'. -<a id="swaggerObject" data-link-type="dfn" data-lt="Swagger Object">Swagger Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="swaggerSwagger" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="swaggerInfo" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="swaggerHost" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="swaggerBasePath" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="swaggerSchemes" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="swaggerConsumes" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="swaggerProduces" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="swaggerPaths" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="swaggerDefinitions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="swaggerParameters" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="swaggerResponses" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="swaggerSecurityDefinitions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="swaggerSecurity" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="swaggerTags" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="swaggerExternalDocs" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="swaggerExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'info object'. -<a id="infoObject" data-link-type="dfn" data-lt="Info Object">Info Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="infoTitle" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="infoDescription" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="infoTermsOfService" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="infoContact" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="infoLicense" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="infoVersion" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="infoExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'contact object'. -<a id="contactObject" data-link-type="dfn" data-lt="Contact Object">Contact Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="contactName" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="contactUrl" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="contactEmail" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="contactExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'license object'. -<a id="licenseObject" data-link-type="dfn" data-lt="License Object">License Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="licenseName" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="licenseUrl" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="licenseExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'paths object'. -<a id="pathsObject" data-link-type="dfn" data-lt="Paths Object">Paths Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="pathsPath" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="pathsExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'path item object'. -<a id="pathItemObject" data-link-type="dfn" data-lt="Path Item Object">Path Item Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="pathItemRef" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="pathItemGet" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="pathItemPut" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="pathItemPost" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="pathItemDelete" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="pathItemOptions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="pathItemHead" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="pathItemPatch" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="pathItemParameters" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="pathItemExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'operation object'. -<a id="operationObject" data-link-type="dfn" data-lt="Operation Object">Operation Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="operationTags" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="operationSummary" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="operationDescription" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="operationExternalDocs" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="operationId" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="operationConsumes" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="operationProduces" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="operationParameters" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="operationResponses" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="operationSchemes" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="operationDeprecated" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="operationSecurity" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="operationExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'external documentation object'. -<a id="externalDocumentationObject" data-link-type="dfn" data-lt="External Documentation Object">External Documentation Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="externalDocDescription" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="externalDocUrl" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="externalDocExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'parameter object'. -<a id="parameterObject" data-link-type="dfn" data-lt="Parameter Object">Parameter Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterName" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterIn" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterDescription" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterRequired" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterSchema" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterType" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterFormat" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'allowemptyvalue'. -<a name="parameterAllowEmptyValue" data-link-type="dfn" data-lt="allowEmptyValue">allowEmptyValue</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterItems" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterCollectionFormat" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterDefault" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterMaximum" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterExclusiveMaximum" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterMinimum" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterExclusiveMinimum" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterMaxLength" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterMinLength" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterPattern" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterMaxItems" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterMinItems" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterUniqueItems" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterEnum" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterMultipleOf" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="parameterExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'items object'. -<a id="itemsObject" data-link-type="dfn" data-lt="Items Object">Items Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsType" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsFormat" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsItems" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsCollectionFormat" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsDefault" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsMaximum" data-link-type="dfn" data-lt=" "> </a> -\033[1;96mWARNING:\033[0m Your console does not understand Unicode. - Messages may be slightly corrupted. -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsMaximum①" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsMinimum" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsExclusiveMinimum" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsMaxLength" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsMinLength" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsPattern" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsMaxItems" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsMinItems" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsUniqueItems" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsEnum" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsMultipleOf" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="itemsExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'responses object'. -<a id="responsesObject" data-link-type="dfn" data-lt="Responses Object">Responses Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="responsesDefault" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="responsesCode" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="responsesExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'response object' that are marked for export. -<a id="responseObject" data-link-type="dfn" data-lt="Response Object">Response Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="responseDescription" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="responseSchema" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="responseHeaders" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="responseExamples" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="responseExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'headers object'. -<a id="headersObject" data-link-type="dfn" data-lt="Headers Object">Headers Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headersName" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'example object'. -<a id="exampleObject" data-link-type="dfn" data-lt="Example Object">Example Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="exampleMimeType" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'header object'. -<a id="headerObject" data-link-type="dfn" data-lt="Header Object">Header Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerDescription" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerType" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerFormat" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerItems" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerCollectionFormat" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerDefault" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerMaximum" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerMaximum①" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerMinimum" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerExclusiveMinimum" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerMaxLength" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerMinLength" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerPattern" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerMaxItems" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerMinItems" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerUniqueItems" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerEnum" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerMultipleOf" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="headerExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'tag object'. -<a id="tagObject" data-link-type="dfn" data-lt="Tag Object">Tag Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="tagName" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="tagDescription" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="tagExternalDocs" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="tagExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'reference object'. -<a id="referenceObject" data-link-type="dfn" data-lt="Reference Object">Reference Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="referenceRef" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'schema object'. -<a id="schemaObject" data-link-type="dfn" data-lt="Schema Object">Schema Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="schemaDiscriminator" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="schemaReadOnly" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="schemaXml" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="schemaExternalDocs" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="schemaExample" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="schemaExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'xml object'. -<a id="xmlObject" data-link-type="dfn" data-lt="XML Object">XML Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="xmlName" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="xmlNamespace" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="xmlPrefix" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="xmlAttribute" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="xmlWrapped" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="xmlExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'definitions object'. -<a id="definitionsObject" data-link-type="dfn" data-lt="Definitions Object">Definitions Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="definitionsName" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'parameters definitions object'. -<a id="parametersDefinitionsObject" data-link-type="dfn" data-lt="Parameters Definitions Object">Parameters Definitions Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="pdName" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'responses definitions object'. -<a id="responsesDefinitionsObject" data-link-type="dfn" data-lt="Responses Definitions Object">Responses Definitions Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="rdName" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'security definitions object'. -<a id="securityDefinitionsObject" data-link-type="dfn" data-lt="Security Definitions Object">Security Definitions Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="sdName" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'security scheme object'. -<a id="securitySchemeObject" data-link-type="dfn" data-lt="Security Scheme Object">Security Scheme Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="securitySchemeType" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="securitySchemeDescription" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="securitySchemeName" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="securitySchemeIn" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="securitySchemeFlow" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="securitySchemeAuthorizationUrl" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="securitySchemeTokenUrl" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="securitySchemeScopes" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="securitySchemeExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'scopes object'. -<a id="scopesObject" data-link-type="dfn" data-lt="Scopes Object">Scopes Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="scopesName" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="scopesExtensions" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'security requirement object'. -<a id="securityRequirementObject" data-link-type="dfn" data-lt="Security Requirement Object">Security Requirement Object</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for ' '. -<a id="securityRequirementsName" data-link-type="dfn" data-lt=" "> </a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'specification extensions'. -<a id="vendorExtensions" data-link-type="dfn" data-lt="Specification Extensions">Specification Extensions</a> -\033[1;33mLINK ERROR:\033[0m No 'dfn' refs found for 'security filtering'. -<a id="securityFiltering" data-link-type="dfn" data-lt="Security Filtering">Security Filtering</a> -\033[1;96mWARNING:\033[0m This specification has neither a 'Security Considerations' nor a 'Privacy Considerations' section. Please consider adding both, see https://w3ctag.github.io/security-questionnaire/. -\033[1;31mFATAL ERROR:\033[0m Couldn't find target anchor dataTypeType: -<a href="#dataTypeType"><code>type</code></a> -\033[7;31m ✘ \033[0m Did not generate, due to fatal errors \ No newline at end of file diff --git a/bikeshed/v3/input.bs b/bikeshed/v3/input.bs deleted file mode 100644 index edbabe7647..0000000000 --- a/bikeshed/v3/input.bs +++ /dev/null @@ -1,4250 +0,0 @@ - - - - - - - - - - -Open API Initiative logo - -

    OpenAPI Specification

    -

    Version 3.0.0

    -

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [[!rfc2119]] [[!rfc8174]] when, and only when, they appear in all capitals, as shown here.

    -

    This document is licensed under The Apache License, Version 2.0.

    -

    Introduction

    -

    The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.

    -

    An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.

    - -

    Definitions

    -

    OpenAPI Document

    -A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification. -

    Path Templating

    -Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. -

    Media Types

    -Media type definitions are spread across several resources. -The media type definitions SHOULD be in compliance with [[!rfc6838]]. -

    Some examples of possible media type definitions:

    -
    
    -  text/plain; charset=utf-8
    -  application/json
    -  application/vnd.github+json
    -  application/vnd.github.v3+json
    -  application/vnd.github.v3.raw+json
    -  application/vnd.github.v3.text+json
    -  application/vnd.github.v3.html+json
    -  application/vnd.github.v3.full+json
    -  application/vnd.github.v3.diff
    -  application/vnd.github.v3.patch
    -
    -

    HTTP Status Codes

    -The HTTP Status Codes are used to indicate the status of the executed operation. -The available status codes are defined by [[!rfc7231]]section-6) and registered status codes are listed in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). -

    Specification

    -

    Versions

    -

    The OpenAPI Specification is versioned using Semantic Versioning 2.0.0 (semver) and follows the semver specification.

    -

    The major.minor portion of the semver (for example 3.0) SHALL designate the OAS feature set. Typically, .patch versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between 3.0.0 and 3.0.1 for example.

    -

    Subsequent minor version releases of the OpenAPI Specification (incrementing the minor version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical 3.1.0 specification SHOULD be usable with tooling designed for 3.0.0.

    -

    An OpenAPI document compatible with OAS 3.*.* contains a required openapi field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named swagger and value "2.0".)

    -

    Format

    -

    An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format.

    -

    For example, if a field has an array value, the JSON array representation will be used:

    -
    
    -{
    -   "field": [ 1, 2, 3 ]
    -}
    -
    -

    All field names in the specification are case sensitive.

    -

    The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name.

    -

    Patterned fields MUST have unique names within the containing object.

    -

    In order to preserve the ability to round-trip between YAML and JSON formats, YAML version 1.2 is RECOMMENDED along with some additional constraints:

    - -

    Note: While APIs may be defined by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML.

    -

    Document Structure

    -

    An OpenAPI document MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the user. In the latter case, $ref fields MUST be used in the specification to reference those parts as follows from the JSON Schema definitions.

    -

    It is RECOMMENDED that the root OpenAPI document be named: openapi.json or openapi.yaml.

    -

    Data Types

    -

    Primitive data types in the OAS are based on the types supported by the JSON Schema Specification Wright Draft 00. -Note that integer as a type is also supported and is defined as a JSON number without a fraction or exponent part. -null is not supported as a type (see nullable for an alternative solution). -Models are defined using the Schema Object, which is an extended subset of JSON Schema Specification Wright Draft 00.

    -

    Primitives have an optional modifier property: format. -OAS uses several known formats to define in fine detail the data type being used. -However, to support documentation needs, the format property is an open string-valued property, and can have any value. -Formats such as "email", "uuid", and so on, MAY be used even though undefined by this specification. -Types that are not accompanied by a format property follow the type definition in the JSON Schema. Tools that do not recognize a specific format MAY default back to the type alone, as if the format is not specified.

    -

    The formats defined by the OAS are:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Common NametypeformatComments
    integerintegerint32signed 32 bits
    longintegerint64signed 64 bits
    floatnumberfloat
    doublenumberdouble
    stringstring
    bytestringbytebase64 encoded characters
    binarystringbinaryany sequence of octets
    booleanboolean
    datestringdateAs defined by full-date - [!rfc3339]
    dateTimestringdate-timeAs defined by date-time - [!rfc3339]
    passwordstringpasswordA hint to UIs to obscure input.
    -

    Rich Text Formatting

    -Throughout the specification `description` fields are noted as supporting CommonMark markdown formatting. -Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by [CommonMark 0.27](http://spec.commonmark.org/0.27/). Tooling MAY choose to ignore some CommonMark features to address security concerns. -

    Relative References in URLs

    -

    Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [[!rfc3986]]section-4.2). -Relative references are resolved using the URLs defined in the Server Object as a Base URI.

    -

    Relative references used in $ref are processed as per JSON Reference, using the URL of the current document as the base URI. See also the Reference Object.

    -

    Schema

    -

    In the following description, if a field is not explicitly REQUIRED or described with a MUST or SHALL, it can be considered OPTIONAL.

    -

    OpenAPI Object

    -

    This is the root document object of the OpenAPI document.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    openapistringREQUIRED. This string MUST be the semantic version number of the OpenAPI Specification version that the OpenAPI document uses. The openapi field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is not related to the API info.version string.
    infoInfo ObjectREQUIRED. Provides metadata about the API. The metadata MAY be used by tooling as required.
    servers[Server Object]An array of Server Objects, which provide connectivity information to a target server. If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url value of /.
    pathsPaths ObjectREQUIRED. The available paths and operations for the API.
    componentsComponents ObjectAn element to hold various schemas for the specification.
    security[Security Requirement Object]A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition.
    tags[Tag Object]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.
    externalDocsExternal Documentation ObjectAdditional external documentation.
    -

    This object MAY be extended with Specification Extensions.

    -

    Info Object

    -

    The object provides metadata about the API. -The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    titlestringREQUIRED. The title of the application.
    descriptionstringA short description of the application. CommonMark syntax MAY be used for rich text representation.
    termsOfServicestringA URL to the Terms of Service for the API. MUST be in the format of a URL.
    contactContact ObjectThe contact information for the exposed API.
    licenseLicense ObjectThe license information for the exposed API.
    versionstringREQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version).
    -

    This object MAY be extended with Specification Extensions.

    -
    Info Object Example:
    -
    
    -{
    -  "title": "Sample Pet Store App",
    -  "description": "This is a sample server for a pet store.",
    -  "termsOfService": "http://example.com/terms/",
    -  "contact": {
    -    "name": "API Support",
    -    "url": "http://www.example.com/support",
    -    "email": "support@example.com"
    -  },
    -  "license": {
    -    "name": "Apache 2.0",
    -    "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    -  },
    -  "version": "1.0.1"
    -}
    -
    -
    
    -title: Sample Pet Store App
    -description: This is a sample server for a pet store.
    -termsOfService: http://example.com/terms/
    -contact:
    -  name: API Support
    -  url: http://www.example.com/support
    -  email: support@example.com
    -license:
    -  name: Apache 2.0
    -  url: http://www.apache.org/licenses/LICENSE-2.0.html
    -version: 1.0.1
    -
    -

    Contact Object

    -

    Contact information for the exposed API.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringThe identifying name of the contact person/organization.
    urlstringThe URL pointing to the contact information. MUST be in the format of a URL.
    emailstringThe email address of the contact person/organization. MUST be in the format of an email address.
    -

    This object MAY be extended with Specification Extensions.

    -
    Contact Object Example:
    -
    
    -{
    -  "name": "API Support",
    -  "url": "http://www.example.com/support",
    -  "email": "support@example.com"
    -}
    -
    -
    
    -name: API Support
    -url: http://www.example.com/support
    -email: support@example.com
    -
    -

    License Object

    -

    License information for the exposed API.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringREQUIRED. The license name used for the API.
    urlstringA URL to the license used for the API. MUST be in the format of a URL.
    -

    This object MAY be extended with Specification Extensions.

    -
    License Object Example:
    -
    
    -{
    -  "name": "Apache 2.0",
    -  "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    -}
    -
    -
    
    -name: Apache 2.0
    -url: http://www.apache.org/licenses/LICENSE-2.0.html
    -
    -

    Server Object

    -

    An object representing a Server.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    urlstringREQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in {brackets}.
    descriptionstringAn optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation.
    variablesMap[string, Server Variable Object]A map between a variable name and its value. The value is used for substitution in the server’s URL template.
    -

    This object MAY be extended with Specification Extensions.

    -
    Server Object Example
    -

    A single server would be described as:

    -
    
    -{
    -  "url": "https://development.gigantic-server.com/v1",
    -  "description": "Development server"
    -}
    -
    -
    
    -url: https://development.gigantic-server.com/v1
    -description: Development server
    -
    -

    The following shows how multiple servers can be described, for example, at the OpenAPI Object’s servers:

    -
    
    -{
    -  "servers": [
    -    {
    -      "url": "https://development.gigantic-server.com/v1",
    -      "description": "Development server"
    -    },
    -    {
    -      "url": "https://staging.gigantic-server.com/v1",
    -      "description": "Staging server"
    -    },
    -    {
    -      "url": "https://api.gigantic-server.com/v1",
    -      "description": "Production server"
    -    }
    -  ]
    -}
    -
    -
    
    -servers:
    -- url: https://development.gigantic-server.com/v1
    -  description: Development server
    -- url: https://staging.gigantic-server.com/v1
    -  description: Staging server
    -- url: https://api.gigantic-server.com/v1
    -  description: Production server
    -
    -

    The following shows how variables can be used for a server configuration:

    -
    
    -{
    -  "servers": [
    -    {
    -      "url": "https://{username}.gigantic-server.com:{port}/{basePath}",
    -      "description": "The production API server",
    -      "variables": {
    -        "username": {
    -          "default": "demo",
    -          "description": "this value is assigned by the service provider, in this example `gigantic-server.com`"
    -        },
    -        "port": {
    -          "enum": [
    -            "8443",
    -            "443"
    -          ],
    -          "default": "8443"
    -        },
    -        "basePath": {
    -          "default": "v2"
    -        }
    -      }
    -    }
    -  ]
    -}
    -
    -
    
    -servers:
    -- url: https://{username}.gigantic-server.com:{port}/{basePath}
    -  description: The production API server
    -  variables:
    -    username:
    -      # note! no enum here means it is an open value
    -      default: demo
    -      description: this value is assigned by the service provider, in this example `gigantic-server.com`
    -    port:
    -      enum:
    -        - '8443'
    -        - '443'
    -      default: '8443'
    -    basePath:
    -      # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2`
    -      default: v2
    -
    -

    Server Variable Object

    -

    An object representing a Server Variable for server URL template substitution.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    enum[string]An enumeration of string values to be used if the substitution options are from a limited set.
    defaultstringREQUIRED. The default value to use for substitution, and to send, if an alternate value is not supplied. Unlike the Schema Object’s default, this value MUST be provided by the consumer.
    descriptionstringAn optional description for the server variable. CommonMark syntax MAY be used for rich text representation.
    -

    This object MAY be extended with Specification Extensions.

    -

    Components Object

    -

    Holds a set of reusable objects for different aspects of the OAS. -All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    schemasMap[string, Schema Object | Reference Object]An object to hold reusable Schema Objects.
    responsesMap[string, Response Object | Reference Object]An object to hold reusable Response Objects.
    parametersMap[string, Parameter Object | Reference Object]An object to hold reusable Parameter Objects.
    examplesMap[string, Example Object | Reference Object]An object to hold reusable Example Objects.
    requestBodiesMap[string, Request Body Object | Reference Object]An object to hold reusable Request Body Objects.
    headersMap[string, Header Object | Reference Object]An object to hold reusable Header Objects.
    securitySchemesMap[string, Security Scheme Object | Reference Object]An object to hold reusable Security Scheme Objects.
    linksMap[string, Link Object | Reference Object]An object to hold reusable Link Objects.
    callbacksMap[string, Callback Object | Reference Object]An object to hold reusable Callback Objects.
    -

    This object MAY be extended with Specification Extensions.

    -

    All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9\.\-_]+$.

    -

    Field Name Examples:

    -
    
    -User
    -User_1
    -User_Name
    -user-name
    -my.org.User
    -
    -
    Components Object Example
    -
    
    -"components": {
    -  "schemas": {
    -    "Category": {
    -      "type": "object",
    -      "properties": {
    -        "id": {
    -          "type": "integer",
    -          "format": "int64"
    -        },
    -        "name": {
    -          "type": "string"
    -        }
    -      }
    -    },
    -    "Tag": {
    -      "type": "object",
    -      "properties": {
    -        "id": {
    -          "type": "integer",
    -          "format": "int64"
    -        },
    -        "name": {
    -          "type": "string"
    -        }
    -      }
    -    }
    -  },
    -  "parameters": {
    -    "skipParam": {
    -      "name": "skip",
    -      "in": "query",
    -      "description": "number of items to skip",
    -      "required": true,
    -      "schema": {
    -        "type": "integer",
    -        "format": "int32"
    -      }
    -    },
    -    "limitParam": {
    -      "name": "limit",
    -      "in": "query",
    -      "description": "max records to return",
    -      "required": true,
    -      "schema" : {
    -        "type": "integer",
    -        "format": "int32"
    -      }
    -    }
    -  },
    -  "responses": {
    -    "NotFound": {
    -      "description": "Entity not found."
    -    },
    -    "IllegalInput": {
    -      "description": "Illegal input for operation."
    -    },
    -    "GeneralError": {
    -      "description": "General Error",
    -      "content": {
    -        "application/json": {
    -          "schema": {
    -            "$ref": "#/components/schemas/GeneralError"
    -          }
    -        }
    -      }
    -    }
    -  },
    -  "securitySchemes": {
    -    "api_key": {
    -      "type": "apiKey",
    -      "name": "api_key",
    -      "in": "header"
    -    },
    -    "petstore_auth": {
    -      "type": "oauth2",
    -      "flows": {
    -        "implicit": {
    -          "authorizationUrl": "http://example.org/api/oauth/dialog",
    -          "scopes": {
    -            "write:pets": "modify pets in your account",
    -            "read:pets": "read your pets"
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -components:
    -  schemas:
    -    Category:
    -      type: object
    -      properties:
    -        id:
    -          type: integer
    -          format: int64
    -        name:
    -          type: string
    -    Tag:
    -      type: object
    -      properties:
    -        id:
    -          type: integer
    -          format: int64
    -        name:
    -          type: string
    -  parameters:
    -    skipParam:
    -      name: skip
    -      in: query
    -      description: number of items to skip
    -      required: true
    -      schema:
    -        type: integer
    -        format: int32
    -    limitParam:
    -      name: limit
    -      in: query
    -      description: max records to return
    -      required: true
    -      schema:
    -        type: integer
    -        format: int32
    -  responses:
    -    NotFound:
    -      description: Entity not found.
    -    IllegalInput:
    -      description: Illegal input for operation.
    -    GeneralError:
    -      description: General Error
    -      content:
    -        application/json:
    -          schema:
    -            $ref: '#/components/schemas/GeneralError'
    -  securitySchemes:
    -    api_key:
    -      type: apiKey
    -      name: api_key
    -      in: header
    -    petstore_auth:
    -      type: oauth2
    -      flows: 
    -        implicit:
    -          authorizationUrl: http://example.org/api/oauth/dialog
    -          scopes:
    -            write:pets: modify pets in your account
    -            read:pets: read your pets
    -
    -

    Paths Object

    -

    Holds the relative paths to the individual endpoints and their operations. -The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    /{path}Path Item ObjectA relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended (no relative URL resolution) to the expanded URL from the Server Object's url field in order to construct the full URL. Path templating is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it’s up to the tooling to decide which one to use.
    -

    This object MAY be extended with Specification Extensions.

    -
    Path Templating Matching
    -

    Assuming the following paths, the concrete definition, /pets/mine, will be matched first if used:

    -
    
    -  /pets/{petId}
    -  /pets/mine
    -
    -

    The following paths are considered identical and invalid:

    -
    
    -  /pets/{petId}
    -  /pets/{name}
    -
    -

    The following may lead to ambiguous resolution:

    -
    
    -  /{entity}/me
    -  /books/{id}
    -
    -
    Paths Object Example
    -
    
    -{
    -  "/pets": {
    -    "get": {
    -      "description": "Returns all pets from the system that the user has access to",
    -      "responses": {
    -        "200": {          
    -          "description": "A list of pets.",
    -          "content": {
    -            "application/json": {
    -              "schema": {
    -                "type": "array",
    -                "items": {
    -                  "$ref": "#/components/schemas/pet"
    -                }
    -              }
    -            }
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -/pets:
    -  get:
    -    description: Returns all pets from the system that the user has access to
    -    responses:
    -      '200':
    -        description: A list of pets.
    -        content:
    -          application/json:
    -            schema:
    -              type: array
    -              items:
    -                $ref: '#/components/schemas/pet'
    -
    -

    Path Item Object

    -

    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.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    $refstringAllows 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.
    summarystringAn optional, string summary, intended to apply to all operations in this path.
    descriptionstringAn optional, string description, intended to apply to all operations in this path. CommonMark syntax MAY be used for rich text representation.
    getOperation ObjectA definition of a GET operation on this path.
    putOperation ObjectA definition of a PUT operation on this path.
    postOperation ObjectA definition of a POST operation on this path.
    deleteOperation ObjectA definition of a DELETE operation on this path.
    optionsOperation ObjectA definition of a OPTIONS operation on this path.
    headOperation ObjectA definition of a HEAD operation on this path.
    patchOperation ObjectA definition of a PATCH operation on this path.
    traceOperation ObjectA definition of a TRACE operation on this path.
    servers[Server Object]An alternative server array to service all operations in this path.
    parameters[Parameter Object | Reference Object]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 OpenAPI Object’s components/parameters.
    -

    This object MAY be extended with Specification Extensions.

    -
    Path Item Object Example
    -
    
    -{
    -  "get": {
    -    "description": "Returns pets based on ID",
    -    "summary": "Find pets by ID",
    -    "operationId": "getPetsById",
    -    "responses": {
    -      "200": {
    -        "description": "pet response",
    -        "content": {
    -          "*/*": {
    -            "schema": {
    -              "type": "array",
    -              "items": {
    -                "$ref": "#/components/schemas/Pet"
    -              }
    -            }
    -          }
    -        }
    -      },
    -      "default": {
    -        "description": "error payload",
    -        "content": {
    -          "text/html": {
    -            "schema": {
    -              "$ref": "#/components/schemas/ErrorModel"
    -            }
    -          }
    -        }
    -      }
    -    }
    -  },
    -  "parameters": [
    -    {
    -      "name": "id",
    -      "in": "path",
    -      "description": "ID of pet to use",
    -      "required": true,
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "type": "string"
    -        }
    -      },
    -      "style": "simple"
    -    }
    -  ]
    -}
    -
    -
    
    -get:
    -  description: Returns pets based on ID
    -  summary: Find pets by ID
    -  operationId: getPetsById
    -  responses:
    -    '200':
    -      description: pet response
    -      content:
    -        '*/*' :
    -          schema:
    -            type: array
    -            items:
    -              $ref: '#/components/schemas/Pet'
    -    default:
    -      description: error payload
    -      content:
    -        'text/html':
    -          schema:
    -            $ref: '#/components/schemas/ErrorModel'
    -parameters:
    -- name: id
    -  in: path
    -  description: ID of pet to use
    -  required: true
    -  schema:
    -    type: array
    -    style: simple
    -    items:
    -      type: string  
    -
    -

    Operation Object

    -

    Describes a single API operation on a path.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    tags[string]A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
    summarystringA short summary of what the operation does.
    descriptionstringA verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation.
    externalDocsExternal Documentation ObjectAdditional external documentation for this operation.
    operationIdstringUnique 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[Parameter Object | Reference Object]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 OpenAPI Object’s components/parameters.
    requestBodyRequest Body Object | Reference ObjectThe request body applicable for this operation. The requestBody is only supported in HTTP methods where the HTTP 1.1 specification [[!rfc7231]]section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers.
    responsesResponses ObjectREQUIRED. The list of possible responses as they are returned from executing this operation.
    callbacksMap[string, Callback Object | Reference Object]A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
    deprecatedbooleanDeclares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is false.
    security[Security Requirement Object]A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used.
    servers[Server Object]An alternative server array to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value.
    -

    This object MAY be extended with Specification Extensions.

    -
    Operation Object Example
    -
    
    -{
    -  "tags": [
    -    "pet"
    -  ],
    -  "summary": "Updates a pet in the store with form data",
    -  "operationId": "updatePetWithForm",
    -  "parameters": [
    -    {
    -      "name": "petId",
    -      "in": "path",
    -      "description": "ID of pet that needs to be updated",
    -      "required": true,
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  ],
    -  "requestBody": {
    -    "content": {
    -      "application/x-www-form-urlencoded": {
    -        "schema": {
    -          "type": "object",
    -           "properties": {
    -              "name": { 
    -                "description": "Updated name of the pet",
    -                "type": "string"
    -              },
    -              "status": {
    -                "description": "Updated status of the pet",
    -                "type": "string"
    -             }
    -           },
    -        "required": ["status"] 
    -        }
    -      }
    -    }
    -  },
    -  "responses": {
    -    "200": {
    -      "description": "Pet updated.",
    -      "content": {
    -        "application/json": {},
    -        "application/xml": {}
    -      }
    -    },
    -    "405": {
    -      "description": "Invalid input",
    -      "content": {
    -        "application/json": {},
    -        "application/xml": {}
    -      }
    -    }
    -  },
    -  "security": [
    -    {
    -      "petstore_auth": [
    -        "write:pets",
    -        "read:pets"
    -      ]
    -    }
    -  ]
    -}
    -
    -
    
    -tags:
    -- pet
    -summary: Updates a pet in the store with form data
    -operationId: updatePetWithForm
    -parameters:
    -- name: petId
    -  in: path
    -  description: ID of pet that needs to be updated
    -  required: true
    -  schema:
    -    type: string
    -requestBody:
    -  content:
    -    'application/x-www-form-urlencoded':
    -      schema:
    -       properties:
    -          name: 
    -            description: Updated name of the pet
    -            type: string
    -          status:
    -            description: Updated status of the pet
    -            type: string
    -       required:
    -         - status
    -responses:
    -  '200':
    -    description: Pet updated.
    -    content: 
    -      'application/json': {}
    -      'application/xml': {}
    -  '405':
    -    description: Invalid input
    -    content: 
    -      'application/json': {}
    -      'application/xml': {}
    -security:
    -- petstore_auth:
    -  - write:pets
    -  - read:pets
    -
    -

    External Documentation Object

    -

    Allows referencing an external resource for extended documentation.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringA short description of the target documentation. CommonMark syntax MAY be used for rich text representation.
    urlstringREQUIRED. The URL for the target documentation. Value MUST be in the format of a URL.
    -

    This object MAY be extended with Specification Extensions.

    -
    External Documentation Object Example
    -
    
    -{
    -  "description": "Find more info here",
    -  "url": "https://example.com"
    -}
    -
    -
    
    -description: Find more info here
    -url: https://example.com
    -
    -

    Parameter Object

    -

    Describes a single operation parameter.

    -

    A unique parameter is defined by a combination of a name and location.

    -
    Parameter Locations
    -

    There are four possible parameter locations specified by the in field:

    -
      -
    • path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId.
    • -
    • query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id.
    • -
    • header - Custom headers that are expected as part of the request. Note that [[!rfc7230]]page-22) states header names are case insensitive.
    • -
    • cookie - Used to pass a specific cookie value to the API.
    • -
    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringREQUIRED. 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.
    • If in is "header" and the name field is "Accept", "Content-Type" or "Authorization", the parameter definition SHALL be ignored.
    • For all other cases, the name corresponds to the parameter name used by the in property.
    instringREQUIRED. The location of the parameter. Possible values are “query”, “header”, “path” or “cookie”.
    descriptionstringA brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
    requiredbooleanDetermines whether this parameter is mandatory. If the parameter location is “path”, this property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and its default value is false.
    deprecatedbooleanSpecifies that a parameter is deprecated and SHOULD be transitioned out of usage.
    allowEmptyValuebooleanSets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored.
    -

    The rules for serialization of the parameter are specified in one of two ways. -For simpler scenarios, a schema and style can describe the structure and syntax of the parameter.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    stylestringDescribes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form.
    explodebooleanWhen this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false.
    allowReservedbooleanDetermines whether the parameter value SHOULD allow reserved characters, as defined by [[!rfc3986]]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false.
    schemaSchema Object | Reference ObjectThe schema defining the type used for the parameter.
    exampleAnyExample of the media type. The example SHOULD match the specified schema and encoding properties if present. The example object is mutually exclusive of the examples object. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.
    examplesMap[ string, Example Object | Reference Object]Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The examples object is mutually exclusive of the example object. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema.
    -

    For more complex scenarios, the content property can define the media type and schema of the parameter. -A parameter MUST contain either a schema property, or a content property, but not both. -When example or examples are provided in conjunction with the schema object, the example MUST follow the prescribed serialization strategy for the parameter.

    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    contentMap[string, Media Type Object]A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.
    -
    Style Values
    -

    In order to support common ways of serializing simple parameters, a set of style values are defined.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    styletypeinComments
    matrixprimitive, array, objectpathPath-style parameters defined by [[!rfc6570]]section-3.2.7)
    labelprimitive, array, objectpathLabel style parameters defined by [[!rfc6570]]section-3.2.5)
    formprimitive, array, objectquery, cookieForm style parameters defined by [[!rfc6570]]section-3.2.8). This option replaces collectionFormat with a csv (when explode is false) or multi (when explode is true) value from OpenAPI 2.0.
    simplearraypath, headerSimple style parameters defined by [[!rfc6570]]section-3.2.2). This option replaces collectionFormat with a csv value from OpenAPI 2.0.
    spaceDelimitedarrayquerySpace separated array values. This option replaces collectionFormat equal to ssv from OpenAPI 2.0.
    pipeDelimitedarrayqueryPipe separated array values. This option replaces collectionFormat equal to pipes from OpenAPI 2.0.
    deepObjectobjectqueryProvides a simple way of rendering nested objects using form parameters.
    -
    Style Examples
    -

    Assume a parameter named color has one of the following values:

    -
    
    -   string -> "blue"
    -   array -> ["blue","black","brown"]
    -   object -> { "R": 100, "G": 200, "B": 150 }
    -
    -

    The following table shows examples of rendering differences for each value.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    styleexplodeemptystringarrayobject
    matrixfalse;color;color=blue;color=blue,black,brown;color=R,100,G,200,B,150
    matrixtrue;color;color=blue;color=blue;color=black;color=brown;R=100;G=200;B=150
    labelfalse..blue.blue.black.brown.R.100.G.200.B.150
    labeltrue..blue.blue.black.brown.R=100.G=200.B=150
    formfalsecolor=color=bluecolor=blue,black,browncolor=R,100,G,200,B,150
    formtruecolor=color=bluecolor=blue&color=black&color=brownR=100&G=200&B=150
    simplefalsen/ablueblue,black,brownR,100,G,200,B,150
    simpletruen/ablueblue,black,brownR=100,G=200,B=150
    spaceDelimitedfalsen/an/ablue%20black%20brownR%20100%20G%20200%20B%20150
    pipeDelimitedfalsen/an/ablue|black|brownR|100|G|200
    deepObjecttruen/an/an/acolor[R]=100&color[G]=200&color[B]=150
    -

    This object MAY be extended with Specification Extensions.

    -
    Parameter Object Examples
    -

    A header parameter with an array of 64 bit integer numbers:

    -
    
    -{
    -  "name": "token",
    -  "in": "header",
    -  "description": "token to be passed as a header",
    -  "required": true,
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "type": "integer",
    -      "format": "int64"
    -    }
    -  },
    -  "style": "simple"
    -}
    -
    -
    
    -name: token
    -in: header
    -description: token to be passed as a header
    -required: true
    -schema:
    -  type: array
    -  items:
    -    type: integer
    -    format: int64
    -style: simple
    -
    -

    A path parameter of a string value:

    -
    
    -{
    -  "name": "username",
    -  "in": "path",
    -  "description": "username to fetch",
    -  "required": true,
    -  "schema": {
    -    "type": "string"
    -  }
    -}
    -
    -
    
    -name: username
    -in: path
    -description: username to fetch
    -required: true
    -schema:
    -  type: string
    -
    -

    An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

    -
    
    -{
    -  "name": "id",
    -  "in": "query",
    -  "description": "ID of the object to fetch",
    -  "required": false,
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    }
    -  },
    -  "style": "form",
    -  "explode": true
    -}
    -
    -
    
    -name: id
    -in: query
    -description: ID of the object to fetch
    -required: false
    -schema:
    -  type: array
    -  items:
    -    type: string
    -style: form
    -explode: true
    -
    -

    A free-form query parameter, allowing undefined parameters of a specific type:

    -
    
    -{
    -  "in": "query",
    -  "name": "freeForm",
    -  "schema": {
    -    "type": "object",
    -    "additionalProperties": {
    -      "type": "integer"
    -    },
    -  },
    -  "style": "form"
    -}
    -
    -
    
    -in: query
    -name: freeForm
    -schema:
    -  type: object
    -  additionalProperties:
    -    type: integer
    -style: form
    -
    -

    A complex parameter using content to define serialization:

    -
    
    -{
    -  "in": "query",
    -  "name": "coordinates",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "type": "object",
    -        "required": [
    -          "lat",
    -          "long"
    -        ],
    -        "properties": {
    -          "lat": {
    -            "type": "number"
    -          },
    -          "long": {
    -            "type": "number"
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -in: query
    -name: coordinates
    -content:
    -  application/json:
    -    schema:
    -      type: object
    -      required:
    -        - lat
    -        - long
    -      properties:
    -        lat:
    -          type: number
    -        long:
    -          type: number
    -
    -

    Request Body Object

    -

    Describes a single request body.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringA brief description of the request body. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
    contentMap[string, Media Type Object]REQUIRED. The content of the request body. The key is a media type or [media type range]appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
    requiredbooleanDetermines if the request body is required in the request. Defaults to false.
    -

    This object MAY be extended with Specification Extensions.

    -
    Request Body Examples
    -

    A request body with a referenced model definition.

    -
    
    -{
    -  "description": "user to add to the system",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "$ref": "#/components/schemas/User"
    -      },
    -      "examples": {
    -          "user" : {
    -            "summary": "User Example", 
    -            "externalValue": "http://foo.bar/examples/user-example.json"
    -          } 
    -        }
    -    },
    -    "application/xml": {
    -      "schema": {
    -        "$ref": "#/components/schemas/User"
    -      },
    -      "examples": {
    -          "user" : {
    -            "summary": "User example in XML",
    -            "externalValue": "http://foo.bar/examples/user-example.xml"
    -          }
    -        }
    -    },
    -    "text/plain": {
    -      "examples": {
    -        "user" : {
    -            "summary": "User example in Plain text",
    -            "externalValue": "http://foo.bar/examples/user-example.txt" 
    -        }
    -      } 
    -    },
    -    "*/*": {
    -      "examples": {
    -        "user" : {
    -            "summary": "User example in other format",
    -            "externalValue": "http://foo.bar/examples/user-example.whatever"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -description: user to add to the system
    -content: 
    -  'application/json':
    -    schema:
    -      $ref: '#/components/schemas/User'
    -    examples:
    -      user:
    -        summary: User Example
    -        externalValue: 'http://foo.bar/examples/user-example.json'
    -  'application/xml':
    -    schema:
    -      $ref: '#/components/schemas/User'
    -    examples:
    -      user:
    -        summary: User Example in XML
    -        externalValue: 'http://foo.bar/examples/user-example.xml'
    -  'text/plain':
    -    examples:
    -      user:
    -        summary: User example in text plain format
    -        externalValue: 'http://foo.bar/examples/user-example.txt'
    -  '*/*':
    -    examples:
    -      user: 
    -        summary: User example in other format
    -        externalValue: 'http://foo.bar/examples/user-example.whatever'
    -
    -

    A body parameter that is an array of string values:

    -
    
    -{
    -  "description": "user to add to the system",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "type": "string"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -description: user to add to the system
    -required: true
    -content:
    -  text/plain:
    -    schema:
    -      type: array
    -      items:
    -        type: string
    -
    -

    Media Type Object

    -Each Media Type Object provides schema and examples for the media type identified by its key. -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    schemaSchema Object | Reference ObjectThe schema defining the type used for the request body.
    exampleAnyExample of the media type. The example object SHOULD be in the correct format as specified by the media type. The example object is mutually exclusive of the examples object. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema.
    examplesMap[ string, Example Object | Reference Object]Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The examples object is mutually exclusive of the example object. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema.
    encodingMap[string, Encoding Object]A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded.
    -

    This object MAY be extended with Specification Extensions.

    -
    Media Type Examples
    -
    
    -{
    -  "application/json": {
    -    "schema": {
    -         "$ref": "#/components/schemas/Pet"
    -    },
    -    "examples": {
    -      "cat" : {
    -        "summary": "An example of a cat",
    -        "value": 
    -          {
    -            "name": "Fluffy",
    -            "petType": "Cat",
    -            "color": "White",
    -            "gender": "male",
    -            "breed": "Persian"
    -          }
    -      },
    -      "dog": {
    -        "summary": "An example of a dog with a cat's name",
    -        "value" :  { 
    -          "name": "Puma",
    -          "petType": "Dog",
    -          "color": "Black",
    -          "gender": "Female",
    -          "breed": "Mixed"
    -        },
    -      "frog": {
    -          "$ref": "#/components/examples/frog-example"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -application/json: 
    -  schema:
    -    $ref: "#/components/schemas/Pet"
    -  examples:
    -    cat:
    -      summary: An example of a cat
    -      value:
    -        name: Fluffy
    -        petType: Cat
    -        color: White
    -        gender: male
    -        breed: Persian
    -    dog:
    -      summary: An example of a dog with a cat's name
    -      value:
    -        name: Puma
    -        petType: Dog
    -        color: Black
    -        gender: Female
    -        breed: Mixed
    -    frog:
    -      $ref: "#/components/examples/frog-example"
    -
    -
    Considerations for File Uploads
    -

    In contrast with the 2.0 specification, file input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically:

    -
    
    -# content transferred with base64 encoding
    -schema:
    -  type: string
    -  format: base64
    -
    -
    
    -# content transferred in binary (octet-stream):
    -schema:
    -  type: string
    -  format: binary
    -
    -

    These examples apply to either input payloads of file uploads or response payloads.

    -

    A requestBody for submitting a file in a POST operation may look like the following example:

    -
    
    -requestBody:
    -  content:
    -    application/octet-stream:
    -      # any media type is accepted, functionally equivalent to `*/*`
    -      schema:
    -        # a binary file of any type
    -        type: string
    -        format: binary
    -
    -

    In addition, specific media types MAY be specified:

    -
    
    -# multiple, specific media types may be specified:
    -requestBody:
    -  content:
    -      # a binary file of type png or jpeg
    -    'image/jpeg':
    -      schema:
    -        type: string
    -        format: binary
    -    'image/png':
    -      schema:
    -        type: string
    -        format: binary        
    -
    -

    To upload multiple files, a multipart media type MUST be used:

    -
    
    -requestBody:
    -  content:
    -    multipart/form-data:
    -      schema:
    -        properties:
    -          # The property name 'file' will be used for all files.
    -          file:
    -            type: array
    -            items:
    -              type: string
    -              format: binary
    -
    -
    -
    Support for x-www-form-urlencoded Request Bodies
    -

    To submit content using form url encoding via [[!rfc1866]], the following -definition may be used:

    -
    
    -requestBody:
    -  content:
    -    application/x-www-form-urlencoded:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            type: string
    -            format: uuid
    -          address:
    -            # complex types are stringified to support RFC 1866
    -            type: object
    -            properties: {}
    -
    -

    In this example, the contents in the requestBody MUST be stringified per [[!rfc1866]]) when passed to the server. In addition, the address field complex object will be stringified.

    -

    When passing complex objects in the application/x-www-form-urlencoded content type, the default serialization strategy of such properties is described in the Encoding Object's style property as form.

    -
    Special Considerations for multipart Content
    -

    It is common to use multipart/form-data as a Content-Type when transferring request bodies to operations. In contrast to 2.0, a schema is REQUIRED to define the input parameters to the operation when using multipart content. This supports complex structures as well as supporting mechanisms for multiple file uploads.

    -

    When passing in multipart types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default Content-Types are defined for multipart:

    -
      -
    • If the property is a primitive, or an array of primitive values, the default Content-Type is text/plain
    • -
    • If the property is complex, or an array of complex values, the default Content-Type is application/json
    • -
    • If the property is a type: string with format: binary or format: base64 (aka a file object), the default Content-Type is application/octet-stream
    • -
    -

    Examples:

    -
    
    -requestBody:
    -  content:
    -    multipart/form-data:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            type: string
    -            format: uuid
    -          address:
    -            # default Content-Type for objects is `application/json`
    -            type: object
    -            properties: {}
    -          profileImage:
    -            # default Content-Type for string/binary is `application/octet-stream`
    -            type: string
    -            format: binary
    -          children:
    -            # default Content-Type for arrays is based on the `inner` type (text/plain here)
    -            type: array
    -            items:
    -              type: string
    -          addresses:
    -            # default Content-Type for arrays is based on the `inner` type (object shown, so `application/json` in this example)
    -            type: array
    -            items:
    -              type: '#/components/schemas/Address'
    -
    -

    An encoding attribute is introduced to give you control over the serialization of parts of multipart request bodies. This attribute is only applicable to multipart and application/x-www-form-urlencoded request bodies.

    -

    Encoding Object

    -

    A single encoding definition applied to a single schema property.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    contentTypestringThe Content-Type for encoding a specific property. Default value depends on the property type: for string with format being binaryapplication/octet-stream; for other primitive types – text/plain; for object - application/json; for array – the default is defined based on the inner type. The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types.
    headersMap[string, Header Object | Reference Object]A map allowing additional information to be provided as headers, for example Content-Disposition. Content-Type is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a multipart.
    stylestringDescribes how a specific property value will be serialized depending on its type. See Parameter Object for details on the style property. The behavior follows the same values as query parameters, including default values. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
    explodebooleanWhen this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
    allowReservedbooleanDetermines whether the parameter value SHOULD allow reserved characters, as defined by [[!rfc3986]]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
    -

    This object MAY be extended with Specification Extensions.

    -
    Encoding Object Example
    -
    
    -requestBody:
    -  content:
    -    multipart/mixed:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            # default is text/plain
    -            type: string
    -            format: uuid
    -          address:
    -            # default is application/json
    -            type: object
    -            properties: {}
    -          historyMetadata:
    -            # need to declare XML format!
    -            description: metadata in XML format
    -            type: object
    -            properties: {}
    -          profileImage:
    -            # default is application/octet-stream, need to declare an image type only!
    -            type: string
    -            format: binary
    -      encoding:
    -        historyMetadata:
    -          # require XML Content-Type in utf-8 encoding
    -          contentType: application/xml; charset=utf-8
    -        profileImage:
    -          # only accept png/jpeg
    -          contentType: image/png, image/jpeg
    -          headers:
    -            X-Rate-Limit-Limit:
    -              description: The number of allowed requests in the current period
    -              schema:
    -                type: integer
    -
    -

    Responses Object

    -

    A container for the expected responses of an operation. -The container maps a HTTP response code to the expected response.

    -

    The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. -However, documentation is expected to cover a successful operation response and any known errors.

    -

    The default MAY be used as a default response object for all HTTP codes -that are not covered individually by the specification.

    -

    The Responses Object MUST contain at least one response code, and it -SHOULD be the response for a successful operation call.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    defaultResponse Object | Reference ObjectThe documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. A Reference Object can link to a response that the OpenAPI Object’s components/responses section defines.
    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    HTTP Status CodeResponse Object | Reference ObjectAny HTTP status code can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A Reference Object can link to a response that is defined in the OpenAPI Object’s components/responses section. This field MUST be enclosed in quotation marks (for example, “200”) for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character X. For example, 2XX represents all response codes between [200-299]. The following range definitions are allowed: 1XX, 2XX, 3XX, 4XX, and 5XX. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code.
    -

    This object MAY be extended with Specification Extensions.

    -
    Responses Object Example
    -

    A 200 response for a successful operation and a default response for others (implying an error):

    -
    
    -{
    -  "200": {
    -    "description": "a pet to be returned",
    -    "content": {
    -      "application/json": {
    -        "schema": {
    -          "$ref": "#/components/schemas/Pet"
    -        }
    -      }
    -    }
    -  },
    -  "default": {
    -    "description": "Unexpected error",
    -    "content": {
    -      "application/json": {
    -        "schema": {
    -          "$ref": "#/components/schemas/ErrorModel"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -'200':
    -  description: a pet to be returned
    -  content: 
    -    application/json:
    -      schema:
    -        $ref: '#/components/schemas/Pet'
    -default:
    -  description: Unexpected error
    -  content:
    -    application/json:
    -      schema:
    -        $ref: '#/components/schemas/ErrorModel'
    -
    -

    Response Object

    -Describes a single response from an API Operation, including design-time, static -`links` to operations based on the response. -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringREQUIRED. A short description of the response. CommonMark syntax MAY be used for rich text representation.
    headersMap[string, Header Object | Reference Object]Maps a header name to its definition. [[!rfc7230]]page-22) states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored.
    contentMap[string, Media Type Object]A map containing descriptions of potential response payloads. The key is a media type or [media type range]appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
    linksMap[string, Link Object | Reference Object]A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for Component Objects.
    -

    This object MAY be extended with Specification Extensions.

    -
    Response Object Examples
    -

    Response of an array of a complex type:

    -
    
    -{
    -  "description": "A complex object array response",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "$ref": "#/components/schemas/VeryComplexType"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -description: A complex object array response
    -content: 
    -  application/json:
    -    schema: 
    -      type: array
    -      items:
    -        $ref: '#/components/schemas/VeryComplexType'
    -
    -

    Response with a string type:

    -
    
    -{
    -  "description": "A simple string response",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  }
    -
    -}
    -
    -
    
    -description: A simple string response
    -representations:
    -  text/plain:
    -    schema:
    -      type: string
    -
    -

    Plain text response with headers:

    -
    
    -{
    -  "description": "A simple string response",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  },
    -  "headers": {
    -    "X-Rate-Limit-Limit": {
    -      "description": "The number of allowed requests in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    },
    -    "X-Rate-Limit-Remaining": {
    -      "description": "The number of remaining requests in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    },
    -    "X-Rate-Limit-Reset": {
    -      "description": "The number of seconds left in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -description: A simple string response
    -content:
    -  text/plain:
    -    schema:
    -      type: string
    -    example: 'whoa!'
    -headers:
    -  X-Rate-Limit-Limit:
    -    description: The number of allowed requests in the current period
    -    schema:
    -      type: integer
    -  X-Rate-Limit-Remaining:
    -    description: The number of remaining requests in the current period
    -    schema:
    -      type: integer
    -  X-Rate-Limit-Reset:
    -    description: The number of seconds left in the current period
    -    schema:
    -      type: integer
    -
    -

    Response with no return value:

    -
    
    -{
    -  "description": "object created"
    -}
    -
    -
    
    -description: object created
    -
    -

    Callback Object

    -

    A map of possible out-of band callbacks related to the parent operation. -Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. -The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {expression}Path Item ObjectA Path Item Object used to define a callback request and expected responses. A complete example is available.
    -

    This object MAY be extended with Specification Extensions.

    -
    Key Expression
    -

    The key that identifies the Path Item Object is a runtime expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. -A simple example might be $request.body#/url. -However, using a runtime expression the complete HTTP message can be accessed. -This includes accessing any part of a body that a JSON Pointer [[!rfc6901]] can reference.

    -

    For example, given the following HTTP request:

    -
    
    -POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1
    -Host: example.org
    -Content-Type: application/json
    -Content-Length: 187
    -
    -{
    -  "failedUrl" : "http://clientdomain.com/failed",
    -  "successUrls" : [
    -    "http://clientdomain.com/fast",
    -    "http://clientdomain.com/medium",
    -    "http://clientdomain.com/slow"
    -  ] 
    -}
    -
    -201 Created
    -Location: http://example.org/subscription/1
    -
    -

    The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named eventType and a query parameter named queryUrl.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ExpressionValue
    $urlhttp://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning
    $methodPOST
    $request.path.eventTypemyevent
    $request.query.queryUrlhttp://clientdomain.com/stillrunning
    $request.header.content-Typeapplication/json
    $request.body#/failedUrlhttp://clientdomain.com/stillrunning
    $request.body#/successUrls/2http://clientdomain.com/medium
    $response.header.Locationhttp://example.org/subscription/1
    -
    Callback Object Example
    -

    The following example shows a callback to the URL specified by the id and email property in the request body.

    -
    
    -myWebhook:
    -  'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
    -    post:
    -      requestBody:
    -        description: Callback payload
    -        content: 
    -          'application/json':
    -            schema:
    -              $ref: '#/components/schemas/SomePayload'
    -      responses:
    -        '200':
    -          description: webhook successfully processed and no retries will be performed
    -
    -

    Example Object

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    summarystringShort description for the example.
    descriptionstringLong description for the example. CommonMark syntax MAY be used for rich text representation.
    valueAnyEmbedded literal example. The value field and externalValue field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary.
    externalValuestringA URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The value field and externalValue field are mutually exclusive.
    -

    This object MAY be extended with Specification Extensions.

    -

    In all cases, the example value is expected to be compatible with the type schema -of its associated value. Tooling implementations MAY choose to -validate compatibility automatically, and reject the example value(s) if incompatible.

    -
    Example Object Example
    -
    
    -# in a model
    -schemas:
    -  properties:
    -    name:
    -      type: string
    -      examples:
    -        name:
    -          $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example
    -
    -# in a request body:
    -  requestBody:
    -    content:
    -      'application/json':
    -        schema:
    -          $ref: '#/components/schemas/Address'
    -        examples: 
    -          foo:
    -            summary: A foo example
    -            value: {"foo": "bar"}
    -          bar:
    -            summary: A bar example
    -            value: {"bar": "baz"}
    -      'application/xml':
    -        examples: 
    -          xmlExample:
    -            summary: This is an example in XML
    -            externalValue: 'http://example.org/examples/address-example.xml'
    -      'text/plain':
    -        examples:
    -          textExample: 
    -            summary: This is a text example
    -            externalValue: 'http://foo.bar/examples/address-example.txt' 
    -
    -
    -# in a parameter
    -  parameters:
    -    - name: 'zipCode'
    -      in: 'query'
    -      schema:
    -        type: 'string'
    -        format: 'zip-code'
    -        examples:
    -          zip-example: 
    -            $ref: '#/components/examples/zip-example'
    -
    -# in a response
    -  responses:
    -    '200':
    -      description: your car appointment has been booked
    -      content: 
    -        application/json:
    -          schema:
    -            $ref: '#/components/schemas/SuccessResponse'
    -          examples:
    -            confirmation-success:
    -              $ref: '#/components/examples/confirmation-success'
    -
    -

    Link Object

    -

    The Link object represents a possible design-time link for a response. -The presence of a link does not guarantee the caller’s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.

    -

    Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.

    -

    For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    operationRefstringA relative or absolute reference to an OAS operation. This field is mutually exclusive of the operationId field, and MUST point to an Operation Object. Relative operationRef values MAY be used to locate an existing Operation Object in the OpenAPI definition.
    operationIdstringThe name of an existing, resolvable OAS operation, as defined with a unique operationId. This field is mutually exclusive of the operationRef field.
    parametersMap[string, Any | {expression}]A map representing parameters to pass to an operation as specified with operationId or identified via operationRef. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id).
    requestBodyAny | {expression}A literal value or {expression} to use as a request body when calling the target operation.
    descriptionstringA description of the link. CommonMark syntax MAY be used for rich text representation.
    serverServer ObjectA server object to be used by the target operation.
    -

    This object MAY be extended with Specification Extensions.

    -

    A linked operation MUST be identified using either an operationRef or operationId. -In the case of an operationId, it MUST be unique and resolved in the scope of the OAS document. -Because of the potential for name clashes, the operationRef syntax is preferred -for specifications with external references.

    -
    Examples
    -

    Computing a link from a request operation where the $request.path.id is used to pass a request parameter to the linked operation.

    -
    
    -paths:
    -  /users/{id}:
    -    parameters:
    -    - name: id
    -      in: path
    -      required: true
    -      description: the user identifier, as userId 
    -      schema:
    -        type: string
    -    get:
    -      responses:
    -        '200':
    -          description: the user being returned
    -          content:
    -            application/json:
    -              schema:
    -                type: object
    -                properties:
    -                  uuid: # the unique user id
    -                    type: string
    -                    format: uuid
    -        links:
    -          address:
    -            # the target link operationId
    -            operationId: getUserAddress
    -            parameters:
    -              # get the `id` field from the request path parameter named `id`
    -              userId: $request.path.id
    -  # the path item of the linked operation
    -  /users/{userid}/address:
    -    parameters:
    -    - name: userid
    -      in: path
    -      required: true
    -      description: the user identifier, as userId 
    -      schema:
    -        type: string
    -      # linked operation
    -      get:
    -        operationId: getUserAddress
    -        responses:
    -          '200':
    -            description: the user's address
    -
    -

    When a runtime expression fails to evaluate, no parameter value is passed to the target operation.

    -

    Values from the response body can be used to drive a linked operation.

    -
    
    -links:
    -  address:
    -    operationId: getUserAddressByUUID
    -    parameters:
    -      # get the `id` field from the request path parameter named `id`
    -      userUuid: $response.body#/uuid
    -
    -

    Clients follow all links at their discretion. -Neither permissions, nor the capability to make a successful call to that link, is guaranteed -solely by the existence of a relationship.

    -
    OperationRef Examples
    -

    As references to operationId MAY NOT be possible (the operationId is an optional -value), references MAY also be made through a relative operationRef:

    -
    
    -links:
    -  UserRepositories:
    -    # returns array of '#/components/schemas/repository'
    -    operationRef: '#/paths/~12.0~1repositories~1{username}/get'
    -    parameters:
    -      username: $response.body#/username
    -
    -

    or an absolute operationRef:

    -
    
    -links:
    -  UserRepositories:
    -    # returns array of '#/components/schemas/repository'
    -    operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get'
    -    parameters:
    -      username: $response.body#/username
    -
    -

    Note that in the use of operationRef, the escaped forward-slash is necessary when -using JSON references.

    -
    Runtime Expressions
    -

    Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. -This mechanism is used by Link Objects and Callback Objects.

    -

    The runtime expression is defined by the following [Advanced Backus-Naur Form] syntax

    -
    
    -      expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source )
    -      source = ( header-reference | query-reference | path-reference | body-reference )  
    -      header-reference = "header." token
    -      query-reference = "query." name  
    -      path-reference = "path." name
    -      body-reference = "body" ["#" fragment]
    -      fragment = a JSON Pointer [[!rfc6901]]  
    -      name = *( char )
    -      char = as per RFC [7159]section-7)
    -      token = as per RFC [7230]section-3.2.6)
    -
    -

    The name identifier is case-sensitive, whereas token is not.

    -

    The table below provides examples of runtime expressions and examples of their use in a value:

    -
    Examples
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Source Locationexample expressionnotes
    HTTP Method$methodThe allowable values for the $method will be those for the HTTP operation.
    Requested media type$request.header.accept
    Request parameter$request.path.idRequest parameters MUST be declared in the parameters section of the parent operation or they cannot be evaluated. This includes request headers.
    Request body property$request.body#/user/uuidIn operations which accept payloads, references may be made to portions of the requestBody or the entire body.
    Request URL$url
    Response value$response.body#/statusIn operations which return payloads, references may be made to portions of the response body or the entire body.
    Response header$response.header.ServerSingle header values only are available
    -

    Runtime expressions preserve the type of the referenced value. -Expressions can be embedded into string values by surrounding the expression with {} curly braces.

    -

    Header Object

    -

    The Header Object follows the structure of the Parameter Object with the following changes:

    -
      -
    1. name MUST NOT be specified, it is given in the corresponding headers map.
    2. -
    3. in MUST NOT be specified, it is implicitly in header.
    4. -
    5. All traits that are affected by the location MUST be applicable to a location of header (for example, style).
    6. -
    -
    Header Object Example
    -

    A simple header of type integer:

    -
    
    -{
    -  "description": "The number of allowed requests in the current period",
    -  "schema": {
    -    "type": "integer"
    -  }
    -}
    -
    -
    
    -description: The number of allowed requests in the current period
    -schema:
    -  type: integer
    -
    -

    Tag Object

    -

    Adds metadata to a single tag that is used by the Operation Object. -It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringREQUIRED. The name of the tag.
    descriptionstringA short description for the tag. CommonMark syntax MAY be used for rich text representation.
    externalDocsExternal Documentation ObjectAdditional external documentation for this tag.
    -

    This object MAY be extended with Specification Extensions.

    -
    Tag Object Example
    -
    
    -{
    -	"name": "pet",
    -	"description": "Pets operations"
    -}
    -
    -
    
    -name: pet
    -description: Pets operations
    -
    -

    Examples Object

    -

    In an example, a JSON Reference MAY be used, with the -explicit restriction that examples having a JSON format with object named -$ref are not allowed. Therefore, that example, structurally, can be -either a string primitive or an object, similar to additionalProperties.

    -

    In all cases, the payload is expected to be compatible with the type schema -for the associated value. Tooling implementations MAY choose to -validate compatibility automatically, and reject the example value(s) if they -are incompatible.

    -
    
    -# in a model
    -schemas:
    -  properties:
    -    name:
    -      type: string
    -      example:
    -        $ref: http://foo.bar#/examples/name-example
    -
    -# in a request body, note the plural `examples`
    -  requestBody:
    -    content:
    -      'application/json':
    -        schema:
    -          $ref: '#/components/schemas/Address'
    -        examples:
    -          foo:
    -            value: {"foo": "bar"}
    -          bar:
    -            value: {"bar": "baz"}
    -      'application/xml':
    -        examples:
    -          xml:
    -            externalValue: 'http://foo.bar/examples/address-example.xml'
    -      'text/plain':
    -        examples:
    -          text:
    -            externalValue: 'http://foo.bar/examples/address-example.txt'
    -        
    -# in a parameter
    -  parameters:
    -    - name: 'zipCode'
    -      in: 'query'
    -      schema:
    -        type: 'string'
    -        format: 'zip-code'
    -        example: 
    -          $ref: 'http://foo.bar#/examples/zip-example'
    -
    -# in a response, note the singular `example`:
    -  responses:
    -    '200':
    -      description: your car appointment has been booked
    -      content: 
    -        application/json:
    -          schema:
    -            $ref: '#/components/schemas/SuccessResponse'
    -          example:
    -            $ref: http://foo.bar#/examples/address-example.json
    -
    -

    Reference Object

    -

    A simple object to allow referencing other components in the specification, internally and externally.

    -

    The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.

    -

    For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    $refstringREQUIRED. The reference string.
    -

    This object cannot be extended with additional properties and any properties added SHALL be ignored.

    -
    Reference Object Example
    -
    
    -{
    -	"$ref": "#/components/schemas/Pet"
    -}
    -
    -
    
    -$ref: '#/components/schemas/Pet'
    -
    -
    Relative Schema Document Example
    -
    
    -{
    -  "$ref": "Pet.json"
    -}
    -
    -
    
    -$ref: Pet.yaml
    -
    -
    Relative Documents With Embedded Schema Example
    -
    
    -{
    -  "$ref": "definitions.json#/Pet"
    -}
    -
    -
    
    -$ref: definitions.yaml#/Pet
    -
    -

    Schema Object

    -

    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 an extended subset of the JSON Schema Specification Wright Draft 00.

    -

    For more information about the properties, see JSON Schema Core and JSON Schema Validation. -Unless stated otherwise, the property definitions follow the JSON Schema.

    -
    Properties
    -

    The following properties are taken directly from the JSON Schema definition and follow the same specifications:

    -
      -
    • title
    • -
    • multipleOf
    • -
    • maximum
    • -
    • exclusiveMaximum
    • -
    • minimum
    • -
    • exclusiveMinimum
    • -
    • maxLength
    • -
    • minLength
    • -
    • pattern (This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect)
    • -
    • maxItems
    • -
    • minItems
    • -
    • uniqueItems
    • -
    • maxProperties
    • -
    • minProperties
    • -
    • required
    • -
    • enum
    • -
    -

    The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification.

    -
      -
    • type - Value MUST be a string. Multiple types via an array are not supported.
    • -
    • allOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • oneOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • anyOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • not - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. items MUST be present if the type is array.
    • -
    • properties - Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced).
    • -
    • additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • description - CommonMark syntax MAY be used for rich text representation.
    • -
    • format - See Data Type Formats for further details. While relying on JSON Schema’s defined formats, the OAS offers a few additional predefined formats.
    • -
    • default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if type is string, then default can be "foo" but cannot be 1.
    • -
    -

    Alternatively, any time a Schema Object can be used, a Reference Object can be used in its place. This allows referencing definitions instead of defining them inline.

    -

    Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported.

    -

    Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation:

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    nullablebooleanAllows sending a null value for the defined schema. Default value is false.
    discriminatorDiscriminator ObjectAdds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See Composition and Inheritance for more details.
    readOnlybooleanRelevant only for Schema "properties" definitions. Declares the property as “read only”. This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.
    writeOnlybooleanRelevant only for Schema "properties" definitions. Declares the property as “write only”. Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as writeOnly being true and is in the required list, the required will take effect on the request only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.
    xmlXML ObjectThis MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property.
    externalDocsExternal Documentation ObjectAdditional external documentation for this schema.
    exampleAnyA free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary.
    deprecatedbooleanSpecifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false.
    -

    This object MAY be extended with Specification Extensions.

    -
    Composition and Inheritance (Polymorphism)
    -

    The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. -allOf takes an array of object definitions that are validated independently but together compose a single object.

    -

    While composition offers model extensibility, it does not imply a hierarchy between the models. -To support polymorphism, the OpenAPI Specification adds the discriminator field. -When used, the discriminator will be the name of the property that decides which schema definition validates the structure of the model. -As such, the discriminator field MUST be a required field. -There are are two ways to define the value of a discriminator for an inheriting instance.

    -
      -
    • Use the schema name.
    • -
    • Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name. -As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism.
    • -
    -
    XML Modeling
    -

    The xml property allows extra definitions when translating the JSON definition to XML. -The XML Object contains additional information about the available options.

    -
    Schema Object Examples
    -
    Primitive Sample
    -
    
    -{
    -  "type": "string",
    -  "format": "email"
    -}
    -
    -
    
    -type: string
    -format: email
    -
    -
    Simple Model
    -
    
    -{
    -  "type": "object",
    -  "required": [
    -    "name"
    -  ],
    -  "properties": {
    -    "name": {
    -      "type": "string"
    -    },
    -    "address": {
    -      "$ref": "#/components/schemas/Address"
    -    },
    -    "age": {
    -      "type": "integer",
    -      "format": "int32",
    -      "minimum": 0
    -    }
    -  }
    -}
    -
    -
    
    -type: object
    -required:
    -- name
    -properties:
    -  name:
    -    type: string
    -  address:
    -    $ref: '#/components/schemas/Address'
    -  age:
    -    type: integer
    -    format: int32
    -    minimum: 0
    -
    -
    Model with Map/Dictionary Properties
    -

    For a simple string to string mapping:

    -
    
    -{
    -  "type": "object",
    -  "additionalProperties": {
    -    "type": "string"
    -  }
    -}
    -
    -
    
    -type: object
    -additionalProperties:
    -  type: string
    -
    -

    For a string to model mapping:

    -
    
    -{
    -  "type": "object",
    -  "additionalProperties": {
    -    "$ref": "#/components/schemas/ComplexModel"
    -  }
    -}
    -
    -
    
    -type: object
    -additionalProperties:
    -  $ref: '#/components/schemas/ComplexModel'
    -
    -
    Model with Example
    -
    
    -{
    -  "type": "object",
    -  "properties": {
    -    "id": {
    -      "type": "integer",
    -      "format": "int64"
    -    },
    -    "name": {
    -      "type": "string"
    -    }
    -  },
    -  "required": [
    -    "name"
    -  ],
    -  "example": {
    -    "name": "Puma",
    -    "id": 1
    -  }
    -}
    -
    -
    
    -type: object
    -properties:
    -  id:
    -    type: integer
    -    format: int64
    -  name:
    -    type: string
    -required:
    -- name
    -example:
    -  name: Puma
    -  id: 1
    -
    -
    Models with Composition
    -
    
    -{
    -  "components": {
    -    "schemas": {
    -      "ErrorModel": {
    -        "type": "object",
    -        "required": [
    -          "message",
    -          "code"
    -        ],
    -        "properties": {
    -          "message": {
    -            "type": "string"
    -          },
    -          "code": {
    -            "type": "integer",
    -            "minimum": 100,
    -            "maximum": 600
    -          }
    -        }
    -      },
    -      "ExtendedErrorModel": {
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/ErrorModel"
    -          },
    -          {
    -            "type": "object",
    -            "required": [
    -              "rootCause"
    -            ],
    -            "properties": {
    -              "rootCause": {
    -                "type": "string"
    -              }
    -            }
    -          }
    -        ]
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -components:
    -  schemas:
    -    ErrorModel:
    -      type: object
    -      required:
    -      - message
    -      - code
    -      properties:
    -        message:
    -          type: string
    -        code:
    -          type: integer
    -          minimum: 100
    -          maximum: 600
    -    ExtendedErrorModel:
    -      allOf:
    -      - $ref: '#/components/schemas/ErrorModel'
    -      - type: object
    -        required:
    -        - rootCause
    -        properties:
    -          rootCause:
    -            type: string
    -
    -
    Models with Polymorphism Support
    -
    
    -{
    -  "components": {
    -    "schemas": {
    -      "Pet": {
    -        "type": "object",
    -        "discriminator": {
    -          "propertyName": "petType"
    -        },
    -        "properties": {
    -          "name": {
    -            "type": "string"
    -          },
    -          "petType": {
    -            "type": "string"
    -          }
    -        },
    -        "required": [
    -          "name",
    -          "petType"
    -        ]
    -      },
    -      "Cat": {
    -        "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.",
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/Pet"
    -          },
    -          {
    -            "type": "object",
    -            "properties": {
    -              "huntingSkill": {
    -                "type": "string",
    -                "description": "The measured skill for hunting",
    -                "default": "lazy",
    -                "enum": [
    -                  "clueless",
    -                  "lazy",
    -                  "adventurous",
    -                  "aggressive"
    -                ]
    -              }
    -            },
    -            "required": [
    -              "huntingSkill"
    -            ]
    -          }
    -        ]
    -      },
    -      "Dog": {
    -        "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.",
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/Pet"
    -          },
    -          {
    -            "type": "object",
    -            "properties": {
    -              "packSize": {
    -                "type": "integer",
    -                "format": "int32",
    -                "description": "the size of the pack the dog is from",
    -                "default": 0,
    -                "minimum": 0
    -              }
    -            },
    -            "required": [
    -              "packSize"
    -            ]
    -          }
    -        ]
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -components:
    -  schemas:
    -    Pet:
    -      type: object
    -      discriminator:
    -        propertyName: petType
    -      properties:
    -        name:
    -          type: string
    -        petType:
    -          type: string
    -      required:
    -      - name
    -      - petType
    -    Cat:  ## "Cat" will be used as the discriminator value
    -      description: A representation of a cat
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        properties:
    -          huntingSkill:
    -            type: string
    -            description: The measured skill for hunting
    -            enum:
    -            - clueless
    -            - lazy
    -            - adventurous
    -            - aggressive
    -        required:
    -        - huntingSkill
    -    Dog:  ## "Dog" will be used as the discriminator value
    -      description: A representation of a dog
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        properties:
    -          packSize:
    -            type: integer
    -            format: int32
    -            description: the size of the pack the dog is from
    -            default: 0
    -            minimum: 0
    -        required:
    -        - packSize
    -
    -
    Discriminator Object
    -

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    -

    When using the discriminator, inline schemas will not be considered.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    propertyNamestringREQUIRED. The name of the property in the payload that will hold the discriminator value.
    mappingMap[string, string]An object to hold mappings between payload values and schema names or references.
    -

    The discriminator attribute is legal only when using one of the composite keywords oneOf, anyOf, allOf.

    -

    In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:

    -
    
    -MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -
    -

    which means the payload MUST, by validation, match exactly one of the schemas described by Cat, Dog, or Lizard. In this case, a discriminator MAY act as a “hint” to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use:

    -
    
    -MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -  discriminator:
    -    propertyName: pet_type
    -
    -

    The expectation now is that a property with name pet_type MUST be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload:

    -
    
    -{
    -  "id": 12345,
    -  "pet_type": "Cat"
    -}
    -
    -

    Will indicate that the Cat schema be used in conjunction with this payload.

    -

    In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional mapping definition MAY be used:

    -
    
    -MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -  - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json'
    -  discriminator:
    -    propertyName: pet_type
    -    mapping:
    -      dog: '#/components/schemas/Dog'
    -      monster: 'https://gigantic-server.com/schemas/Monster/schema.json'
    -
    -

    Here the discriminator value of dog will map to the schema #/components/schemas/Dog, rather than the default (implicit) value of Dog. If the discriminator value does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison.

    -

    When used in conjunction with the anyOf construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload.

    -

    In both the oneOf and anyOf use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an allOf construct may be used as an alternate schema.

    -

    For example:

    -
    
    -components:
    -  schemas:
    -    Pet:
    -      type: object
    -      required:
    -      - pet_type
    -      properties:
    -        pet_type:
    -          type: string
    -      discriminator:
    -        propertyName: pet_type
    -        mapping:
    -          cachorro: Dog
    -    Cat:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a `Cat`
    -        properties:
    -          name:
    -            type: string
    -    Dog:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a `Dog`
    -        properties:
    -          bark:
    -            type: string
    -    Lizard:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a `Lizard`
    -        properties:
    -          lovesRocks:
    -            type: boolean
    -
    -

    a payload like this:

    -
    
    -{
    -  "pet_type": "Cat",
    -  "name": "misty"
    -}
    -
    -

    will indicate that the Cat schema be used. Likewise this schema:

    -
    
    -{
    -  "pet_type": "cachorro",
    -  "bark": "soft"
    -}
    -
    -

    will map to Dog because of the definition in the mappings element.

    -

    XML Object

    -

    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.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringReplaces the name of the element/attribute used for the described schema property. When defined within 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.
    namespacestringThe URI of the namespace definition. Value MUST be in the form of an absolute URI.
    prefixstringThe prefix to be used for the name.
    attributebooleanDeclares whether the property definition translates to an attribute instead of an element. Default value is false.
    wrappedbooleanMAY 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).
    -

    This object MAY be extended with Specification Extensions.

    -
    XML Object Examples
    -

    The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

    -
    No XML Element
    -

    Basic string property:

    -
    
    -{
    -    "animals": {
    -        "type": "string"
    -    }
    -}
    -
    -
    
    -animals:
    -  type: string
    -
    -
    
    -<animals>...</animals>
    -
    -

    Basic string array property (wrapped is false by default):

    -
    
    -{
    -    "animals": {
    -        "type": "array",
    -        "items": {
    -            "type": "string"
    -        }
    -    }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -
    -
    
    -<animals>...</animals>
    -<animals>...</animals>
    -<animals>...</animals>
    -
    -
    XML Name Replacement
    -
    
    -{
    -  "animals": {
    -    "type": "string",
    -    "xml": {
    -      "name": "animal"
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: string
    -  xml:
    -    name: animal
    -
    -
    
    -<animal>...</animal>
    -
    -
    XML Attribute, Prefix and Namespace
    -

    In this example, a full model definition is shown.

    -
    
    -{
    -  "Person": {
    -    "type": "object",
    -    "properties": {
    -      "id": {
    -        "type": "integer",
    -        "format": "int32",
    -        "xml": {
    -          "attribute": true
    -        }
    -      },
    -      "name": {
    -        "type": "string",
    -        "xml": {
    -          "namespace": "http://example.com/schema/sample",
    -          "prefix": "sample"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -Person:
    -  type: object
    -  properties:
    -    id:
    -      type: integer
    -      format: int32
    -      xml:
    -        attribute: true
    -    name:
    -      type: string
    -      xml:
    -        namespace: http://example.com/schema/sample
    -        prefix: sample
    -
    -
    
    -<Person id="123">
    -    <sample:name xmlns:sample="http://example.com/schema/sample">example</sample:name>
    -</Person>
    -
    -
    XML Arrays
    -

    Changing the element names:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -
    -
    
    -<animal>value</animal>
    -<animal>value</animal>
    -
    -

    The external name property has no effect on the XML:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens"
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -
    -
    
    -<animal>value</animal>
    -<animal>value</animal>
    -
    -

    Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    wrapped: true
    -
    -
    
    -<animals>
    -  <animals>value</animals>
    -  <animals>value</animals>
    -</animals>
    -
    -

    To overcome the naming problem in the example above, the following definition can be used:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    wrapped: true
    -
    -
    
    -<animals>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</animals>
    -
    -

    Affecting both internal and external names:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    
    -<aliens>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</aliens>
    -
    -

    If we change the external element but not the internal ones:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    
    -<aliens>
    -  <aliens>value</aliens>
    -  <aliens>value</aliens>
    -</aliens>
    -
    -
    Security Scheme Object
    -

    Defines a security scheme that can be used by the operations. -Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [[!rfc6749]], and OpenID Connect Discovery.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeApplies ToDescription
    typestringAnyREQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "oauth2", "openIdConnect".
    descriptionstringAnyA short description for security scheme. CommonMark syntax MAY be used for rich text representation.
    namestringapiKeyREQUIRED. The name of the header, query or cookie parameter to be used.
    instringapiKeyREQUIRED. The location of the API key. Valid values are "query", "header" or "cookie".
    schemestringhttpREQUIRED. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235]section-5.1).
    bearerFormatstringhttp ("bearer")A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes.
    flowsOAuth Flows Objectoauth2REQUIRED. An object containing configuration information for the flow types supported.
    openIdConnectUrlstringopenIdConnectREQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL.
    -

    This object MAY be extended with Specification Extensions.

    -
    Security Scheme Object Example
    -
    Basic Authentication Sample
    -
    
    -{
    -  "type": "http",
    -  "scheme": "basic"
    -}
    -
    -
    
    -type: http
    -scheme: basic
    -
    -
    API Key Sample
    -
    
    -{
    -  "type": "apiKey",
    -  "name": "api_key",
    -  "in": "header"
    -}
    -
    -
    
    -type: apiKey
    -name: api_key
    -in: header
    -
    -
    JWT Bearer Sample
    -
    
    -{
    -  "type": "http",
    -  "scheme": "bearer",
    -  "bearerFormat": "JWT",
    -}
    -
    -
    
    -type: http
    -scheme: bearer
    -bearerFormat: JWT
    -
    -
    Implicit OAuth2 Sample
    -
    
    -{
    -  "type": "oauth2",
    -  "flows": {
    -    "implicit": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -type: oauth2
    -flows: 
    -  implicit:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets
    -
    -
    OAuth Flows Object
    -

    Allows configuration of the supported OAuth Flows.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    implicitOAuth Flow ObjectConfiguration for the OAuth Implicit flow
    passwordOAuth Flow ObjectConfiguration for the OAuth Resource Owner Password flow
    clientCredentialsOAuth Flow ObjectConfiguration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0.
    authorizationCodeOAuth Flow ObjectConfiguration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.
    -

    This object MAY be extended with Specification Extensions.

    -

    OAuth Flow Object

    -

    Configuration details for a supported OAuth Flow

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeApplies ToDescription
    authorizationUrlstringoauth2 ("implicit", "authorizationCode")REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL.
    tokenUrlstringoauth2 ("password", "clientCredentials", "authorizationCode")REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL.
    refreshUrlstringoauth2The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.
    scopesMap[string, string]oauth2REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it.
    -

    This object MAY be extended with Specification Extensions.

    -
    OAuth Flow Object Examples
    -
    
    -{
    -  "type": "oauth2",
    -  "flows": {
    -    "implicit": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    },
    -    "authorizationCode": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "tokenUrl": "https://example.com/api/oauth/token",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -type: oauth2
    -flows: 
    -  implicit:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets
    -  authorizationCode:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    tokenUrl: https://example.com/api/oauth/token
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets 
    -
    -

    Security Requirement Object

    -

    Lists the required security schemes to execute this operation. -The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.

    -

    Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. -This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.

    -

    When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}[string]Each name MUST correspond to a security scheme which is declared in the Security Schemes under the Components Object. If the security scheme is of type "oauth2" or "openIdConnect", then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty.
    -
    Security Requirement Object Examples
    -
    Non-OAuth2 Security Requirement
    -
    
    -{
    -  "api_key": []
    -}
    -
    -
    
    -api_key: []
    -
    -
    OAuth2 Security Requirement
    -
    
    -{
    -  "petstore_auth": [
    -    "write:pets",
    -    "read:pets"
    -  ]
    -}
    -
    -
    
    -petstore_auth:
    -- write:pets
    -- read:pets
    -
    -
    Specification Extensions
    -

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    -

    The extensions properties are implemented as patterned fields that are always prefixed by "x-".

    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the OpenAPI Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. 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).

    -
    Security Filtering
    -

    Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.

    -

    The reasoning is to allow an additional layer of access control over the documentation. -While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.

    -

    Two examples of this:

    -
      -
    1. The Paths Object MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication.
    2. -
    3. The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object, so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see.
    4. -
    -
    Appendix A: Revision History
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    VersionDateNotes
    3.0.02017-07-26Release of the OpenAPI Specification 3.0.0
    3.0.0-rc22017-06-16rc2 of the 3.0 specification
    3.0.0-rc12017-04-27rc1 of the 3.0 specification
    3.0.0-rc02017-02-28Implementer’s Draft of the 3.0 specification
    2.02015-12-31Donation of Swagger 2.0 to the Open API Initiative
    2.02014-09-08Release of Swagger 2.0
    1.22014-03-14Initial release of the formal document.
    1.12012-08-22Release of Swagger 1.1
    1.02011-08-10First release of the Swagger Specification
    - diff --git a/bikeshed/v3/oas_3.0.0.err b/bikeshed/v3/oas_3.0.0.err deleted file mode 100644 index 51499ac0a9..0000000000 --- a/bikeshed/v3/oas_3.0.0.err +++ /dev/null @@ -1,3 +0,0 @@ -Error running preprocessor, returned code: 1. -\033[1;31mFATAL ERROR:\033[0m Found unmatched text macro [R]. Correct the macro, or escape it with a leading backslash. -\033[7;31m ✘ \033[0m Did not generate, due to fatal errors \ No newline at end of file From b5ceccc65719912e72d69bd0889137d0ac19dc36 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Thu, 7 Dec 2017 11:04:12 +0000 Subject: [PATCH 08/34] bikeshed; separate header for v3.0.1 for now --- bikeshed/build.sh | 4 +- bikeshed/md2bs.js | 2 + bikeshed/v2/2.0.bs | 8 +- bikeshed/v2/oas_2.0.html | 10 +- bikeshed/v3/3.0.0.bs | 52 +- bikeshed/v3/3.0.1.bs | 4030 ++++++++++++++++++ bikeshed/v3/{heading.bs => h3.0.0.bs} | 0 bikeshed/v3/h3.0.1.bs | 62 + bikeshed/v3/oas_3.0.0.html | 54 +- bikeshed/v3/oas_3.0.1.html | 5622 +++++++++++++++++++++++++ 10 files changed, 9780 insertions(+), 64 deletions(-) create mode 100644 bikeshed/v3/3.0.1.bs rename bikeshed/v3/{heading.bs => h3.0.0.bs} (100%) create mode 100644 bikeshed/v3/h3.0.1.bs create mode 100644 bikeshed/v3/oas_3.0.1.html diff --git a/bikeshed/build.sh b/bikeshed/build.sh index a1b1b026e9..ab7807479f 100644 --- a/bikeshed/build.sh +++ b/bikeshed/build.sh @@ -1,12 +1,12 @@ #!/bin/sh node md2bs.js ../versions/3.0.0.md > v3/3.0.0.bs -cat v3/heading.bs style-start.html syntax-github.css style-finish.html v3/3.0.0.bs > v3/input.bs +cat v3/h3.0.0.bs style-start.html syntax-github.css style-finish.html v3/3.0.0.bs > v3/input.bs curl https://api.csswg.org/bikeshed/ -F file=@v3/input.bs -F output=err > v3/oas_3.0.0.err curl https://api.csswg.org/bikeshed/ -F file=@v3/input.bs -F force=1 > v3/oas_3.0.0.html node md2bs.js ../versions/3.0.1.md > v3/3.0.1.bs -cat v3/heading.bs style-start.html syntax-github.css style-finish.html v3/3.0.1.bs > v3/input.bs +cat v3/h3.0.1.bs style-start.html syntax-github.css style-finish.html v3/3.0.1.bs > v3/input.bs curl https://api.csswg.org/bikeshed/ -F file=@v3/input.bs -F output=err > v3/oas_3.0.1.err curl https://api.csswg.org/bikeshed/ -F file=@v3/input.bs -F force=1 > v3/oas_3.0.1.html diff --git a/bikeshed/md2bs.js b/bikeshed/md2bs.js index d60c16cc27..d7ccc87602 100644 --- a/bikeshed/md2bs.js +++ b/bikeshed/md2bs.js @@ -82,6 +82,8 @@ for (let l in lines) { return '\\['+group1+']'; }); + line = line.split('\\|').join('¦'); + while (line.indexOf('https://tools.ietf.org/html/rfc')>=0) { line = line.replace(/.https:..tools.ietf.org.html.rfc[0-9]{1,5}./g,''); } diff --git a/bikeshed/v2/2.0.bs b/bikeshed/v2/2.0.bs index ab7f2bd200..5a2f85a66a 100644 --- a/bikeshed/v2/2.0.bs +++ b/bikeshed/v2/2.0.bs @@ -584,7 +584,7 @@ A Path Item may be empty, due to ACL constraints parameters -[Parameter Object | Reference Object] +[Parameter Object ¦ Reference Object] 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. @@ -728,7 +728,7 @@ A Path Item may be empty, due to ACL constraints parameters -[Parameter Object | Reference Object] +[Parameter Object ¦ Reference Object] 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. @@ -1394,7 +1394,7 @@ A Path Item may be empty, due to ACL constraints default -Response Object | Reference Object +Response Object ¦ Reference Object 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. @@ -1411,7 +1411,7 @@ A Path Item may be empty, due to ACL constraints {HTTP Status Code} -Response Object | Reference Object +Response Object ¦ Reference Object Any HTTP status code can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. Reference Object can be used to link to a response that is defined at the Swagger Object’s responses section. diff --git a/bikeshed/v2/oas_2.0.html b/bikeshed/v2/oas_2.0.html index 0c2016897a..01a4be793b 100644 --- a/bikeshed/v2/oas_2.0.html +++ b/bikeshed/v2/oas_2.0.html @@ -1179,7 +1179,7 @@ } } - + + + + + + + + +Open API Initiative logo diff --git a/bikeshed/v3/oas_3.0.0.html b/bikeshed/v3/oas_3.0.0.html index f920deb230..7df67ad371 100644 --- a/bikeshed/v3/oas_3.0.0.html +++ b/bikeshed/v3/oas_3.0.0.html @@ -1176,7 +1176,7 @@ } } - + + + + + + + + + + + +
    +

    +

    OpenAPI Specification

    +

    Living Standard,

    +
    +
    +
    This version: +
    https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md +
    Issue Tracking: +
    GitHub +
    Editors: +
    Darrel Miller +
    Jeremy Whitlock +
    Marsh Gardiner +
    Ron Ratovsky +
    Former Editors: +
    Jason Harmon +
    Tony Tam +
    +
    +
    + +
    +
    +
    +

    Abstract

    +

    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    +
    +
    + +
    + + + +

    Open API Initiative logo

    +

    1. Version 3.0.1

    +

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [rfc2119] [rfc8174] when, and only when, they appear in all capitals, as shown here.

    +

    This document is licensed under The Apache License, Version 2.0.

    +

    2. Introduction

    +

    The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.

    +

    An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.

    +

    3. Definitions

    +

    3.1. OpenAPI Document

    + A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification. +

    3.2. Path Templating

    + Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. +

    3.3. Media Types

    + Media type definitions are spread across several resources. +The media type definitions SHOULD be in compliance with [rfc6838]. +

    Some examples of possible media type definitions:

    +
    text/plain; charset=utf-8
    +application/json
    +application/vnd.github+json
    +application/vnd.github.v3+json
    +application/vnd.github.v3.raw+json
    +application/vnd.github.v3.text+json
    +application/vnd.github.v3.html+json
    +application/vnd.github.v3.full+json
    +application/vnd.github.v3.diff
    +application/vnd.github.v3.patch
    +
    +

    3.4. HTTP Status Codes

    + The HTTP Status Codes are used to indicate the status of the executed operation. +The available status codes are defined by [rfc7231]section-6) and registered status codes are listed in the IANA Status Code Registry. +

    4. Specification

    +

    4.1. Versions

    +

    The OpenAPI Specification is versioned using Semantic Versioning 2.0.0 (semver) and follows the semver specification.

    +

    The major.minor portion of the semver (for example 3.0) SHALL designate the OAS feature set. Typically, .patch versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between 3.0.0 and 3.0.1 for example.

    +

    Subsequent minor version releases of the OpenAPI Specification (incrementing the minor version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical 3.1.0 specification SHOULD be usable with tooling designed for 3.0.0.

    +

    An OpenAPI document compatible with OAS 3.. contains a required openapi field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named swagger and value "2.0".)

    +

    4.2. Format

    +

    An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format.

    +

    For example, if a field has an array value, the JSON array representation will be used:

    +
    {
    +   "field": [ 1, 2, 3 ]
    +}
    +
    +

    All field names in the specification are case sensitive.

    +

    The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name.

    +

    Patterned fields MUST have unique names within the containing object.

    +

    In order to preserve the ability to round-trip between YAML and JSON formats, YAML version 1.2 is RECOMMENDED along with some additional constraints:

    + +

    Note: While APIs may be defined by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML.

    +

    4.3. Document Structure

    +

    An OpenAPI document MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the user. In the latter case, $ref fields MUST be used in the specification to reference those parts as follows from the JSON Schema definitions.

    +

    It is RECOMMENDED that the root OpenAPI document be named: openapi.json or openapi.yaml.

    +

    4.4. Data Types

    +

    Primitive data types in the OAS are based on the types supported by the JSON Schema Specification Wright Draft 00. +Note that integer as a type is also supported and is defined as a JSON number without a fraction or exponent part. null is not supported as a type (see nullable for an alternative solution). +Models are defined using the Schema Object, which is an extended subset of JSON Schema Specification Wright Draft 00.

    +

    Primitives have an optional modifier property: format. +OAS uses several known formats to define in fine detail the data type being used. +However, to support documentation needs, the format property is an open string-valued property, and can have any value. +Formats such as "email", "uuid", and so on, MAY be used even though undefined by this specification. +Types that are not accompanied by a format property follow the type definition in the JSON Schema. Tools that do not recognize a specific format MAY default back to the type alone, as if the format is not specified.

    +

    The formats defined by the OAS are:

    + + + + + + + + + + + + + + + +
    Common Name + type + format + Comments +
    integer + integer + int32 + signed 32 bits +
    long + integer + int64 + signed 64 bits +
    float + number + float + +
    double + number + double + +
    string + string + + +
    byte + string + byte + base64 encoded characters +
    binary + string + binary + any sequence of octets +
    boolean + boolean + + +
    date + string + date + As defined by full-date - [!rfc3339] +
    dateTime + string + date-time + As defined by date-time - [!rfc3339] +
    password + string + password + A hint to UIs to obscure input. +
    +

    4.5. Rich Text Formatting

    + Throughout the specification description fields are noted as supporting CommonMark markdown formatting. +Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by CommonMark 0.27. Tooling MAY choose to ignore some CommonMark features to address security concerns. +

    4.6. Relative References in URLs

    +

    Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [rfc3986]section-4.2). +Relative references are resolved using the URLs defined in the Server Object as a Base URI.

    +

    Relative references used in $ref are processed as per JSON Reference, using the URL of the current document as the base URI. See also the Reference Object.

    +

    4.7. Schema

    +

    In the following description, if a field is not explicitly REQUIRED or described with a MUST or SHALL, it can be considered OPTIONAL.

    +

    4.7.1. OpenAPI Object

    +

    This is the root document object of the OpenAPI document.

    +

    4.7.2. Fixed Fields

    + + + + + + + + + + + + +
    Field Name + Type + Description +
    openapi + string + REQUIRED. This string MUST be the semantic version number of the OpenAPI Specification version that the OpenAPI document uses. The openapi field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is not related to the API info.version string. +
    info + Info Object + REQUIRED. Provides metadata about the API. The metadata MAY be used by tooling as required. +
    servers + [Server Object] + An array of Server Objects, which provide connectivity information to a target server. If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url value of /. +
    paths + Paths Object + REQUIRED. The available paths and operations for the API. +
    components + Components Object + An element to hold various schemas for the specification. +
    security + [Security Requirement Object] + A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. +
    tags + [Tag Object] + 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. +
    externalDocs + External Documentation Object + Additional external documentation. +
    +

    This object MAY be extended with Specification Extensions.

    +

    4.7.3. Info Object

    +

    The object provides metadata about the API. +The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.

    +
    4.7.3.1. Fixed Fields
    + + + + + + + + + + +
    Field Name + Type + Description +
    title + string + REQUIRED. The title of the application. +
    description + string + A short description of the application. CommonMark syntax MAY be used for rich text representation. +
    termsOfService + string + A URL to the Terms of Service for the API. MUST be in the format of a URL. +
    contact + Contact Object + The contact information for the exposed API. +
    license + License Object + The license information for the exposed API. +
    version + string + REQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version). +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.3.2. Info Object Example:
    +
    {
    +  "title": "Sample Pet Store App",
    +  "description": "This is a sample server for a pet store.",
    +  "termsOfService": "http://example.com/terms/",
    +  "contact": {
    +    "name": "API Support",
    +    "url": "http://www.example.com/support",
    +    "email": "support@example.com"
    +  },
    +  "license": {
    +    "name": "Apache 2.0",
    +    "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    +  },
    +  "version": "1.0.1"
    +}
    +
    +
    title: Sample Pet Store App
    +description: This is a sample server for a pet store.
    +termsOfService: http://example.com/terms/
    +contact:
    +  name: API Support
    +  url: http://www.example.com/support
    +  email: support@example.com
    +license:
    +  name: Apache 2.0
    +  url: https://www.apache.org/licenses/LICENSE-2.0.html
    +version: 1.0.1
    +
    +

    4.7.4. Contact Object

    +

    Contact information for the exposed API.

    +
    4.7.4.1. Fixed Fields
    + + + + + + + +
    Field Name + Type + Description +
    name + string + The identifying name of the contact person/organization. +
    url + string + The URL pointing to the contact information. MUST be in the format of a URL. +
    email + string + The email address of the contact person/organization. MUST be in the format of an email address. +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.4.2. Contact Object Example:
    +
    {
    +  "name": "API Support",
    +  "url": "http://www.example.com/support",
    +  "email": "support@example.com"
    +}
    +
    +
    name: API Support
    +url: http://www.example.com/support
    +email: support@example.com
    +
    +

    4.7.5. License Object

    +

    License information for the exposed API.

    +
    4.7.5.1. Fixed Fields
    + + + + + + +
    Field Name + Type + Description +
    name + string + REQUIRED. The license name used for the API. +
    url + string + A URL to the license used for the API. MUST be in the format of a URL. +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.5.2. License Object Example:
    +
    {
    +  "name": "Apache 2.0",
    +  "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    +}
    +
    +
    name: Apache 2.0
    +url: https://www.apache.org/licenses/LICENSE-2.0.html
    +
    +

    4.7.6. Server Object

    +

    An object representing a Server.

    +
    4.7.6.1. Fixed Fields
    + + + + + + + +
    Field Name + Type + Description +
    url + string + REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in {brackets}. +
    description + string + An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation. +
    variables + Map[string, Server Variable Object] + A map between a variable name and its value. The value is used for substitution in the server’s URL template. +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.6.2. Server Object Example
    +

    A single server would be described as:

    +
    {
    +  "url": "https://development.gigantic-server.com/v1",
    +  "description": "Development server"
    +}
    +
    +
    url: https://development.gigantic-server.com/v1
    +description: Development server
    +
    +

    The following shows how multiple servers can be described, for example, at the OpenAPI Object’s servers:

    +
    {
    +  "servers": [
    +    {
    +      "url": "https://development.gigantic-server.com/v1",
    +      "description": "Development server"
    +    },
    +    {
    +      "url": "https://staging.gigantic-server.com/v1",
    +      "description": "Staging server"
    +    },
    +    {
    +      "url": "https://api.gigantic-server.com/v1",
    +      "description": "Production server"
    +    }
    +  ]
    +}
    +
    +
    servers:
    +- url: https://development.gigantic-server.com/v1
    +  description: Development server
    +- url: https://staging.gigantic-server.com/v1
    +  description: Staging server
    +- url: https://api.gigantic-server.com/v1
    +  description: Production server
    +
    +

    The following shows how variables can be used for a server configuration:

    +
    {
    +  "servers": [
    +    {
    +      "url": "https://{username}.gigantic-server.com:{port}/{basePath}",
    +      "description": "The production API server",
    +      "variables": {
    +        "username": {
    +          "default": "demo",
    +          "description": "this value is assigned by the service provider, in this example gigantic-server.com"
    +        },
    +        "port": {
    +          "enum": [
    +            "8443",
    +            "443"
    +          ],
    +          "default": "8443"
    +        },
    +        "basePath": {
    +          "default": "v2"
    +        }
    +      }
    +    }
    +  ]
    +}
    +
    +
    servers:
    +- url: https://{username}.gigantic-server.com:{port}/{basePath}
    +  description: The production API server
    +  variables:
    +    username:
    +      # note! no enum here means it is an open value
    +      default: demo
    +      description: this value is assigned by the service provider, in this example gigantic-server.com
    +    port:
    +      enum:
    +        - '8443'
    +        - '443'
    +      default: '8443'
    +    basePath:
    +      # open meaning there is the opportunity to use special base paths as assigned by the provider, default is v2
    +      default: v2
    +
    +

    4.7.7. Server Variable Object

    +

    An object representing a Server Variable for server URL template substitution.

    +
    4.7.7.1. Fixed Fields
    + + + + + + + +
    Field Name + Type + Description +
    enum + [string] + An enumeration of string values to be used if the substitution options are from a limited set. +
    default + string + REQUIRED. The default value to use for substitution, and to send, if an alternate value is not supplied. Unlike the Schema Object’s default, this value MUST be provided by the consumer. +
    description + string + An optional description for the server variable. CommonMark syntax MAY be used for rich text representation. +
    +

    This object MAY be extended with Specification Extensions.

    +

    4.7.8. Components Object

    +

    Holds a set of reusable objects for different aspects of the OAS. +All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.

    +
    4.7.8.1. Fixed Fields
    + + + + + + + + + + + + + +
    Field Name + Type + Description +
    schemas + Map[string, Schema Object ¦ Reference Object] + An object to hold reusable Schema Objects. +
    responses + Map[string, Response Object ¦ Reference Object] + An object to hold reusable Response Objects. +
    parameters + Map[string, Parameter Object ¦ Reference Object] + An object to hold reusable Parameter Objects. +
    examples + Map[string, Example Object ¦ Reference Object] + An object to hold reusable Example Objects. +
    requestBodies + Map[string, Request Body Object ¦ Reference Object] + An object to hold reusable Request Body Objects. +
    headers + Map[string, Header Object ¦ Reference Object] + An object to hold reusable Header Objects. +
    securitySchemes + Map[string, Security Scheme Object ¦ Reference Object] + An object to hold reusable Security Scheme Objects. +
    links + Map[string, Link Object ¦ Reference Object] + An object to hold reusable Link Objects. +
    callbacks + Map[string, Callback Object ¦ Reference Object] + An object to hold reusable Callback Objects. +
    +

    This object MAY be extended with Specification Extensions.

    +

    All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9\.\-_]+$.

    +

    Field Name Examples:

    +
    User
    +User_1
    +User_Name
    +user-name
    +my.org.User
    +
    +
    4.7.8.2. Components Object Example
    +
    "components": {
    +  "schemas": {
    +    "Category": {
    +      "type": "object",
    +      "properties": {
    +        "id": {
    +          "type": "integer",
    +          "format": "int64"
    +        },
    +        "name": {
    +          "type": "string"
    +        }
    +      }
    +    },
    +    "Tag": {
    +      "type": "object",
    +      "properties": {
    +        "id": {
    +          "type": "integer",
    +          "format": "int64"
    +        },
    +        "name": {
    +          "type": "string"
    +        }
    +      }
    +    }
    +  },
    +  "parameters": {
    +    "skipParam": {
    +      "name": "skip",
    +      "in": "query",
    +      "description": "number of items to skip",
    +      "required": true,
    +      "schema": {
    +        "type": "integer",
    +        "format": "int32"
    +      }
    +    },
    +    "limitParam": {
    +      "name": "limit",
    +      "in": "query",
    +      "description": "max records to return",
    +      "required": true,
    +      "schema" : {
    +        "type": "integer",
    +        "format": "int32"
    +      }
    +    }
    +  },
    +  "responses": {
    +    "NotFound": {
    +      "description": "Entity not found."
    +    },
    +    "IllegalInput": {
    +      "description": "Illegal input for operation."
    +    },
    +    "GeneralError": {
    +      "description": "General Error",
    +      "content": {
    +        "application/json": {
    +          "schema": {
    +            "$ref": "#/components/schemas/GeneralError"
    +          }
    +        }
    +      }
    +    }
    +  },
    +  "securitySchemes": {
    +    "api_key": {
    +      "type": "apiKey",
    +      "name": "api_key",
    +      "in": "header"
    +    },
    +    "petstore_auth": {
    +      "type": "oauth2",
    +      "flows": {
    +        "implicit": {
    +          "authorizationUrl": "http://example.org/api/oauth/dialog",
    +          "scopes": {
    +            "write:pets": "modify pets in your account",
    +            "read:pets": "read your pets"
    +          }
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    components:
    +  schemas:
    +    Category:
    +      type: object
    +      properties:
    +        id:
    +          type: integer
    +          format: int64
    +        name:
    +          type: string
    +    Tag:
    +      type: object
    +      properties:
    +        id:
    +          type: integer
    +          format: int64
    +        name:
    +          type: string
    +  parameters:
    +    skipParam:
    +      name: skip
    +      in: query
    +      description: number of items to skip
    +      required: true
    +      schema:
    +        type: integer
    +        format: int32
    +    limitParam:
    +      name: limit
    +      in: query
    +      description: max records to return
    +      required: true
    +      schema:
    +        type: integer
    +        format: int32
    +  responses:
    +    NotFound:
    +      description: Entity not found.
    +    IllegalInput:
    +      description: Illegal input for operation.
    +    GeneralError:
    +      description: General Error
    +      content:
    +        application/json:
    +          schema:
    +            $ref: '#/components/schemas/GeneralError'
    +  securitySchemes:
    +    api_key:
    +      type: apiKey
    +      name: api_key
    +      in: header
    +    petstore_auth:
    +      type: oauth2
    +      flows: 
    +        implicit:
    +          authorizationUrl: http://example.org/api/oauth/dialog
    +          scopes:
    +            write:pets: modify pets in your account
    +            read:pets: read your pets
    +
    +

    4.7.9. Paths Object

    +

    Holds the relative paths to the individual endpoints and their operations. +The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.

    +
    4.7.9.1. Patterned Fields
    + + + + + +
    Field Pattern + Type + Description +
    /{path} + Path Item Object + A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended (no relative URL resolution) to the expanded URL from the Server Object’s url field in order to construct the full URL. Path templating is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it’s up to the tooling to decide which one to use. +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.9.2. Path Templating Matching
    +

    Assuming the following paths, the concrete definition, /pets/mine, will be matched first if used:

    +
    /pets/{petId}
    +/pets/mine
    +
    +

    The following paths are considered identical and invalid:

    +
    /pets/{petId}
    +/pets/{name}
    +
    +

    The following may lead to ambiguous resolution:

    +
    /{entity}/me
    +/books/{id}
    +
    +
    4.7.9.3. Paths Object Example
    +
    {
    +  "/pets": {
    +    "get": {
    +      "description": "Returns all pets from the system that the user has access to",
    +      "responses": {
    +        "200": {          
    +          "description": "A list of pets.",
    +          "content": {
    +            "application/json": {
    +              "schema": {
    +                "type": "array",
    +                "items": {
    +                  "$ref": "#/components/schemas/pet"
    +                }
    +              }
    +            }
    +          }
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    /pets:
    +  get:
    +    description: Returns all pets from the system that the user has access to
    +    responses:
    +      '200':
    +        description: A list of pets.
    +        content:
    +          application/json:
    +            schema:
    +              type: array
    +              items:
    +                $ref: '#/components/schemas/pet'
    +
    +

    4.7.10. Path Item Object

    +

    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.

    +
    4.7.10.1. Fixed Fields
    + + + + + + + + + + + + + + + + + +
    Field Name + Type + Description +
    $ref + string + 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. +
    summary + string + An optional, string summary, intended to apply to all operations in this path. +
    description + string + An optional, string description, intended to apply to all operations in this path. CommonMark syntax MAY be used for rich text representation. +
    get + Operation Object + A definition of a GET operation on this path. +
    put + Operation Object + A definition of a PUT operation on this path. +
    post + Operation Object + A definition of a POST operation on this path. +
    delete + Operation Object + A definition of a DELETE operation on this path. +
    options + Operation Object + A definition of a OPTIONS operation on this path. +
    head + Operation Object + A definition of a HEAD operation on this path. +
    patch + Operation Object + A definition of a PATCH operation on this path. +
    trace + Operation Object + A definition of a TRACE operation on this path. +
    servers + [Server Object] + An alternative server array to service all operations in this path. +
    parameters + [Parameter Object ¦ Reference Object] + 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 OpenAPI Object’s components/parameters. +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.10.2. Path Item Object Example
    +
    {
    +  "get": {
    +    "description": "Returns pets based on ID",
    +    "summary": "Find pets by ID",
    +    "operationId": "getPetsById",
    +    "responses": {
    +      "200": {
    +        "description": "pet response",
    +        "content": {
    +          "*/*": {
    +            "schema": {
    +              "type": "array",
    +              "items": {
    +                "$ref": "#/components/schemas/Pet"
    +              }
    +            }
    +          }
    +        }
    +      },
    +      "default": {
    +        "description": "error payload",
    +        "content": {
    +          "text/html": {
    +            "schema": {
    +              "$ref": "#/components/schemas/ErrorModel"
    +            }
    +          }
    +        }
    +      }
    +    }
    +  },
    +  "parameters": [
    +    {
    +      "name": "id",
    +      "in": "path",
    +      "description": "ID of pet to use",
    +      "required": true,
    +      "schema": {
    +        "type": "array",
    +        "items": {
    +          "type": "string"
    +        }
    +      },
    +      "style": "simple"
    +    }
    +  ]
    +}
    +
    +
    get:
    +  description: Returns pets based on ID
    +  summary: Find pets by ID
    +  operationId: getPetsById
    +  responses:
    +    '200':
    +      description: pet response
    +      content:
    +        '*/*' :
    +          schema:
    +            type: array
    +            items:
    +              $ref: '#/components/schemas/Pet'
    +    default:
    +      description: error payload
    +      content:
    +        'text/html':
    +          schema:
    +            $ref: '#/components/schemas/ErrorModel'
    +parameters:
    +- name: id
    +  in: path
    +  description: ID of pet to use
    +  required: true
    +  schema:
    +    type: array
    +    style: simple
    +    items:
    +      type: string  
    +
    +

    4.7.11. Operation Object

    +

    Describes a single API operation on a path.

    +
    4.7.11.1. Fixed Fields
    + + + + + + + + + + + + + + + + +
    Field Name + Type + Description +
    tags + [string] + A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. +
    summary + string + A short summary of what the operation does. +
    description + string + A verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation. +
    externalDocs + External Documentation Object + Additional external documentation for this operation. +
    operationId + string + 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 + [Parameter Object ¦ Reference Object] + 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 OpenAPI Object’s components/parameters. +
    requestBody + Request Body Object ¦ Reference Object + The request body applicable for this operation. The requestBody is only supported in HTTP methods where the HTTP 1.1 specification [rfc7231]section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers. +
    responses + Responses Object + REQUIRED. The list of possible responses as they are returned from executing this operation. +
    callbacks + Map[string, Callback Object ¦ Reference Object] + A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. +
    deprecated + boolean + Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is false. +
    security + [Security Requirement Object] + A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used. +
    servers + [Server Object] + An alternative server array to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value. +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.11.2. Operation Object Example
    +
    {
    +  "tags": [
    +    "pet"
    +  ],
    +  "summary": "Updates a pet in the store with form data",
    +  "operationId": "updatePetWithForm",
    +  "parameters": [
    +    {
    +      "name": "petId",
    +      "in": "path",
    +      "description": "ID of pet that needs to be updated",
    +      "required": true,
    +      "schema": {
    +        "type": "string"
    +      }
    +    }
    +  ],
    +  "requestBody": {
    +    "content": {
    +      "application/x-www-form-urlencoded": {
    +        "schema": {
    +          "type": "object",
    +           "properties": {
    +              "name": { 
    +                "description": "Updated name of the pet",
    +                "type": "string"
    +              },
    +              "status": {
    +                "description": "Updated status of the pet",
    +                "type": "string"
    +             }
    +           },
    +        "required": ["status"] 
    +        }
    +      }
    +    }
    +  },
    +  "responses": {
    +    "200": {
    +      "description": "Pet updated.",
    +      "content": {
    +        "application/json": {},
    +        "application/xml": {}
    +      }
    +    },
    +    "405": {
    +      "description": "Invalid input",
    +      "content": {
    +        "application/json": {},
    +        "application/xml": {}
    +      }
    +    }
    +  },
    +  "security": [
    +    {
    +      "petstore_auth": [
    +        "write:pets",
    +        "read:pets"
    +      ]
    +    }
    +  ]
    +}
    +
    +
    tags:
    +- pet
    +summary: Updates a pet in the store with form data
    +operationId: updatePetWithForm
    +parameters:
    +- name: petId
    +  in: path
    +  description: ID of pet that needs to be updated
    +  required: true
    +  schema:
    +    type: string
    +requestBody:
    +  content:
    +    'application/x-www-form-urlencoded':
    +      schema:
    +       properties:
    +          name: 
    +            description: Updated name of the pet
    +            type: string
    +          status:
    +            description: Updated status of the pet
    +            type: string
    +       required:
    +         - status
    +responses:
    +  '200':
    +    description: Pet updated.
    +    content: 
    +      'application/json': {}
    +      'application/xml': {}
    +  '405':
    +    description: Invalid input
    +    content: 
    +      'application/json': {}
    +      'application/xml': {}
    +security:
    +- petstore_auth:
    +  - write:pets
    +  - read:pets
    +
    +

    4.7.12. External Documentation Object

    +

    Allows referencing an external resource for extended documentation.

    +
    4.7.12.1. Fixed Fields
    + + + + + + +
    Field Name + Type + Description +
    description + string + A short description of the target documentation. CommonMark syntax MAY be used for rich text representation. +
    url + string + REQUIRED. The URL for the target documentation. Value MUST be in the format of a URL. +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.12.2. External Documentation Object Example
    +
    {
    +  "description": "Find more info here",
    +  "url": "https://example.com"
    +}
    +
    +
    description: Find more info here
    +url: https://example.com
    +
    +

    4.7.13. Parameter Object

    +

    Describes a single operation parameter.

    +

    A unique parameter is defined by a combination of a name and location.

    +
    4.7.13.1. Parameter Locations
    +

    There are four possible parameter locations specified by the in field:

    +
      +
    • path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId. +
    • query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id. +
    • header - Custom headers that are expected as part of the request. Note that [rfc7230]page-22) states header names are case insensitive. +
    • cookie - Used to pass a specific cookie value to the API. +
    +
    4.7.13.2. Fixed Fields
    + + + + + + + + + + +
    Field Name + Type + Description +
    name + string + + REQUIRED. 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. +
    • If in is "header" and the name field is "Accept", "Content-Type" or "Authorization", the parameter definition SHALL be ignored. +
    • For all other cases, the name corresponds to the parameter name used by the in property. +
    +
    in + string + REQUIRED. The location of the parameter. Possible values are “query”, “header”, “path” or “cookie”. +
    description + string + A brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation. +
    required + boolean + Determines whether this parameter is mandatory. If the parameter location is “path”, this property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and its default value is false. +
    deprecated + boolean + Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. +
    allowEmptyValue + boolean + Sets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored. +
    +

    The rules for serialization of the parameter are specified in one of two ways. +For simpler scenarios, a schema and style can describe the structure and syntax of the parameter.

    + + + + + + + + + + +
    Field Name + Type + Description +
    style + string + Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form. +
    explode + boolean + When this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. +
    allowReserved + boolean + Determines whether the parameter value SHOULD allow reserved characters, as defined by [rfc3986]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false. +
    schema + Schema Object ¦ Reference Object + The schema defining the type used for the parameter. +
    example + Any + Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The example field is mutually exclusive of the examples field. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary. +
    examples + Map[ string, Example Object ¦ Reference Object] + Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The examples field is mutually exclusive of the example field. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema. +
    +

    For more complex scenarios, the content property can define the media type and schema of the parameter. +A parameter MUST contain either a schema property, or a content property, but not both. +When example or examples are provided in conjunction with the schema object, the example MUST follow the prescribed serialization strategy for the parameter.

    + + + + + +
    Field Name + Type + Description +
    content + Map[string, Media Type Object] + A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry. +
    +
    4.7.13.3. Style Values
    +

    In order to support common ways of serializing simple parameters, a set of style values are defined.

    + + + + + + + + + + + +
    style + type + in + Comments +
    matrix + primitive, array, object + path + Path-style parameters defined by [rfc6570]section-3.2.7) +
    label + primitive, array, object + path + Label style parameters defined by [rfc6570]section-3.2.5) +
    form + primitive, array, object + query, cookie + Form style parameters defined by [rfc6570]section-3.2.8). This option replaces collectionFormat with a csv (when explode is false) or multi (when explode is true) value from OpenAPI 2.0. +
    simple + array + path, header + Simple style parameters defined by [rfc6570]section-3.2.2). This option replaces collectionFormat with a csv value from OpenAPI 2.0. +
    spaceDelimited + array + query + Space separated array values. This option replaces collectionFormat equal to ssv from OpenAPI 2.0. +
    pipeDelimited + array + query + Pipe separated array values. This option replaces collectionFormat equal to pipes from OpenAPI 2.0. +
    deepObject + object + query + Provides a simple way of rendering nested objects using form parameters. +
    +
    4.7.13.4. Style Examples
    +

    Assume a parameter named color has one of the following values:

    +
    string -> "blue"
    +array -> ["blue","black","brown"]
    +object -> { "R": 100, "G": 200, "B": 150 }
    +
    +

    The following table shows examples of rendering differences for each value.

    + + + + + + + + + + + + + + + +
    style + explode + empty + string + array + object +
    matrix + false + ;color + ;color=blue + ;color=blue,black,brown + ;color=R,100,G,200,B,150 +
    matrix + true + ;color + ;color=blue + ;color=blue;color=black;color=brown + ;R=100;G=200;B=150 +
    label + false + . + .blue + .blue.black.brown + .R.100.G.200.B.150 +
    label + true + . + .blue + .blue.black.brown + .R=100.G=200.B=150 +
    form + false + color= + color=blue + color=blue,black,brown + color=R,100,G,200,B,150 +
    form + true + color= + color=blue + color=blue&color=black&color=brown + R=100&G=200&B=150 +
    simple + false + n/a + blue + blue,black,brown + R,100,G,200,B,150 +
    simple + true + n/a + blue + blue,black,brown + R=100,G=200,B=150 +
    spaceDelimited + false + n/a + n/a + blue%20black%20brown + R%20100%20G%20200%20B%20150 +
    pipeDelimited + false + n/a + n/a + blue¦black¦brown + R¦100¦G¦200 +
    deepObject + true + n/a + n/a + n/a + color[R]=100&color[G]=200&color[B]=150 +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.13.5. Parameter Object Examples
    +

    A header parameter with an array of 64 bit integer numbers:

    +
    {
    +  "name": "token",
    +  "in": "header",
    +  "description": "token to be passed as a header",
    +  "required": true,
    +  "schema": {
    +    "type": "array",
    +    "items": {
    +      "type": "integer",
    +      "format": "int64"
    +    }
    +  },
    +  "style": "simple"
    +}
    +
    +
    name: token
    +in: header
    +description: token to be passed as a header
    +required: true
    +schema:
    +  type: array
    +  items:
    +    type: integer
    +    format: int64
    +style: simple
    +
    +

    A path parameter of a string value:

    +
    {
    +  "name": "username",
    +  "in": "path",
    +  "description": "username to fetch",
    +  "required": true,
    +  "schema": {
    +    "type": "string"
    +  }
    +}
    +
    +
    name: username
    +in: path
    +description: username to fetch
    +required: true
    +schema:
    +  type: string
    +
    +

    An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

    +
    {
    +  "name": "id",
    +  "in": "query",
    +  "description": "ID of the object to fetch",
    +  "required": false,
    +  "schema": {
    +    "type": "array",
    +    "items": {
    +      "type": "string"
    +    }
    +  },
    +  "style": "form",
    +  "explode": true
    +}
    +
    +
    name: id
    +in: query
    +description: ID of the object to fetch
    +required: false
    +schema:
    +  type: array
    +  items:
    +    type: string
    +style: form
    +explode: true
    +
    +

    A free-form query parameter, allowing undefined parameters of a specific type:

    +
    {
    +  "in": "query",
    +  "name": "freeForm",
    +  "schema": {
    +    "type": "object",
    +    "additionalProperties": {
    +      "type": "integer"
    +    },
    +  },
    +  "style": "form"
    +}
    +
    +
    in: query
    +name: freeForm
    +schema:
    +  type: object
    +  additionalProperties:
    +    type: integer
    +style: form
    +
    +

    A complex parameter using content to define serialization:

    +
    {
    +  "in": "query",
    +  "name": "coordinates",
    +  "content": {
    +    "application/json": {
    +      "schema": {
    +        "type": "object",
    +        "required": [
    +          "lat",
    +          "long"
    +        ],
    +        "properties": {
    +          "lat": {
    +            "type": "number"
    +          },
    +          "long": {
    +            "type": "number"
    +          }
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    in: query
    +name: coordinates
    +content:
    +  application/json:
    +    schema:
    +      type: object
    +      required:
    +        - lat
    +        - long
    +      properties:
    +        lat:
    +          type: number
    +        long:
    +          type: number
    +
    +

    4.7.14. Request Body Object

    +

    Describes a single request body.

    +
    4.7.14.1. Fixed Fields
    + + + + + + + +
    Field Name + Type + Description +
    description + string + A brief description of the request body. This could contain examples of use. CommonMark syntax MAY be used for rich text representation. +
    content + Map[string, Media Type Object] + REQUIRED. The content of the request body. The key is a media type or [media type range]appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* +
    required + boolean + Determines if the request body is required in the request. Defaults to false. +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.14.2. Request Body Examples
    +

    A request body with a referenced model definition.

    +
    {
    +  "description": "user to add to the system",
    +  "content": {
    +    "application/json": {
    +      "schema": {
    +        "$ref": "#/components/schemas/User"
    +      },
    +      "examples": {
    +          "user" : {
    +            "summary": "User Example", 
    +            "externalValue": "http://foo.bar/examples/user-example.json"
    +          } 
    +        }
    +    },
    +    "application/xml": {
    +      "schema": {
    +        "$ref": "#/components/schemas/User"
    +      },
    +      "examples": {
    +          "user" : {
    +            "summary": "User example in XML",
    +            "externalValue": "http://foo.bar/examples/user-example.xml"
    +          }
    +        }
    +    },
    +    "text/plain": {
    +      "examples": {
    +        "user" : {
    +            "summary": "User example in Plain text",
    +            "externalValue": "http://foo.bar/examples/user-example.txt" 
    +        }
    +      } 
    +    },
    +    "*/*": {
    +      "examples": {
    +        "user" : {
    +            "summary": "User example in other format",
    +            "externalValue": "http://foo.bar/examples/user-example.whatever"
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    description: user to add to the system
    +content: 
    +  'application/json':
    +    schema:
    +      $ref: '#/components/schemas/User'
    +    examples:
    +      user:
    +        summary: User Example
    +        externalValue: 'http://foo.bar/examples/user-example.json'
    +  'application/xml':
    +    schema:
    +      $ref: '#/components/schemas/User'
    +    examples:
    +      user:
    +        summary: User Example in XML
    +        externalValue: 'http://foo.bar/examples/user-example.xml'
    +  'text/plain':
    +    examples:
    +      user:
    +        summary: User example in text plain format
    +        externalValue: 'http://foo.bar/examples/user-example.txt'
    +  '*/*':
    +    examples:
    +      user: 
    +        summary: User example in other format
    +        externalValue: 'http://foo.bar/examples/user-example.whatever'
    +
    +

    A body parameter that is an array of string values:

    +
    {
    +  "description": "user to add to the system",
    +  "content": {
    +    "text/plain": {
    +      "schema": {
    +        "type": "array",
    +        "items": {
    +          "type": "string"
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    description: user to add to the system
    +required: true
    +content:
    +  text/plain:
    +    schema:
    +      type: array
    +      items:
    +        type: string
    +
    +

    4.7.15. Media Type Object

    + Each Media Type Object provides schema and examples for the media type identified by its key. +
    4.7.15.1. Fixed Fields
    + + + + + + + + +
    Field Name + Type + Description +
    schema + Schema Object ¦ Reference Object + The schema defining the type used for the request body. +
    example + Any + Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The example field is mutually exclusive of the examples field. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema. +
    examples + Map[ string, Example Object ¦ Reference Object] + Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The examples field is mutually exclusive of the example field. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema. +
    encoding + Map[string, Encoding Object] + A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded. +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.15.2. Media Type Examples
    +
    {
    +  "application/json": {
    +    "schema": {
    +         "$ref": "#/components/schemas/Pet"
    +    },
    +    "examples": {
    +      "cat" : {
    +        "summary": "An example of a cat",
    +        "value": 
    +          {
    +            "name": "Fluffy",
    +            "petType": "Cat",
    +            "color": "White",
    +            "gender": "male",
    +            "breed": "Persian"
    +          }
    +      },
    +      "dog": {
    +        "summary": "An example of a dog with a cat’s name",
    +        "value" :  { 
    +          "name": "Puma",
    +          "petType": "Dog",
    +          "color": "Black",
    +          "gender": "Female",
    +          "breed": "Mixed"
    +        },
    +      "frog": {
    +          "$ref": "#/components/examples/frog-example"
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    application/json: 
    +  schema:
    +    $ref: "#/components/schemas/Pet"
    +  examples:
    +    cat:
    +      summary: An example of a cat
    +      value:
    +        name: Fluffy
    +        petType: Cat
    +        color: White
    +        gender: male
    +        breed: Persian
    +    dog:
    +      summary: An example of a dog with a cat’s name
    +      value:
    +        name: Puma
    +        petType: Dog
    +        color: Black
    +        gender: Female
    +        breed: Mixed
    +    frog:
    +      $ref: "#/components/examples/frog-example"
    +
    +
    4.7.15.3. Considerations for File Uploads
    +

    In contrast with the 2.0 specification, file input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically:

    +
    # content transferred with base64 encoding
    +schema:
    +  type: string
    +  format: base64
    +
    +
    # content transferred in binary (octet-stream):
    +schema:
    +  type: string
    +  format: binary
    +
    +

    These examples apply to either input payloads of file uploads or response payloads.

    +

    A requestBody for submitting a file in a POST operation may look like the following example:

    +
    requestBody:
    +  content:
    +    application/octet-stream:
    +      # any media type is accepted, functionally equivalent to */*
    +      schema:
    +        # a binary file of any type
    +        type: string
    +        format: binary
    +
    +

    In addition, specific media types MAY be specified:

    +
    # multiple, specific media types may be specified:
    +requestBody:
    +  content:
    +      # a binary file of type png or jpeg
    +    'image/jpeg':
    +      schema:
    +        type: string
    +        format: binary
    +    'image/png':
    +      schema:
    +        type: string
    +        format: binary        
    +
    +

    To upload multiple files, a multipart media type MUST be used:

    +
    requestBody:
    +  content:
    +    multipart/form-data:
    +      schema:
    +        properties:
    +          # The property name 'file' will be used for all files.
    +          file:
    +            type: array
    +            items:
    +              type: string
    +              format: binary
    +
    +
    +
    4.7.15.4. Support for x-www-form-urlencoded Request Bodies
    +

    To submit content using form url encoding via [rfc1866], the following +definition may be used:

    +
    requestBody:
    +  content:
    +    application/x-www-form-urlencoded:
    +      schema:
    +        type: object
    +        properties:
    +          id:
    +            type: string
    +            format: uuid
    +          address:
    +            # complex types are stringified to support RFC 1866
    +            type: object
    +            properties: {}
    +
    +

    In this example, the contents in the requestBody MUST be stringified per [rfc1866]) when passed to the server. In addition, the address field complex object will be stringified.

    +

    When passing complex objects in the application/x-www-form-urlencoded content type, the default serialization strategy of such properties is described in the Encoding Object’s style property as form.

    +
    4.7.15.5. Special Considerations for multipart Content
    +

    It is common to use multipart/form-data as a Content-Type when transferring request bodies to operations. In contrast to 2.0, a schema is REQUIRED to define the input parameters to the operation when using multipart content. This supports complex structures as well as supporting mechanisms for multiple file uploads.

    +

    When passing in multipart types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default Content-Types are defined for multipart:

    +
      +
    • If the property is a primitive, or an array of primitive values, the default Content-Type is text/plain +
    • If the property is complex, or an array of complex values, the default Content-Type is application/json +
    • If the property is a type: string with format: binary or format: base64 (aka a file object), the default Content-Type is application/octet-stream +
    +

    Examples:

    +
    requestBody:
    +  content:
    +    multipart/form-data:
    +      schema:
    +        type: object
    +        properties:
    +          id:
    +            type: string
    +            format: uuid
    +          address:
    +            # default Content-Type for objects is application/json
    +            type: object
    +            properties: {}
    +          profileImage:
    +            # default Content-Type for string/binary is application/octet-stream
    +            type: string
    +            format: binary
    +          children:
    +            # default Content-Type for arrays is based on the inner type (text/plain here)
    +            type: array
    +            items:
    +              type: string
    +          addresses:
    +            # default Content-Type for arrays is based on the inner type (object shown, so application/json in this example)
    +            type: array
    +            items:
    +              type: '#/components/schemas/Address'
    +
    +

    An encoding attribute is introduced to give you control over the serialization of parts of multipart request bodies. This attribute is only applicable to multipart and application/x-www-form-urlencoded request bodies.

    +

    4.7.16. Encoding Object

    +

    A single encoding definition applied to a single schema property.

    +
    4.7.16.1. Fixed Fields
    + + + + + + + + + +
    Field Name + Type + Description +
    contentType + string + The Content-Type for encoding a specific property. Default value depends on the property type: for string with format being binaryapplication/octet-stream; for other primitive types – text/plain; for object - application/json; for array – the default is defined based on the inner type. The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types. +
    headers + Map[string, Header Object ¦ Reference Object] + A map allowing additional information to be provided as headers, for example Content-Disposition. Content-Type is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a multipart. +
    style + string + Describes how a specific property value will be serialized depending on its type. See Parameter Object for details on the style property. The behavior follows the same values as query parameters, including default values. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded. +
    explode + boolean + When this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded. +
    allowReserved + boolean + Determines whether the parameter value SHOULD allow reserved characters, as defined by [rfc3986]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded. +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.16.2. Encoding Object Example
    +
    requestBody:
    +  content:
    +    multipart/mixed:
    +      schema:
    +        type: object
    +        properties:
    +          id:
    +            # default is text/plain
    +            type: string
    +            format: uuid
    +          address:
    +            # default is application/json
    +            type: object
    +            properties: {}
    +          historyMetadata:
    +            # need to declare XML format!
    +            description: metadata in XML format
    +            type: object
    +            properties: {}
    +          profileImage:
    +            # default is application/octet-stream, need to declare an image type only!
    +            type: string
    +            format: binary
    +      encoding:
    +        historyMetadata:
    +          # require XML Content-Type in utf-8 encoding
    +          contentType: application/xml; charset=utf-8
    +        profileImage:
    +          # only accept png/jpeg
    +          contentType: image/png, image/jpeg
    +          headers:
    +            X-Rate-Limit-Limit:
    +              description: The number of allowed requests in the current period
    +              schema:
    +                type: integer
    +
    +

    4.7.17. Responses Object

    +

    A container for the expected responses of an operation. +The container maps a HTTP response code to the expected response.

    +

    The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. +However, documentation is expected to cover a successful operation response and any known errors.

    +

    The default MAY be used as a default response object for all HTTP codes +that are not covered individually by the specification.

    +

    The Responses Object MUST contain at least one response code, and it +SHOULD be the response for a successful operation call.

    +
    4.7.17.1. Fixed Fields
    + + + + + +
    Field Name + Type + Description +
    default + Response Object ¦ Reference Object + The documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. A Reference Object can link to a response that the OpenAPI Object’s components/responses section defines. +
    +
    4.7.17.2. Patterned Fields
    + + + + + +
    Field Pattern + Type + Description +
    HTTP Status Code + Response Object ¦ Reference Object + Any HTTP status code can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A Reference Object can link to a response that is defined in the OpenAPI Object’s components/responses section. This field MUST be enclosed in quotation marks (for example, “200”) for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character X. For example, 2XX represents all response codes between [200-299]. The following range definitions are allowed: 1XX, 2XX, 3XX, 4XX, and 5XX. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code. +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.17.3. Responses Object Example
    +

    A 200 response for a successful operation and a default response for others (implying an error):

    +
    {
    +  "200": {
    +    "description": "a pet to be returned",
    +    "content": {
    +      "application/json": {
    +        "schema": {
    +          "$ref": "#/components/schemas/Pet"
    +        }
    +      }
    +    }
    +  },
    +  "default": {
    +    "description": "Unexpected error",
    +    "content": {
    +      "application/json": {
    +        "schema": {
    +          "$ref": "#/components/schemas/ErrorModel"
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    '200':
    +  description: a pet to be returned
    +  content: 
    +    application/json:
    +      schema:
    +        $ref: '#/components/schemas/Pet'
    +default:
    +  description: Unexpected error
    +  content:
    +    application/json:
    +      schema:
    +        $ref: '#/components/schemas/ErrorModel'
    +
    +

    4.7.18. Response Object

    + Describes a single response from an API Operation, including design-time, static links to operations based on the response. +
    4.7.18.1. Fixed Fields
    + + + + + + + + +
    Field Name + Type + Description +
    description + string + REQUIRED. A short description of the response. CommonMark syntax MAY be used for rich text representation. +
    headers + Map[string, Header Object ¦ Reference Object] + Maps a header name to its definition. [rfc7230]page-22) states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored. +
    content + Map[string, Media Type Object] + A map containing descriptions of potential response payloads. The key is a media type or [media type range]appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* +
    links + Map[string, Link Object ¦ Reference Object] + A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for Component Objects. +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.18.2. Response Object Examples
    +

    Response of an array of a complex type:

    +
    {
    +  "description": "A complex object array response",
    +  "content": {
    +    "application/json": {
    +      "schema": {
    +        "type": "array",
    +        "items": {
    +          "$ref": "#/components/schemas/VeryComplexType"
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    description: A complex object array response
    +content: 
    +  application/json:
    +    schema: 
    +      type: array
    +      items:
    +        $ref: '#/components/schemas/VeryComplexType'
    +
    +

    Response with a string type:

    +
    {
    +  "description": "A simple string response",
    +  "content": {
    +    "text/plain": {
    +      "schema": {
    +        "type": "string"
    +      }
    +    }
    +  }
    +
    +}
    +
    +
    description: A simple string response
    +content:
    +  text/plain:
    +    schema:
    +      type: string
    +
    +

    Plain text response with headers:

    +
    {
    +  "description": "A simple string response",
    +  "content": {
    +    "text/plain": {
    +      "schema": {
    +        "type": "string"
    +      }
    +    }
    +  },
    +  "headers": {
    +    "X-Rate-Limit-Limit": {
    +      "description": "The number of allowed requests in the current period",
    +      "schema": {
    +        "type": "integer"
    +      }
    +    },
    +    "X-Rate-Limit-Remaining": {
    +      "description": "The number of remaining requests in the current period",
    +      "schema": {
    +        "type": "integer"
    +      }
    +    },
    +    "X-Rate-Limit-Reset": {
    +      "description": "The number of seconds left in the current period",
    +      "schema": {
    +        "type": "integer"
    +      }
    +    }
    +  }
    +}
    +
    +
    description: A simple string response
    +content:
    +  text/plain:
    +    schema:
    +      type: string
    +    example: 'whoa!'
    +headers:
    +  X-Rate-Limit-Limit:
    +    description: The number of allowed requests in the current period
    +    schema:
    +      type: integer
    +  X-Rate-Limit-Remaining:
    +    description: The number of remaining requests in the current period
    +    schema:
    +      type: integer
    +  X-Rate-Limit-Reset:
    +    description: The number of seconds left in the current period
    +    schema:
    +      type: integer
    +
    +

    Response with no return value:

    +
    {
    +  "description": "object created"
    +}
    +
    +
    description: object created
    +
    +

    4.7.19. Callback Object

    +

    A map of possible out-of band callbacks related to the parent operation. +Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. +The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

    +
    4.7.19.1. Patterned Fields
    + + + + + +
    Field Pattern + Type + Description +
    {expression} + Path Item Object + A Path Item Object used to define a callback request and expected responses. A complete example is available. +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.19.2. Key Expression
    +

    The key that identifies the Path Item Object is a runtime expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. +A simple example might be $request.body#/url. +However, using a runtime expression the complete HTTP message can be accessed. +This includes accessing any part of a body that a JSON Pointer [rfc6901] can reference.

    +

    For example, given the following HTTP request:

    +
    POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1
    +Host: example.org
    +Content-Type: application/json
    +Content-Length: 187
    +
    +{
    +  "failedUrl" : "http://clientdomain.com/failed",
    +  "successUrls" : [
    +    "http://clientdomain.com/fast",
    +    "http://clientdomain.com/medium",
    +    "http://clientdomain.com/slow"
    +  ] 
    +}
    +
    +201 Created
    +Location: http://example.org/subscription/1
    +
    +

    The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named eventType and a query parameter named queryUrl.

    + + + + + + + + + + + + +
    Expression + Value +
    $url + http://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning +
    $method + POST +
    $request.path.eventType + myevent +
    $request.query.queryUrl + http://clientdomain.com/stillrunning +
    $request.header.content-Type + application/json +
    $request.body#/failedUrl + http://clientdomain.com/stillrunning +
    $request.body#/successUrls/2 + http://clientdomain.com/medium +
    $response.header.Location + http://example.org/subscription/1 +
    +
    4.7.19.3. Callback Object Example
    +

    The following example shows a callback to the URL specified by the id and email property in the request body.

    +
    myWebhook:
    +  'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
    +    post:
    +      requestBody:
    +        description: Callback payload
    +        content: 
    +          'application/json':
    +            schema:
    +              $ref: '#/components/schemas/SomePayload'
    +      responses:
    +        '200':
    +          description: webhook successfully processed and no retries will be performed
    +
    +

    4.7.20. Example Object

    +
    4.7.20.1. Fixed Fields
    + + + + + + + + +
    Field Name + Type + Description +
    summary + string + Short description for the example. +
    description + string + Long description for the example. CommonMark syntax MAY be used for rich text representation. +
    value + Any + Embedded literal example. The value field and externalValue field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary. +
    externalValue + string + A URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The value field and externalValue field are mutually exclusive. +
    +

    This object MAY be extended with Specification Extensions.

    +

    In all cases, the example value is expected to be compatible with the type schema +of its associated value. Tooling implementations MAY choose to +validate compatibility automatically, and reject the example value(s) if incompatible.

    +
    4.7.20.2. Example Object Example
    +
    # in a model
    +schemas:
    +  properties:
    +    name:
    +      type: string
    +      examples:
    +        name:
    +          $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example
    +
    +# in a request body:
    +  requestBody:
    +    content:
    +      'application/json':
    +        schema:
    +          $ref: '#/components/schemas/Address'
    +        examples: 
    +          foo:
    +            summary: A foo example
    +            value: {"foo": "bar"}
    +          bar:
    +            summary: A bar example
    +            value: {"bar": "baz"}
    +      'application/xml':
    +        examples: 
    +          xmlExample:
    +            summary: This is an example in XML
    +            externalValue: 'http://example.org/examples/address-example.xml'
    +      'text/plain':
    +        examples:
    +          textExample: 
    +            summary: This is a text example
    +            externalValue: 'http://foo.bar/examples/address-example.txt' 
    +
    +
    +# in a parameter
    +  parameters:
    +    - name: 'zipCode'
    +      in: 'query'
    +      schema:
    +        type: 'string'
    +        format: 'zip-code'
    +        examples:
    +          zip-example: 
    +            $ref: '#/components/examples/zip-example'
    +
    +# in a response
    +  responses:
    +    '200':
    +      description: your car appointment has been booked
    +      content: 
    +        application/json:
    +          schema:
    +            $ref: '#/components/schemas/SuccessResponse'
    +          examples:
    +            confirmation-success:
    +              $ref: '#/components/examples/confirmation-success'
    +
    + +

    The Link object represents a possible design-time link for a response. +The presence of a link does not guarantee the caller’s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.

    +

    Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.

    +

    For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.

    +
    4.7.21.1. Fixed Fields
    + + + + + + + + + + +
    Field Name + Type + Description +
    operationRef + string + A relative or absolute reference to an OAS operation. This field is mutually exclusive of the operationId field, and MUST point to an Operation Object. Relative operationRef values MAY be used to locate an existing Operation Object in the OpenAPI definition. +
    operationId + string + The name of an existing, resolvable OAS operation, as defined with a unique operationId. This field is mutually exclusive of the operationRef field. +
    parameters + Map[string, Any ¦ {expression}] + A map representing parameters to pass to an operation as specified with operationId or identified via operationRef. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id). +
    requestBody + Any ¦ {expression} + A literal value or {expression} to use as a request body when calling the target operation. +
    description + string + A description of the link. CommonMark syntax MAY be used for rich text representation. +
    server + Server Object + A server object to be used by the target operation. +
    +

    This object MAY be extended with Specification Extensions.

    +

    A linked operation MUST be identified using either an operationRef or operationId. +In the case of an operationId, it MUST be unique and resolved in the scope of the OAS document. +Because of the potential for name clashes, the operationRef syntax is preferred +for specifications with external references.

    +
    4.7.21.2. Examples
    +

    Computing a link from a request operation where the $request.path.id is used to pass a request parameter to the linked operation.

    +
    paths:
    +  /users/{id}:
    +    parameters:
    +    - name: id
    +      in: path
    +      required: true
    +      description: the user identifier, as userId 
    +      schema:
    +        type: string
    +    get:
    +      responses:
    +        '200':
    +          description: the user being returned
    +          content:
    +            application/json:
    +              schema:
    +                type: object
    +                properties:
    +                  uuid: # the unique user id
    +                    type: string
    +                    format: uuid
    +          links:
    +            address:
    +              # the target link operationId
    +              operationId: getUserAddress
    +              parameters:
    +                # get the id field from the request path parameter named id
    +                userId: $request.path.id
    +  # the path item of the linked operation
    +  /users/{userid}/address:
    +    parameters:
    +    - name: userid
    +      in: path
    +      required: true
    +      description: the user identifier, as userId 
    +      schema:
    +        type: string
    +    # linked operation
    +    get:
    +      operationId: getUserAddress
    +      responses:
    +        '200':
    +          description: the user’s address
    +
    +

    When a runtime expression fails to evaluate, no parameter value is passed to the target operation.

    +

    Values from the response body can be used to drive a linked operation.

    +
    links:
    +  address:
    +    operationId: getUserAddressByUUID
    +    parameters:
    +      # get the uuid field from the uuid field in the response body
    +      userUuid: $response.body#/uuid
    +
    +

    Clients follow all links at their discretion. +Neither permissions, nor the capability to make a successful call to that link, is guaranteed +solely by the existence of a relationship.

    +
    4.7.21.3. OperationRef Examples
    +

    As references to operationId MAY NOT be possible (the operationId is an optional +value), references MAY also be made through a relative operationRef:

    +
    links:
    +  UserRepositories:
    +    # returns array of '#/components/schemas/repository'
    +    operationRef: '#/paths/~12.0~1repositories~1{username}/get'
    +    parameters:
    +      username: $response.body#/username
    +
    +

    or an absolute operationRef:

    +
    links:
    +  UserRepositories:
    +    # returns array of '#/components/schemas/repository'
    +    operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get'
    +    parameters:
    +      username: $response.body#/username
    +
    +

    Note that in the use of operationRef, the escaped forward-slash is necessary when +using JSON references.

    +
    4.7.21.4. Runtime Expressions
    +

    Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. +This mechanism is used by Link Objects and Callback Objects.

    +

    The runtime expression is defined by the following [Advanced Backus-Naur Form] syntax

    +
    expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source )
    +source = ( header-reference | query-reference | path-reference | body-reference )  
    +header-reference = "header." token
    +query-reference = "query." name  
    +path-reference = "path." name
    +body-reference = "body" ["#" fragment]
    +fragment = a JSON Pointer [[!rfc6901]]  
    +name = *( char )
    +char = as per RFC [7159]section-7)
    +token = as per RFC [7230]section-3.2.6)
    +
    +

    The name identifier is case-sensitive, whereas token is not.

    +

    The table below provides examples of runtime expressions and examples of their use in a value:

    +
    4.7.21.5. Examples
    + + + + + + + + + + + +
    Source Location + example expression + notes +
    HTTP Method + $method + The allowable values for the $method will be those for the HTTP operation. +
    Requested media type + $request.header.accept + +
    Request parameter + $request.path.id + Request parameters MUST be declared in the parameters section of the parent operation or they cannot be evaluated. This includes request headers. +
    Request body property + $request.body#/user/uuid + In operations which accept payloads, references may be made to portions of the requestBody or the entire body. +
    Request URL + $url + +
    Response value + $response.body#/status + In operations which return payloads, references may be made to portions of the response body or the entire body. +
    Response header + $response.header.Server + Single header values only are available +
    +

    Runtime expressions preserve the type of the referenced value. +Expressions can be embedded into string values by surrounding the expression with {} curly braces.

    +

    4.7.22. Header Object

    +

    The Header Object follows the structure of the Parameter Object with the following changes:

    +
      +
    1. name MUST NOT be specified, it is given in the corresponding headers map. +
    2. in MUST NOT be specified, it is implicitly in header. +
    3. All traits that are affected by the location MUST be applicable to a location of header (for example, style). +
    +
    4.7.22.1. Header Object Example
    +

    A simple header of type integer:

    +
    {
    +  "description": "The number of allowed requests in the current period",
    +  "schema": {
    +    "type": "integer"
    +  }
    +}
    +
    +
    description: The number of allowed requests in the current period
    +schema:
    +  type: integer
    +
    +

    4.7.23. Tag Object

    +

    Adds metadata to a single tag that is used by the Operation Object. +It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

    +
    4.7.23.1. Fixed Fields
    + + + + + + + +
    Field Name + Type + Description +
    name + string + REQUIRED. The name of the tag. +
    description + string + A short description for the tag. CommonMark syntax MAY be used for rich text representation. +
    externalDocs + External Documentation Object + Additional external documentation for this tag. +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.23.2. Tag Object Example
    +
    {
    +  "name": "pet",
    +  "description": "Pets operations"
    +}
    +
    +
    name: pet
    +description: Pets operations
    +
    +

    4.7.24. Reference Object

    +

    A simple object to allow referencing other components in the specification, internally and externally.

    +

    The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.

    +

    For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.

    +
    4.7.24.1. Fixed Fields
    + + + + + +
    Field Name + Type + Description +
    $ref + string + REQUIRED. The reference string. +
    +

    This object cannot be extended with additional properties and any properties added SHALL be ignored.

    +
    4.7.24.2. Reference Object Example
    +
    {
    +  "$ref": "#/components/schemas/Pet"
    +}
    +
    +
    $ref: '#/components/schemas/Pet'
    +
    +
    4.7.24.3. Relative Schema Document Example
    +
    {
    +  "$ref": "Pet.json"
    +}
    +
    +
    $ref: Pet.yaml
    +
    +
    4.7.24.4. Relative Documents With Embedded Schema Example
    +
    {
    +  "$ref": "definitions.json#/Pet"
    +}
    +
    +
    $ref: definitions.yaml#/Pet
    +
    +

    4.7.25. Schema Object

    +

    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 an extended subset of the JSON Schema Specification Wright Draft 00.

    +

    For more information about the properties, see JSON Schema Core and JSON Schema Validation. +Unless stated otherwise, the property definitions follow the JSON Schema.

    +
    4.7.25.1. Properties
    +

    The following properties are taken directly from the JSON Schema definition and follow the same specifications:

    +
      +
    • title +
    • multipleOf +
    • maximum +
    • exclusiveMaximum +
    • minimum +
    • exclusiveMinimum +
    • maxLength +
    • minLength +
    • pattern (This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect) +
    • maxItems +
    • minItems +
    • uniqueItems +
    • maxProperties +
    • minProperties +
    • required +
    • enum +
    +

    The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification.

    +
      +
    • type - Value MUST be a string. Multiple types via an array are not supported. +
    • allOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. +
    • oneOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. +
    • anyOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. +
    • not - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. +
    • items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. items MUST be present if the type is array. +
    • properties - Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced). +
    • additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. +
    • description - CommonMark syntax MAY be used for rich text representation. +
    • format - See Data Type Formats for further details. While relying on JSON Schema’s defined formats, the OAS offers a few additional predefined formats. +
    • default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if type is string, then default can be "foo" but cannot be 1. +
    +

    Alternatively, any time a Schema Object can be used, a Reference Object can be used in its place. This allows referencing definitions instead of defining them inline.

    +

    Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported.

    +

    Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation:

    +
    4.7.25.2. Fixed Fields
    + + + + + + + + + + + + +
    Field Name + Type + Description +
    nullable + boolean + Allows sending a null value for the defined schema. Default value is false. +
    discriminator + Discriminator Object + Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See Composition and Inheritance for more details. +
    readOnly + boolean + 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 SHOULD NOT be sent as part of the request. If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false. +
    writeOnly + boolean + Relevant only for Schema "properties" definitions. Declares the property as “write only”. Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as writeOnly being true and is in the required list, the required will take effect on the request only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false. +
    xml + XML Object + This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property. +
    externalDocs + External Documentation Object + Additional external documentation for this schema. +
    example + Any + A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. +
    deprecated + boolean + Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false. +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.25.2.1. Composition and Inheritance (Polymorphism)
    +

    The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. allOf takes an array of object definitions that are validated independently but together compose a single object.

    +

    While composition offers model extensibility, it does not imply a hierarchy between the models. +To support polymorphism, the OpenAPI Specification adds the discriminator field. +When used, the discriminator will be the name of the property that decides which schema definition validates the structure of the model. +As such, the discriminator field MUST be a required field. +There are two ways to define the value of a discriminator for an inheriting instance.

    +
      +
    • Use the schema name. +
    • Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name. +As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism. +
    +
    4.7.25.2.2. XML Modeling
    +

    The xml property allows extra definitions when translating the JSON definition to XML. +The XML Object contains additional information about the available options.

    +
    4.7.25.3. Schema Object Examples
    +
    4.7.25.3.1. Primitive Sample
    +
    {
    +  "type": "string",
    +  "format": "email"
    +}
    +
    +
    type: string
    +format: email
    +
    +
    4.7.25.3.2. Simple Model
    +
    {
    +  "type": "object",
    +  "required": [
    +    "name"
    +  ],
    +  "properties": {
    +    "name": {
    +      "type": "string"
    +    },
    +    "address": {
    +      "$ref": "#/components/schemas/Address"
    +    },
    +    "age": {
    +      "type": "integer",
    +      "format": "int32",
    +      "minimum": 0
    +    }
    +  }
    +}
    +
    +
    type: object
    +required:
    +- name
    +properties:
    +  name:
    +    type: string
    +  address:
    +    $ref: '#/components/schemas/Address'
    +  age:
    +    type: integer
    +    format: int32
    +    minimum: 0
    +
    +
    4.7.25.3.3. Model with Map/Dictionary Properties
    +

    For a simple string to string mapping:

    +
    {
    +  "type": "object",
    +  "additionalProperties": {
    +    "type": "string"
    +  }
    +}
    +
    +
    type: object
    +additionalProperties:
    +  type: string
    +
    +

    For a string to model mapping:

    +
    {
    +  "type": "object",
    +  "additionalProperties": {
    +    "$ref": "#/components/schemas/ComplexModel"
    +  }
    +}
    +
    +
    type: object
    +additionalProperties:
    +  $ref: '#/components/schemas/ComplexModel'
    +
    +
    4.7.25.3.4. Model with Example
    +
    {
    +  "type": "object",
    +  "properties": {
    +    "id": {
    +      "type": "integer",
    +      "format": "int64"
    +    },
    +    "name": {
    +      "type": "string"
    +    }
    +  },
    +  "required": [
    +    "name"
    +  ],
    +  "example": {
    +    "name": "Puma",
    +    "id": 1
    +  }
    +}
    +
    +
    type: object
    +properties:
    +  id:
    +    type: integer
    +    format: int64
    +  name:
    +    type: string
    +required:
    +- name
    +example:
    +  name: Puma
    +  id: 1
    +
    +
    4.7.25.3.5. Models with Composition
    +
    {
    +  "components": {
    +    "schemas": {
    +      "ErrorModel": {
    +        "type": "object",
    +        "required": [
    +          "message",
    +          "code"
    +        ],
    +        "properties": {
    +          "message": {
    +            "type": "string"
    +          },
    +          "code": {
    +            "type": "integer",
    +            "minimum": 100,
    +            "maximum": 600
    +          }
    +        }
    +      },
    +      "ExtendedErrorModel": {
    +        "allOf": [
    +          {
    +            "$ref": "#/components/schemas/ErrorModel"
    +          },
    +          {
    +            "type": "object",
    +            "required": [
    +              "rootCause"
    +            ],
    +            "properties": {
    +              "rootCause": {
    +                "type": "string"
    +              }
    +            }
    +          }
    +        ]
    +      }
    +    }
    +  }
    +}
    +
    +
    components:
    +  schemas:
    +    ErrorModel:
    +      type: object
    +      required:
    +      - message
    +      - code
    +      properties:
    +        message:
    +          type: string
    +        code:
    +          type: integer
    +          minimum: 100
    +          maximum: 600
    +    ExtendedErrorModel:
    +      allOf:
    +      - $ref: '#/components/schemas/ErrorModel'
    +      - type: object
    +        required:
    +        - rootCause
    +        properties:
    +          rootCause:
    +            type: string
    +
    +
    4.7.25.3.6. Models with Polymorphism Support
    +
    {
    +  "components": {
    +    "schemas": {
    +      "Pet": {
    +        "type": "object",
    +        "discriminator": {
    +          "propertyName": "petType"
    +        },
    +        "properties": {
    +          "name": {
    +            "type": "string"
    +          },
    +          "petType": {
    +            "type": "string"
    +          }
    +        },
    +        "required": [
    +          "name",
    +          "petType"
    +        ]
    +      },
    +      "Cat": {
    +        "description": "A representation of a cat. Note that Cat will be used as the discriminator value.",
    +        "allOf": [
    +          {
    +            "$ref": "#/components/schemas/Pet"
    +          },
    +          {
    +            "type": "object",
    +            "properties": {
    +              "huntingSkill": {
    +                "type": "string",
    +                "description": "The measured skill for hunting",
    +                "default": "lazy",
    +                "enum": [
    +                  "clueless",
    +                  "lazy",
    +                  "adventurous",
    +                  "aggressive"
    +                ]
    +              }
    +            },
    +            "required": [
    +              "huntingSkill"
    +            ]
    +          }
    +        ]
    +      },
    +      "Dog": {
    +        "description": "A representation of a dog. Note that Dog will be used as the discriminator value.",
    +        "allOf": [
    +          {
    +            "$ref": "#/components/schemas/Pet"
    +          },
    +          {
    +            "type": "object",
    +            "properties": {
    +              "packSize": {
    +                "type": "integer",
    +                "format": "int32",
    +                "description": "the size of the pack the dog is from",
    +                "default": 0,
    +                "minimum": 0
    +              }
    +            },
    +            "required": [
    +              "packSize"
    +            ]
    +          }
    +        ]
    +      }
    +    }
    +  }
    +}
    +
    +
    components:
    +  schemas:
    +    Pet:
    +      type: object
    +      discriminator:
    +        propertyName: petType
    +      properties:
    +        name:
    +          type: string
    +        petType:
    +          type: string
    +      required:
    +      - name
    +      - petType
    +    Cat:  ## "Cat" will be used as the discriminator value
    +      description: A representation of a cat
    +      allOf:
    +      - $ref: '#/components/schemas/Pet'
    +      - type: object
    +        properties:
    +          huntingSkill:
    +            type: string
    +            description: The measured skill for hunting
    +            enum:
    +            - clueless
    +            - lazy
    +            - adventurous
    +            - aggressive
    +        required:
    +        - huntingSkill
    +    Dog:  ## "Dog" will be used as the discriminator value
    +      description: A representation of a dog
    +      allOf:
    +      - $ref: '#/components/schemas/Pet'
    +      - type: object
    +        properties:
    +          packSize:
    +            type: integer
    +            format: int32
    +            description: the size of the pack the dog is from
    +            default: 0
    +            minimum: 0
    +        required:
    +        - packSize
    +
    +
    4.7.25.4. Discriminator Object
    +

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    +

    When using the discriminator, inline schemas will not be considered.

    +
    4.7.25.5. Fixed Fields
    + + + + + + +
    Field Name + Type + Description +
    propertyName + string + REQUIRED. The name of the property in the payload that will hold the discriminator value. +
    mapping + Map[string, string] + An object to hold mappings between payload values and schema names or references. +
    +

    The discriminator attribute is legal only when using one of the composite keywords oneOf, anyOf, allOf.

    +

    In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:

    +
    MyResponseType:
    +  oneOf:
    +  - $ref: '#/components/schemas/Cat'
    +  - $ref: '#/components/schemas/Dog'
    +  - $ref: '#/components/schemas/Lizard'
    +
    +

    which means the payload MUST, by validation, match exactly one of the schemas described by Cat, Dog, or Lizard. In this case, a discriminator MAY act as a “hint” to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use:

    +
    MyResponseType:
    +  oneOf:
    +  - $ref: '#/components/schemas/Cat'
    +  - $ref: '#/components/schemas/Dog'
    +  - $ref: '#/components/schemas/Lizard'
    +  discriminator:
    +    propertyName: pet_type
    +
    +

    The expectation now is that a property with name pet_type MUST be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload:

    +
    {
    +  "id": 12345,
    +  "pet_type": "Cat"
    +}
    +
    +

    Will indicate that the Cat schema be used in conjunction with this payload.

    +

    In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional mapping definition MAY be used:

    +
    MyResponseType:
    +  oneOf:
    +  - $ref: '#/components/schemas/Cat'
    +  - $ref: '#/components/schemas/Dog'
    +  - $ref: '#/components/schemas/Lizard'
    +  - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json'
    +  discriminator:
    +    propertyName: pet_type
    +    mapping:
    +      dog: '#/components/schemas/Dog'
    +      monster: 'https://gigantic-server.com/schemas/Monster/schema.json'
    +
    +

    Here the discriminator value of dog will map to the schema #/components/schemas/Dog, rather than the default (implicit) value of Dog. If the discriminator value does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison.

    +

    When used in conjunction with the anyOf construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload.

    +

    In both the oneOf and anyOf use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an allOf construct may be used as an alternate schema.

    +

    For example:

    +
    components:
    +  schemas:
    +    Pet:
    +      type: object
    +      required:
    +      - pet_type
    +      properties:
    +        pet_type:
    +          type: string
    +      discriminator:
    +        propertyName: pet_type
    +        mapping:
    +          cachorro: Dog
    +    Cat:
    +      allOf:
    +      - $ref: '#/components/schemas/Pet'
    +      - type: object
    +        # all other properties specific to a Cat
    +        properties:
    +          name:
    +            type: string
    +    Dog:
    +      allOf:
    +      - $ref: '#/components/schemas/Pet'
    +      - type: object
    +        # all other properties specific to a Dog
    +        properties:
    +          bark:
    +            type: string
    +    Lizard:
    +      allOf:
    +      - $ref: '#/components/schemas/Pet'
    +      - type: object
    +        # all other properties specific to a Lizard
    +        properties:
    +          lovesRocks:
    +            type: boolean
    +
    +

    a payload like this:

    +
    {
    +  "pet_type": "Cat",
    +  "name": "misty"
    +}
    +
    +

    will indicate that the Cat schema be used. Likewise this schema:

    +
    {
    +  "pet_type": "cachorro",
    +  "bark": "soft"
    +}
    +
    +

    will map to Dog because of the definition in the mappings element.

    +

    4.7.26. XML Object

    +

    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.

    +
    4.7.26.1. Fixed Fields
    + + + + + + + + + +
    Field Name + Type + Description +
    name + string + Replaces the name of the element/attribute used for the described schema property. When defined within 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. +
    namespace + string + The URI of the namespace definition. Value MUST be in the form of an absolute URI. +
    prefix + string + The prefix to be used for the name. +
    attribute + boolean + Declares whether the property definition translates to an attribute instead of an element. Default value is false. +
    wrapped + 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). +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.26.2. XML Object Examples
    +

    The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

    +
    4.7.26.2.1. No XML Element
    +

    Basic string property:

    +
    {
    +    "animals": {
    +        "type": "string"
    +    }
    +}
    +
    +
    animals:
    +  type: string
    +
    +
    <animals>...</animals>
    +
    +

    Basic string array property (wrapped is false by default):

    +
    {
    +    "animals": {
    +        "type": "array",
    +        "items": {
    +            "type": "string"
    +        }
    +    }
    +}
    +
    +
    animals:
    +  type: array
    +  items:
    +    type: string
    +
    +
    <animals>...</animals>
    +<animals>...</animals>
    +<animals>...</animals>
    +
    +
    4.7.26.2.2. XML Name Replacement
    +
    {
    +  "animals": {
    +    "type": "string",
    +    "xml": {
    +      "name": "animal"
    +    }
    +  }
    +}
    +
    +
    animals:
    +  type: string
    +  xml:
    +    name: animal
    +
    +
    <animal>...</animal>
    +
    +
    4.7.26.2.3. XML Attribute, Prefix and Namespace
    +

    In this example, a full model definition is shown.

    +
    {
    +  "Person": {
    +    "type": "object",
    +    "properties": {
    +      "id": {
    +        "type": "integer",
    +        "format": "int32",
    +        "xml": {
    +          "attribute": true
    +        }
    +      },
    +      "name": {
    +        "type": "string",
    +        "xml": {
    +          "namespace": "http://example.com/schema/sample",
    +          "prefix": "sample"
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    Person:
    +  type: object
    +  properties:
    +    id:
    +      type: integer
    +      format: int32
    +      xml:
    +        attribute: true
    +    name:
    +      type: string
    +      xml:
    +        namespace: http://example.com/schema/sample
    +        prefix: sample
    +
    +
    <Person id="123">
    +    <sample:name xmlns:sample="http://example.com/schema/sample">example</sample:name>
    +</Person>
    +
    +
    4.7.26.2.4. XML Arrays
    +

    Changing the element names:

    +
    {
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string",
    +      "xml": {
    +        "name": "animal"
    +      }
    +    }
    +  }
    +}
    +
    +
    animals:
    +  type: array
    +  items:
    +    type: string
    +    xml:
    +      name: animal
    +
    +
    <animal>value</animal>
    +<animal>value</animal>
    +
    +

    The external name property has no effect on the XML:

    +
    {
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string",
    +      "xml": {
    +        "name": "animal"
    +      }
    +    },
    +    "xml": {
    +      "name": "aliens"
    +    }
    +  }
    +}
    +
    +
    animals:
    +  type: array
    +  items:
    +    type: string
    +    xml:
    +      name: animal
    +  xml:
    +    name: aliens
    +
    +
    <animal>value</animal>
    +<animal>value</animal>
    +
    +

    Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally:

    +
    {
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string"
    +    },
    +    "xml": {
    +      "wrapped": true
    +    }
    +  }
    +}
    +
    +
    animals:
    +  type: array
    +  items:
    +    type: string
    +  xml:
    +    wrapped: true
    +
    +
    <animals>
    +  <animals>value</animals>
    +  <animals>value</animals>
    +</animals>
    +
    +

    To overcome the naming problem in the example above, the following definition can be used:

    +
    {
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string",
    +      "xml": {
    +        "name": "animal"
    +      }
    +    },
    +    "xml": {
    +      "wrapped": true
    +    }
    +  }
    +}
    +
    +
    animals:
    +  type: array
    +  items:
    +    type: string
    +    xml:
    +      name: animal
    +  xml:
    +    wrapped: true
    +
    +
    <animals>
    +  <animal>value</animal>
    +  <animal>value</animal>
    +</animals>
    +
    +

    Affecting both internal and external names:

    +
    {
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string",
    +      "xml": {
    +        "name": "animal"
    +      }
    +    },
    +    "xml": {
    +      "name": "aliens",
    +      "wrapped": true
    +    }
    +  }
    +}
    +
    +
    animals:
    +  type: array
    +  items:
    +    type: string
    +    xml:
    +      name: animal
    +  xml:
    +    name: aliens
    +    wrapped: true
    +
    +
    <aliens>
    +  <animal>value</animal>
    +  <animal>value</animal>
    +</aliens>
    +
    +

    If we change the external element but not the internal ones:

    +
    {
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string"
    +    },
    +    "xml": {
    +      "name": "aliens",
    +      "wrapped": true
    +    }
    +  }
    +}
    +
    +
    animals:
    +  type: array
    +  items:
    +    type: string
    +  xml:
    +    name: aliens
    +    wrapped: true
    +
    +
    <aliens>
    +  <aliens>value</aliens>
    +  <aliens>value</aliens>
    +</aliens>
    +
    +
    4.7.26.3. Security Scheme Object
    +

    Defines a security scheme that can be used by the operations. +Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [rfc6749], and OpenID Connect Discovery.

    +
    4.7.26.4. Fixed Fields
    + + + + + + + + + + + + +
    Field Name + Type + Applies To + Description +
    type + string + Any + REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "oauth2", "openIdConnect". +
    description + string + Any + A short description for security scheme. CommonMark syntax MAY be used for rich text representation. +
    name + string + apiKey + REQUIRED. The name of the header, query or cookie parameter to be used. +
    in + string + apiKey + REQUIRED. The location of the API key. Valid values are "query", "header" or "cookie". +
    scheme + string + http + REQUIRED. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235]section-5.1). +
    bearerFormat + string + http ("bearer") + A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. +
    flows + OAuth Flows Object + oauth2 + REQUIRED. An object containing configuration information for the flow types supported. +
    openIdConnectUrl + string + openIdConnect + REQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.26.5. Security Scheme Object Example
    +
    4.7.26.5.1. Basic Authentication Sample
    +
    {
    +  "type": "http",
    +  "scheme": "basic"
    +}
    +
    +
    type: http
    +scheme: basic
    +
    +
    4.7.26.5.2. API Key Sample
    +
    {
    +  "type": "apiKey",
    +  "name": "api_key",
    +  "in": "header"
    +}
    +
    +
    type: apiKey
    +name: api_key
    +in: header
    +
    +
    4.7.26.5.3. JWT Bearer Sample
    +
    {
    +  "type": "http",
    +  "scheme": "bearer",
    +  "bearerFormat": "JWT",
    +}
    +
    +
    type: http
    +scheme: bearer
    +bearerFormat: JWT
    +
    +
    4.7.26.5.4. Implicit OAuth2 Sample
    +
    {
    +  "type": "oauth2",
    +  "flows": {
    +    "implicit": {
    +      "authorizationUrl": "https://example.com/api/oauth/dialog",
    +      "scopes": {
    +        "write:pets": "modify pets in your account",
    +        "read:pets": "read your pets"
    +      }
    +    }
    +  }
    +}
    +
    +
    type: oauth2
    +flows: 
    +  implicit:
    +    authorizationUrl: https://example.com/api/oauth/dialog
    +    scopes:
    +      write:pets: modify pets in your account
    +      read:pets: read your pets
    +
    +
    4.7.26.6. OAuth Flows Object
    +

    Allows configuration of the supported OAuth Flows.

    +
    4.7.26.7. Fixed Fields
    + + + + + + + + +
    Field Name + Type + Description +
    implicit + OAuth Flow Object + Configuration for the OAuth Implicit flow +
    password + OAuth Flow Object + Configuration for the OAuth Resource Owner Password flow +
    clientCredentials + OAuth Flow Object + Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0. +
    authorizationCode + OAuth Flow Object + Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0. +
    +

    This object MAY be extended with Specification Extensions.

    +

    4.7.27. OAuth Flow Object

    +

    Configuration details for a supported OAuth Flow

    +
    4.7.27.1. Fixed Fields
    + + + + + + + + +
    Field Name + Type + Applies To + Description +
    authorizationUrl + string + oauth2 ("implicit", "authorizationCode") + REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL. +
    tokenUrl + string + oauth2 ("password", "clientCredentials", "authorizationCode") + REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL. +
    refreshUrl + string + oauth2 + The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. +
    scopes + Map[string, string] + oauth2 + REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. +
    +

    This object MAY be extended with Specification Extensions.

    +
    4.7.27.2. OAuth Flow Object Examples
    +
    {
    +  "type": "oauth2",
    +  "flows": {
    +    "implicit": {
    +      "authorizationUrl": "https://example.com/api/oauth/dialog",
    +      "scopes": {
    +        "write:pets": "modify pets in your account",
    +        "read:pets": "read your pets"
    +      }
    +    },
    +    "authorizationCode": {
    +      "authorizationUrl": "https://example.com/api/oauth/dialog",
    +      "tokenUrl": "https://example.com/api/oauth/token",
    +      "scopes": {
    +        "write:pets": "modify pets in your account",
    +        "read:pets": "read your pets"
    +      }
    +    }
    +  }
    +}
    +
    +
    type: oauth2
    +flows: 
    +  implicit:
    +    authorizationUrl: https://example.com/api/oauth/dialog
    +    scopes:
    +      write:pets: modify pets in your account
    +      read:pets: read your pets
    +  authorizationCode:
    +    authorizationUrl: https://example.com/api/oauth/dialog
    +    tokenUrl: https://example.com/api/oauth/token
    +    scopes:
    +      write:pets: modify pets in your account
    +      read:pets: read your pets 
    +
    +

    4.7.28. Security Requirement Object

    +

    Lists the required security schemes to execute this operation. +The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.

    +

    Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. +This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.

    +

    When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.

    +
    4.7.28.1. Patterned Fields
    + + + + + +
    Field Pattern + Type + Description +
    {name} + [string] + Each name MUST correspond to a security scheme which is declared in the Security Schemes under the Components Object. If the security scheme is of type "oauth2" or "openIdConnect", then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty. +
    +
    4.7.28.2. Security Requirement Object Examples
    +
    4.7.28.2.1. Non-OAuth2 Security Requirement
    +
    {
    +  "api_key": []
    +}
    +
    +
    api_key: []
    +
    +
    4.7.28.2.2. OAuth2 Security Requirement
    +
    {
    +  "petstore_auth": [
    +    "write:pets",
    +    "read:pets"
    +  ]
    +}
    +
    +
    petstore_auth:
    +- write:pets
    +- read:pets
    +
    +
    4.7.28.3. Specification Extensions
    +

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    +

    The extensions properties are implemented as patterned fields that are always prefixed by "x-".

    + + + + + +
    Field Pattern + Type + Description +
    ^x- + Any + Allows extensions to the OpenAPI Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. 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).

    +
    4.7.28.4. Security Filtering
    +

    Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.

    +

    The reasoning is to allow an additional layer of access control over the documentation. +While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.

    +

    Two examples of this:

    +
      +
    1. The Paths Object MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication. +
    2. The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object, so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see. +
    +
    Appendix A: Revision History
    + + + + + + + + + + + + + + +
    Version + Date + Notes +
    3.0.1 + TBA + TBA +
    3.0.0 + 2017-07-26 + Release of the OpenAPI Specification 3.0.0 +
    3.0.0-rc2 + 2017-06-16 + rc2 of the 3.0 specification +
    3.0.0-rc1 + 2017-04-27 + rc1 of the 3.0 specification +
    3.0.0-rc0 + 2017-02-28 + Implementer’s Draft of the 3.0 specification +
    2.0 + 2015-12-31 + Donation of Swagger 2.0 to the Open API Initiative +
    2.0 + 2014-09-08 + Release of Swagger 2.0 +
    1.2 + 2014-03-14 + Initial release of the formal document. +
    1.1 + 2012-08-22 + Release of Swagger 1.1 +
    1.0 + 2011-08-10 + First release of the Swagger Specification +
    +
    +
    +

    Conformance

    +

    Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. + The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” + in the normative parts of this document + are to be interpreted as described in RFC 2119. + However, for readability, + these words do not appear in all uppercase letters in this specification.

    +

    All of the text of this specification is normative + except sections explicitly marked as non-normative, examples, and notes. [RFC2119]

    +

    Examples in this specification are introduced with the words “for example” + or are set apart from the normative text with class="example", like this:

    +
    This is an example of an informative example.
    +

    Informative notes begin with the word “Note” + and are set apart from the normative text with class="note", like this:

    +

    Note, this is an informative note.

    +
    + +

    Index

    +

    Terms defined by this specification

    + +

    References

    +

    Normative References

    +
    +
    [RFC1866] +
    D. Connolly; L. Masinter. The 'text/html' Media Type. June 2000. Informational. URL: https://tools.ietf.org/html/rfc2854 +
    [RFC2119] +
    S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119 +
    [RFC3986] +
    T. Berners-Lee; R. Fielding; L. Masinter. Uniform Resource Identifier (URI): Generic Syntax. January 2005. Internet Standard. URL: https://tools.ietf.org/html/rfc3986 +
    [RFC6570] +
    J. Gregorio; et al. URI Template. March 2012. Proposed Standard. URL: https://tools.ietf.org/html/rfc6570 +
    [RFC6749] +
    D. Hardt, Ed.. The OAuth 2.0 Authorization Framework. October 2012. Proposed Standard. URL: https://tools.ietf.org/html/rfc6749 +
    [RFC6838] +
    N. Freed; J. Klensin; T. Hansen. Media Type Specifications and Registration Procedures. January 2013. Best Current Practice. URL: https://tools.ietf.org/html/rfc6838 +
    [RFC6901] +
    P. Bryan, Ed.; K. Zyp; M. Nottingham, Ed.. JavaScript Object Notation (JSON) Pointer. April 2013. Proposed Standard. URL: https://tools.ietf.org/html/rfc6901 +
    [RFC7230] +
    R. Fielding, Ed.; J. Reschke, Ed.. Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing. June 2014. Proposed Standard. URL: https://tools.ietf.org/html/rfc7230 +
    [RFC7231] +
    R. Fielding, Ed.; J. Reschke, Ed.. Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content. June 2014. Proposed Standard. URL: https://tools.ietf.org/html/rfc7231 +
    [RFC8174] +
    B. Leiba. Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words. May 2017. Best Current Practice. URL: https://tools.ietf.org/html/rfc8174 +
    + + + + + \ No newline at end of file From 9afcbea718a80770a17a7a678c6b4d5c3eb589d6 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 30 Jan 2018 10:29:14 +0000 Subject: [PATCH 09/34] respec; as an alternative to bikeshed --- bikeshed/build.sh | 6 +- bikeshed/md2bs.js | 121 ------------------- bikeshed/md2html.js | 236 +++++++++++++++++++++++++++++++++++++ bikeshed/v2/oas_2.0.html | 2 +- bikeshed/v3/3.0.0.bs | 2 +- bikeshed/v3/3.0.1.bs | 2 +- bikeshed/v3/oas_3.0.0.html | 4 +- bikeshed/v3/oas_3.0.1.html | 4 +- package.json | 1 + 9 files changed, 247 insertions(+), 131 deletions(-) mode change 100644 => 100755 bikeshed/build.sh delete mode 100644 bikeshed/md2bs.js create mode 100644 bikeshed/md2html.js diff --git a/bikeshed/build.sh b/bikeshed/build.sh old mode 100644 new mode 100755 index ab7807479f..741d254653 --- a/bikeshed/build.sh +++ b/bikeshed/build.sh @@ -1,16 +1,16 @@ #!/bin/sh -node md2bs.js ../versions/3.0.0.md > v3/3.0.0.bs +node md2html.js ../versions/3.0.0.md > v3/3.0.0.bs cat v3/h3.0.0.bs style-start.html syntax-github.css style-finish.html v3/3.0.0.bs > v3/input.bs curl https://api.csswg.org/bikeshed/ -F file=@v3/input.bs -F output=err > v3/oas_3.0.0.err curl https://api.csswg.org/bikeshed/ -F file=@v3/input.bs -F force=1 > v3/oas_3.0.0.html -node md2bs.js ../versions/3.0.1.md > v3/3.0.1.bs +node md2html.js ../versions/3.0.1.md > v3/3.0.1.bs cat v3/h3.0.1.bs style-start.html syntax-github.css style-finish.html v3/3.0.1.bs > v3/input.bs curl https://api.csswg.org/bikeshed/ -F file=@v3/input.bs -F output=err > v3/oas_3.0.1.err curl https://api.csswg.org/bikeshed/ -F file=@v3/input.bs -F force=1 > v3/oas_3.0.1.html -node md2bs.js ../versions/2.0.md > v2/2.0.bs +node md2html.js ../versions/2.0.md > v2/2.0.bs cat v2/heading.bs style-start.html syntax-github.css style-finish.html v2/2.0.bs > v2/input.bs curl https://api.csswg.org/bikeshed/ -F file=@v2/input.bs -F output=err > v2/oas_2.0.err curl https://api.csswg.org/bikeshed/ -F file=@v2/input.bs -F force=1 > v2/oas_2.0.html diff --git a/bikeshed/md2bs.js b/bikeshed/md2bs.js deleted file mode 100644 index d7ccc87602..0000000000 --- a/bikeshed/md2bs.js +++ /dev/null @@ -1,121 +0,0 @@ -/* bikeshed claims to support markdown syntax, but not (yet) commonmark. -Hence we render the markdown to HTML ourselves, this gives us -complete control over formatting and syntax highlighting (where -highlight.js does a better job than bikeshed's Pygments) */ - -/** -@author Mike Ralphson -**/ - -const fs = require('fs'); -const hljs = require('highlightjs/highlight.pack.js'); -const md = require('markdown-it')({ - html: true, - linkify: true, - typographer: true, - highlight: function (str, lang) { - if (lang && hljs.getLanguage(lang)) { - try { - return '
    ' +
    -                  hljs.highlight(lang, str, true).value +
    -                  '
    '; - } catch (__) { } - } - - return '
    ' + md.utils.escapeHtml(str) + '
    '; - } -}); -let s = fs.readFileSync(process.argv[2],'utf8'); - -let lines = s.split('\r').join().split('\n'); - -let prevIndent = 0; -let inTOC = false; -let inDefs = false; -let inCodeBlock = false; - -for (let l in lines) { - let line = lines[l]; - - if (line.startsWith('## Table of Contents')) inTOC = true; - if (line.startsWith(' +

    Definitions

    +
    OpenAPI Document
    +

    A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification.

    +
    Path Templating
    +

    Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters.

    +
    Media Types
    +

    Media type definitions are spread across several resources. +The media type definitions SHOULD be in compliance with [[!rfc6838]].

    +

    Some examples of possible media type definitions:

    +
    
    +  text/plain; charset=utf-8
    +  application/json
    +  application/vnd.github+json
    +  application/vnd.github.v3+json
    +  application/vnd.github.v3.raw+json
    +  application/vnd.github.v3.text+json
    +  application/vnd.github.v3.html+json
    +  application/vnd.github.v3.full+json
    +  application/vnd.github.v3.diff
    +  application/vnd.github.v3.patch
    +
    +
    HTTP Status Codes
    +

    The HTTP Status Codes are used to indicate the status of the executed operation. +The available status codes are defined by [[!rfc7231]]section-6) and registered status codes are listed in the IANA Status Code Registry.

    +

    Specification

    +

    Versions

    +

    The OpenAPI Specification is versioned using Semantic Versioning 2.0.0 (semver) and follows the semver specification.

    +

    The major.minor portion of the semver (for example 3.0) SHALL designate the OAS feature set. Typically, .patch versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between 3.0.0 and 3.0.1 for example.

    +

    Subsequent minor version releases of the OpenAPI Specification (incrementing the minor version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical 3.1.0 specification SHOULD be usable with tooling designed for 3.0.0.

    +

    An OpenAPI document compatible with OAS 3.*.* contains a required openapi field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named swagger and value "2.0".)

    +

    Format

    +

    An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format.

    +

    For example, if a field has an array value, the JSON array representation will be used:

    +
    
    +{
    +   "field": [ 1, 2, 3 ]
    +}
    +
    +

    All field names in the specification are case sensitive.

    +

    The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name.

    +

    Patterned fields MUST have unique names within the containing object.

    +

    In order to preserve the ability to round-trip between YAML and JSON formats, YAML version 1.2 is RECOMMENDED along with some additional constraints:

    + +

    Note: While APIs may be defined by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML.

    +

    Document Structure

    +

    An OpenAPI document MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the user. In the latter case, $ref fields MUST be used in the specification to reference those parts as follows from the JSON Schema definitions.

    +

    It is RECOMMENDED that the root OpenAPI document be named: openapi.json or openapi.yaml.

    +

    Data Types

    +

    Primitive data types in the OAS are based on the types supported by the JSON Schema Specification Wright Draft 00. +Note that integer as a type is also supported and is defined as a JSON number without a fraction or exponent part. +null is not supported as a type (see nullable for an alternative solution). +Models are defined using the Schema Object, which is an extended subset of JSON Schema Specification Wright Draft 00.

    +

    Primitives have an optional modifier property: format. +OAS uses several known formats to define in fine detail the data type being used. +However, to support documentation needs, the format property is an open string-valued property, and can have any value. +Formats such as "email", "uuid", and so on, MAY be used even though undefined by this specification. +Types that are not accompanied by a format property follow the type definition in the JSON Schema. Tools that do not recognize a specific format MAY default back to the type alone, as if the format is not specified.

    +

    The formats defined by the OAS are:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Common NametypeformatComments
    integerintegerint32signed 32 bits
    longintegerint64signed 64 bits
    floatnumberfloat
    doublenumberdouble
    stringstring
    bytestringbytebase64 encoded characters
    binarystringbinaryany sequence of octets
    booleanboolean
    datestringdateAs defined by full-date - [!rfc3339]
    dateTimestringdate-timeAs defined by date-time - [!rfc3339]
    passwordstringpasswordA hint to UIs to obscure input.
    +

    Rich Text Formatting

    +

    Throughout the specification description fields are noted as supporting CommonMark markdown formatting. +Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by CommonMark 0.27. Tooling MAY choose to ignore some CommonMark features to address security concerns.

    +

    Relative References in URLs

    +

    Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [[!rfc3986]]section-4.2). +Relative references are resolved using the URLs defined in the Server Object as a Base URI.

    +

    Relative references used in $ref are processed as per JSON Reference, using the URL of the current document as the base URI. See also the Reference Object.

    +

    Schema

    +

    In the following description, if a field is not explicitly REQUIRED or described with a MUST or SHALL, it can be considered OPTIONAL.

    +

    OpenAPI Object

    +

    This is the root document object of the OpenAPI document.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    openapistringREQUIRED. This string MUST be the semantic version number of the OpenAPI Specification version that the OpenAPI document uses. The openapi field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is not related to the API info.version string.
    infoInfo ObjectREQUIRED. Provides metadata about the API. The metadata MAY be used by tooling as required.
    servers[Server Object]An array of Server Objects, which provide connectivity information to a target server. If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url value of /.
    pathsPaths ObjectREQUIRED. The available paths and operations for the API.
    componentsComponents ObjectAn element to hold various schemas for the specification.
    security[Security Requirement Object]A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition.
    tags[Tag Object]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.
    externalDocsExternal Documentation ObjectAdditional external documentation.
    +

    This object MAY be extended with Specification Extensions.

    +

    Info Object

    +

    The object provides metadata about the API. +The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    titlestringREQUIRED. The title of the application.
    descriptionstringA short description of the application. CommonMark syntax MAY be used for rich text representation.
    termsOfServicestringA URL to the Terms of Service for the API. MUST be in the format of a URL.
    contactContact ObjectThe contact information for the exposed API.
    licenseLicense ObjectThe license information for the exposed API.
    versionstringREQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version).
    +

    This object MAY be extended with Specification Extensions.

    +
    Info Object Example:
    +
    
    +{
    +  "title": "Sample Pet Store App",
    +  "description": "This is a sample server for a pet store.",
    +  "termsOfService": "http://example.com/terms/",
    +  "contact": {
    +    "name": "API Support",
    +    "url": "http://www.example.com/support",
    +    "email": "support@example.com"
    +  },
    +  "license": {
    +    "name": "Apache 2.0",
    +    "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    +  },
    +  "version": "1.0.1"
    +}
    +
    +
    
    +title: Sample Pet Store App
    +description: This is a sample server for a pet store.
    +termsOfService: http://example.com/terms/
    +contact:
    +  name: API Support
    +  url: http://www.example.com/support
    +  email: support@example.com
    +license:
    +  name: Apache 2.0
    +  url: https://www.apache.org/licenses/LICENSE-2.0.html
    +version: 1.0.1
    +
    +

    Contact Object

    +

    Contact information for the exposed API.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    namestringThe identifying name of the contact person/organization.
    urlstringThe URL pointing to the contact information. MUST be in the format of a URL.
    emailstringThe email address of the contact person/organization. MUST be in the format of an email address.
    +

    This object MAY be extended with Specification Extensions.

    +
    Contact Object Example:
    +
    
    +{
    +  "name": "API Support",
    +  "url": "http://www.example.com/support",
    +  "email": "support@example.com"
    +}
    +
    +
    
    +name: API Support
    +url: http://www.example.com/support
    +email: support@example.com
    +
    +

    License Object

    +

    License information for the exposed API.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    namestringREQUIRED. The license name used for the API.
    urlstringA URL to the license used for the API. MUST be in the format of a URL.
    +

    This object MAY be extended with Specification Extensions.

    +
    License Object Example:
    +
    
    +{
    +  "name": "Apache 2.0",
    +  "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    +}
    +
    +
    
    +name: Apache 2.0
    +url: https://www.apache.org/licenses/LICENSE-2.0.html
    +
    +

    Server Object

    +

    An object representing a Server.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    urlstringREQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in {brackets}.
    descriptionstringAn optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation.
    variablesMap[string, Server Variable Object]A map between a variable name and its value. The value is used for substitution in the server’s URL template.
    +

    This object MAY be extended with Specification Extensions.

    +
    Server Object Example
    +

    A single server would be described as:

    +
    
    +{
    +  "url": "https://development.gigantic-server.com/v1",
    +  "description": "Development server"
    +}
    +
    +
    
    +url: https://development.gigantic-server.com/v1
    +description: Development server
    +
    +

    The following shows how multiple servers can be described, for example, at the OpenAPI Object’s servers:

    +
    
    +{
    +  "servers": [
    +    {
    +      "url": "https://development.gigantic-server.com/v1",
    +      "description": "Development server"
    +    },
    +    {
    +      "url": "https://staging.gigantic-server.com/v1",
    +      "description": "Staging server"
    +    },
    +    {
    +      "url": "https://api.gigantic-server.com/v1",
    +      "description": "Production server"
    +    }
    +  ]
    +}
    +
    +
    
    +servers:
    +- url: https://development.gigantic-server.com/v1
    +  description: Development server
    +- url: https://staging.gigantic-server.com/v1
    +  description: Staging server
    +- url: https://api.gigantic-server.com/v1
    +  description: Production server
    +
    +

    The following shows how variables can be used for a server configuration:

    +
    
    +{
    +  "servers": [
    +    {
    +      "url": "https://{username}.gigantic-server.com:{port}/{basePath}",
    +      "description": "The production API server",
    +      "variables": {
    +        "username": {
    +          "default": "demo",
    +          "description": "this value is assigned by the service provider, in this example `gigantic-server.com`"
    +        },
    +        "port": {
    +          "enum": [
    +            "8443",
    +            "443"
    +          ],
    +          "default": "8443"
    +        },
    +        "basePath": {
    +          "default": "v2"
    +        }
    +      }
    +    }
    +  ]
    +}
    +
    +
    
    +servers:
    +- url: https://{username}.gigantic-server.com:{port}/{basePath}
    +  description: The production API server
    +  variables:
    +    username:
    +      # note! no enum here means it is an open value
    +      default: demo
    +      description: this value is assigned by the service provider, in this example `gigantic-server.com`
    +    port:
    +      enum:
    +        - '8443'
    +        - '443'
    +      default: '8443'
    +    basePath:
    +      # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2`
    +      default: v2
    +
    +

    Server Variable Object

    +

    An object representing a Server Variable for server URL template substitution.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    enum[string]An enumeration of string values to be used if the substitution options are from a limited set.
    defaultstringREQUIRED. The default value to use for substitution, and to send, if an alternate value is not supplied. Unlike the Schema Object’s default, this value MUST be provided by the consumer.
    descriptionstringAn optional description for the server variable. CommonMark syntax MAY be used for rich text representation.
    +

    This object MAY be extended with Specification Extensions.

    +

    Components Object

    +

    Holds a set of reusable objects for different aspects of the OAS. +All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    schemasMap[string, Schema Object ¦ Reference Object]An object to hold reusable Schema Objects.
    responsesMap[string, Response Object ¦ Reference Object]An object to hold reusable Response Objects.
    parametersMap[string, Parameter Object ¦ Reference Object]An object to hold reusable Parameter Objects.
    examplesMap[string, Example Object ¦ Reference Object]An object to hold reusable Example Objects.
    requestBodiesMap[string, Request Body Object ¦ Reference Object]An object to hold reusable Request Body Objects.
    headersMap[string, Header Object ¦ Reference Object]An object to hold reusable Header Objects.
    securitySchemesMap[string, Security Scheme Object ¦ Reference Object]An object to hold reusable Security Scheme Objects.
    linksMap[string, Link Object ¦ Reference Object]An object to hold reusable Link Objects.
    callbacksMap[string, Callback Object ¦ Reference Object]An object to hold reusable Callback Objects.
    +

    This object MAY be extended with Specification Extensions.

    +

    All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9\.\-_]+$.

    +

    Field Name Examples:

    +
    
    +User
    +User_1
    +User_Name
    +user-name
    +my.org.User
    +
    +
    Components Object Example
    +
    
    +"components": {
    +  "schemas": {
    +    "Category": {
    +      "type": "object",
    +      "properties": {
    +        "id": {
    +          "type": "integer",
    +          "format": "int64"
    +        },
    +        "name": {
    +          "type": "string"
    +        }
    +      }
    +    },
    +    "Tag": {
    +      "type": "object",
    +      "properties": {
    +        "id": {
    +          "type": "integer",
    +          "format": "int64"
    +        },
    +        "name": {
    +          "type": "string"
    +        }
    +      }
    +    }
    +  },
    +  "parameters": {
    +    "skipParam": {
    +      "name": "skip",
    +      "in": "query",
    +      "description": "number of items to skip",
    +      "required": true,
    +      "schema": {
    +        "type": "integer",
    +        "format": "int32"
    +      }
    +    },
    +    "limitParam": {
    +      "name": "limit",
    +      "in": "query",
    +      "description": "max records to return",
    +      "required": true,
    +      "schema" : {
    +        "type": "integer",
    +        "format": "int32"
    +      }
    +    }
    +  },
    +  "responses": {
    +    "NotFound": {
    +      "description": "Entity not found."
    +    },
    +    "IllegalInput": {
    +      "description": "Illegal input for operation."
    +    },
    +    "GeneralError": {
    +      "description": "General Error",
    +      "content": {
    +        "application/json": {
    +          "schema": {
    +            "$ref": "#/components/schemas/GeneralError"
    +          }
    +        }
    +      }
    +    }
    +  },
    +  "securitySchemes": {
    +    "api_key": {
    +      "type": "apiKey",
    +      "name": "api_key",
    +      "in": "header"
    +    },
    +    "petstore_auth": {
    +      "type": "oauth2",
    +      "flows": {
    +        "implicit": {
    +          "authorizationUrl": "http://example.org/api/oauth/dialog",
    +          "scopes": {
    +            "write:pets": "modify pets in your account",
    +            "read:pets": "read your pets"
    +          }
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    
    +components:
    +  schemas:
    +    Category:
    +      type: object
    +      properties:
    +        id:
    +          type: integer
    +          format: int64
    +        name:
    +          type: string
    +    Tag:
    +      type: object
    +      properties:
    +        id:
    +          type: integer
    +          format: int64
    +        name:
    +          type: string
    +  parameters:
    +    skipParam:
    +      name: skip
    +      in: query
    +      description: number of items to skip
    +      required: true
    +      schema:
    +        type: integer
    +        format: int32
    +    limitParam:
    +      name: limit
    +      in: query
    +      description: max records to return
    +      required: true
    +      schema:
    +        type: integer
    +        format: int32
    +  responses:
    +    NotFound:
    +      description: Entity not found.
    +    IllegalInput:
    +      description: Illegal input for operation.
    +    GeneralError:
    +      description: General Error
    +      content:
    +        application/json:
    +          schema:
    +            $ref: '#/components/schemas/GeneralError'
    +  securitySchemes:
    +    api_key:
    +      type: apiKey
    +      name: api_key
    +      in: header
    +    petstore_auth:
    +      type: oauth2
    +      flows: 
    +        implicit:
    +          authorizationUrl: http://example.org/api/oauth/dialog
    +          scopes:
    +            write:pets: modify pets in your account
    +            read:pets: read your pets
    +
    +

    Paths Object

    +

    Holds the relative paths to the individual endpoints and their operations. +The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.

    +
    Patterned Fields
    + + + + + + + + + + + + + + + +
    Field PatternTypeDescription
    /{path}Path Item ObjectA relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended (no relative URL resolution) to the expanded URL from the Server Object's url field in order to construct the full URL. Path templating is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it’s up to the tooling to decide which one to use.
    +

    This object MAY be extended with Specification Extensions.

    +
    Path Templating Matching
    +

    Assuming the following paths, the concrete definition, /pets/mine, will be matched first if used:

    +
    
    +  /pets/{petId}
    +  /pets/mine
    +
    +

    The following paths are considered identical and invalid:

    +
    
    +  /pets/{petId}
    +  /pets/{name}
    +
    +

    The following may lead to ambiguous resolution:

    +
    
    +  /{entity}/me
    +  /books/{id}
    +
    +
    Paths Object Example
    +
    
    +{
    +  "/pets": {
    +    "get": {
    +      "description": "Returns all pets from the system that the user has access to",
    +      "responses": {
    +        "200": {          
    +          "description": "A list of pets.",
    +          "content": {
    +            "application/json": {
    +              "schema": {
    +                "type": "array",
    +                "items": {
    +                  "$ref": "#/components/schemas/pet"
    +                }
    +              }
    +            }
    +          }
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    
    +/pets:
    +  get:
    +    description: Returns all pets from the system that the user has access to
    +    responses:
    +      '200':
    +        description: A list of pets.
    +        content:
    +          application/json:
    +            schema:
    +              type: array
    +              items:
    +                $ref: '#/components/schemas/pet'
    +
    +

    Path Item Object

    +

    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.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    $refstringAllows 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.
    summarystringAn optional, string summary, intended to apply to all operations in this path.
    descriptionstringAn optional, string description, intended to apply to all operations in this path. CommonMark syntax MAY be used for rich text representation.
    getOperation ObjectA definition of a GET operation on this path.
    putOperation ObjectA definition of a PUT operation on this path.
    postOperation ObjectA definition of a POST operation on this path.
    deleteOperation ObjectA definition of a DELETE operation on this path.
    optionsOperation ObjectA definition of a OPTIONS operation on this path.
    headOperation ObjectA definition of a HEAD operation on this path.
    patchOperation ObjectA definition of a PATCH operation on this path.
    traceOperation ObjectA definition of a TRACE operation on this path.
    servers[Server Object]An alternative server array to service all operations in this path.
    parameters[Parameter Object ¦ Reference Object]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 OpenAPI Object’s components/parameters.
    +

    This object MAY be extended with Specification Extensions.

    +
    Path Item Object Example
    +
    
    +{
    +  "get": {
    +    "description": "Returns pets based on ID",
    +    "summary": "Find pets by ID",
    +    "operationId": "getPetsById",
    +    "responses": {
    +      "200": {
    +        "description": "pet response",
    +        "content": {
    +          "*/*": {
    +            "schema": {
    +              "type": "array",
    +              "items": {
    +                "$ref": "#/components/schemas/Pet"
    +              }
    +            }
    +          }
    +        }
    +      },
    +      "default": {
    +        "description": "error payload",
    +        "content": {
    +          "text/html": {
    +            "schema": {
    +              "$ref": "#/components/schemas/ErrorModel"
    +            }
    +          }
    +        }
    +      }
    +    }
    +  },
    +  "parameters": [
    +    {
    +      "name": "id",
    +      "in": "path",
    +      "description": "ID of pet to use",
    +      "required": true,
    +      "schema": {
    +        "type": "array",
    +        "items": {
    +          "type": "string"
    +        }
    +      },
    +      "style": "simple"
    +    }
    +  ]
    +}
    +
    +
    
    +get:
    +  description: Returns pets based on ID
    +  summary: Find pets by ID
    +  operationId: getPetsById
    +  responses:
    +    '200':
    +      description: pet response
    +      content:
    +        '*/*' :
    +          schema:
    +            type: array
    +            items:
    +              $ref: '#/components/schemas/Pet'
    +    default:
    +      description: error payload
    +      content:
    +        'text/html':
    +          schema:
    +            $ref: '#/components/schemas/ErrorModel'
    +parameters:
    +- name: id
    +  in: path
    +  description: ID of pet to use
    +  required: true
    +  schema:
    +    type: array
    +    style: simple
    +    items:
    +      type: string  
    +
    +

    Operation Object

    +

    Describes a single API operation on a path.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    tags[string]A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
    summarystringA short summary of what the operation does.
    descriptionstringA verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation.
    externalDocsExternal Documentation ObjectAdditional external documentation for this operation.
    operationIdstringUnique 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[Parameter Object ¦ Reference Object]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 OpenAPI Object’s components/parameters.
    requestBodyRequest Body Object ¦ Reference ObjectThe request body applicable for this operation. The requestBody is only supported in HTTP methods where the HTTP 1.1 specification [[!rfc7231]]section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers.
    responsesResponses ObjectREQUIRED. The list of possible responses as they are returned from executing this operation.
    callbacksMap[string, Callback Object ¦ Reference Object]A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
    deprecatedbooleanDeclares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is false.
    security[Security Requirement Object]A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used.
    servers[Server Object]An alternative server array to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value.
    +

    This object MAY be extended with Specification Extensions.

    +
    Operation Object Example
    +
    
    +{
    +  "tags": [
    +    "pet"
    +  ],
    +  "summary": "Updates a pet in the store with form data",
    +  "operationId": "updatePetWithForm",
    +  "parameters": [
    +    {
    +      "name": "petId",
    +      "in": "path",
    +      "description": "ID of pet that needs to be updated",
    +      "required": true,
    +      "schema": {
    +        "type": "string"
    +      }
    +    }
    +  ],
    +  "requestBody": {
    +    "content": {
    +      "application/x-www-form-urlencoded": {
    +        "schema": {
    +          "type": "object",
    +           "properties": {
    +              "name": { 
    +                "description": "Updated name of the pet",
    +                "type": "string"
    +              },
    +              "status": {
    +                "description": "Updated status of the pet",
    +                "type": "string"
    +             }
    +           },
    +        "required": ["status"] 
    +        }
    +      }
    +    }
    +  },
    +  "responses": {
    +    "200": {
    +      "description": "Pet updated.",
    +      "content": {
    +        "application/json": {},
    +        "application/xml": {}
    +      }
    +    },
    +    "405": {
    +      "description": "Invalid input",
    +      "content": {
    +        "application/json": {},
    +        "application/xml": {}
    +      }
    +    }
    +  },
    +  "security": [
    +    {
    +      "petstore_auth": [
    +        "write:pets",
    +        "read:pets"
    +      ]
    +    }
    +  ]
    +}
    +
    +
    
    +tags:
    +- pet
    +summary: Updates a pet in the store with form data
    +operationId: updatePetWithForm
    +parameters:
    +- name: petId
    +  in: path
    +  description: ID of pet that needs to be updated
    +  required: true
    +  schema:
    +    type: string
    +requestBody:
    +  content:
    +    'application/x-www-form-urlencoded':
    +      schema:
    +       properties:
    +          name: 
    +            description: Updated name of the pet
    +            type: string
    +          status:
    +            description: Updated status of the pet
    +            type: string
    +       required:
    +         - status
    +responses:
    +  '200':
    +    description: Pet updated.
    +    content: 
    +      'application/json': {}
    +      'application/xml': {}
    +  '405':
    +    description: Invalid input
    +    content: 
    +      'application/json': {}
    +      'application/xml': {}
    +security:
    +- petstore_auth:
    +  - write:pets
    +  - read:pets
    +
    +

    External Documentation Object

    +

    Allows referencing an external resource for extended documentation.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    descriptionstringA short description of the target documentation. CommonMark syntax MAY be used for rich text representation.
    urlstringREQUIRED. The URL for the target documentation. Value MUST be in the format of a URL.
    +

    This object MAY be extended with Specification Extensions.

    +
    External Documentation Object Example
    +
    
    +{
    +  "description": "Find more info here",
    +  "url": "https://example.com"
    +}
    +
    +
    
    +description: Find more info here
    +url: https://example.com
    +
    +

    Parameter Object

    +

    Describes a single operation parameter.

    +

    A unique parameter is defined by a combination of a name and location.

    +
    Parameter Locations
    +

    There are four possible parameter locations specified by the in field:

    +
      +
    • path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId.
    • +
    • query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id.
    • +
    • header - Custom headers that are expected as part of the request. Note that [[!rfc7230]]page-22) states header names are case insensitive.
    • +
    • cookie - Used to pass a specific cookie value to the API.
    • +
    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    namestringREQUIRED. 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.
    • If in is "header" and the name field is "Accept", "Content-Type" or "Authorization", the parameter definition SHALL be ignored.
    • For all other cases, the name corresponds to the parameter name used by the in property.
    instringREQUIRED. The location of the parameter. Possible values are “query”, “header”, “path” or “cookie”.
    descriptionstringA brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
    requiredbooleanDetermines whether this parameter is mandatory. If the parameter location is “path”, this property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and its default value is false.
    deprecatedbooleanSpecifies that a parameter is deprecated and SHOULD be transitioned out of usage.
    allowEmptyValuebooleanSets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored.
    +

    The rules for serialization of the parameter are specified in one of two ways. +For simpler scenarios, a schema and style can describe the structure and syntax of the parameter.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    stylestringDescribes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form.
    explodebooleanWhen this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false.
    allowReservedbooleanDetermines whether the parameter value SHOULD allow reserved characters, as defined by [[!rfc3986]]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false.
    schemaSchema Object ¦ Reference ObjectThe schema defining the type used for the parameter.
    exampleAnyExample of the media type. The example SHOULD match the specified schema and encoding properties if present. The example field is mutually exclusive of the examples field. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.
    examplesMap[ string, Example Object ¦ Reference Object]Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The examples field is mutually exclusive of the example field. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema.
    +

    For more complex scenarios, the content property can define the media type and schema of the parameter. +A parameter MUST contain either a schema property, or a content property, but not both. +When example or examples are provided in conjunction with the schema object, the example MUST follow the prescribed serialization strategy for the parameter.

    + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    contentMap[string, Media Type Object]A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.
    +
    Style Values
    +

    In order to support common ways of serializing simple parameters, a set of style values are defined.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    styletypeinComments
    matrixprimitive, array, objectpathPath-style parameters defined by [[!rfc6570]]section-3.2.7)
    labelprimitive, array, objectpathLabel style parameters defined by [[!rfc6570]]section-3.2.5)
    formprimitive, array, objectquery, cookieForm style parameters defined by [[!rfc6570]]section-3.2.8). This option replaces collectionFormat with a csv (when explode is false) or multi (when explode is true) value from OpenAPI 2.0.
    simplearraypath, headerSimple style parameters defined by [[!rfc6570]]section-3.2.2). This option replaces collectionFormat with a csv value from OpenAPI 2.0.
    spaceDelimitedarrayquerySpace separated array values. This option replaces collectionFormat equal to ssv from OpenAPI 2.0.
    pipeDelimitedarrayqueryPipe separated array values. This option replaces collectionFormat equal to pipes from OpenAPI 2.0.
    deepObjectobjectqueryProvides a simple way of rendering nested objects using form parameters.
    +
    Style Examples
    +

    Assume a parameter named color has one of the following values:

    +
    
    +   string -> "blue"
    +   array -> ["blue","black","brown"]
    +   object -> { "R": 100, "G": 200, "B": 150 }
    +
    +

    The following table shows examples of rendering differences for each value.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    styleexplodeemptystringarrayobject
    matrixfalse;color;color=blue;color=blue,black,brown;color=R,100,G,200,B,150
    matrixtrue;color;color=blue;color=blue;color=black;color=brown;R=100;G=200;B=150
    labelfalse..blue.blue.black.brown.R.100.G.200.B.150
    labeltrue..blue.blue.black.brown.R=100.G=200.B=150
    formfalsecolor=color=bluecolor=blue,black,browncolor=R,100,G,200,B,150
    formtruecolor=color=bluecolor=blue&color=black&color=brownR=100&G=200&B=150
    simplefalsen/ablueblue,black,brownR,100,G,200,B,150
    simpletruen/ablueblue,black,brownR=100,G=200,B=150
    spaceDelimitedfalsen/an/ablue%20black%20brownR%20100%20G%20200%20B%20150
    pipeDelimitedfalsen/an/ablue¦black¦brownR¦100¦G¦200
    deepObjecttruen/an/an/acolor[R]=100&color[G]=200&color[B]=150
    +

    This object MAY be extended with Specification Extensions.

    +
    Parameter Object Examples
    +

    A header parameter with an array of 64 bit integer numbers:

    +
    
    +{
    +  "name": "token",
    +  "in": "header",
    +  "description": "token to be passed as a header",
    +  "required": true,
    +  "schema": {
    +    "type": "array",
    +    "items": {
    +      "type": "integer",
    +      "format": "int64"
    +    }
    +  },
    +  "style": "simple"
    +}
    +
    +
    
    +name: token
    +in: header
    +description: token to be passed as a header
    +required: true
    +schema:
    +  type: array
    +  items:
    +    type: integer
    +    format: int64
    +style: simple
    +
    +

    A path parameter of a string value:

    +
    
    +{
    +  "name": "username",
    +  "in": "path",
    +  "description": "username to fetch",
    +  "required": true,
    +  "schema": {
    +    "type": "string"
    +  }
    +}
    +
    +
    
    +name: username
    +in: path
    +description: username to fetch
    +required: true
    +schema:
    +  type: string
    +
    +

    An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

    +
    
    +{
    +  "name": "id",
    +  "in": "query",
    +  "description": "ID of the object to fetch",
    +  "required": false,
    +  "schema": {
    +    "type": "array",
    +    "items": {
    +      "type": "string"
    +    }
    +  },
    +  "style": "form",
    +  "explode": true
    +}
    +
    +
    
    +name: id
    +in: query
    +description: ID of the object to fetch
    +required: false
    +schema:
    +  type: array
    +  items:
    +    type: string
    +style: form
    +explode: true
    +
    +

    A free-form query parameter, allowing undefined parameters of a specific type:

    +
    
    +{
    +  "in": "query",
    +  "name": "freeForm",
    +  "schema": {
    +    "type": "object",
    +    "additionalProperties": {
    +      "type": "integer"
    +    },
    +  },
    +  "style": "form"
    +}
    +
    +
    
    +in: query
    +name: freeForm
    +schema:
    +  type: object
    +  additionalProperties:
    +    type: integer
    +style: form
    +
    +

    A complex parameter using content to define serialization:

    +
    
    +{
    +  "in": "query",
    +  "name": "coordinates",
    +  "content": {
    +    "application/json": {
    +      "schema": {
    +        "type": "object",
    +        "required": [
    +          "lat",
    +          "long"
    +        ],
    +        "properties": {
    +          "lat": {
    +            "type": "number"
    +          },
    +          "long": {
    +            "type": "number"
    +          }
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    
    +in: query
    +name: coordinates
    +content:
    +  application/json:
    +    schema:
    +      type: object
    +      required:
    +        - lat
    +        - long
    +      properties:
    +        lat:
    +          type: number
    +        long:
    +          type: number
    +
    +

    Request Body Object

    +

    Describes a single request body.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    descriptionstringA brief description of the request body. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
    contentMap[string, Media Type Object]REQUIRED. The content of the request body. The key is a media type or [media type range]appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
    requiredbooleanDetermines if the request body is required in the request. Defaults to false.
    +

    This object MAY be extended with Specification Extensions.

    +
    Request Body Examples
    +

    A request body with a referenced model definition.

    +
    
    +{
    +  "description": "user to add to the system",
    +  "content": {
    +    "application/json": {
    +      "schema": {
    +        "$ref": "#/components/schemas/User"
    +      },
    +      "examples": {
    +          "user" : {
    +            "summary": "User Example", 
    +            "externalValue": "http://foo.bar/examples/user-example.json"
    +          } 
    +        }
    +    },
    +    "application/xml": {
    +      "schema": {
    +        "$ref": "#/components/schemas/User"
    +      },
    +      "examples": {
    +          "user" : {
    +            "summary": "User example in XML",
    +            "externalValue": "http://foo.bar/examples/user-example.xml"
    +          }
    +        }
    +    },
    +    "text/plain": {
    +      "examples": {
    +        "user" : {
    +            "summary": "User example in Plain text",
    +            "externalValue": "http://foo.bar/examples/user-example.txt" 
    +        }
    +      } 
    +    },
    +    "*/*": {
    +      "examples": {
    +        "user" : {
    +            "summary": "User example in other format",
    +            "externalValue": "http://foo.bar/examples/user-example.whatever"
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    
    +description: user to add to the system
    +content: 
    +  'application/json':
    +    schema:
    +      $ref: '#/components/schemas/User'
    +    examples:
    +      user:
    +        summary: User Example
    +        externalValue: 'http://foo.bar/examples/user-example.json'
    +  'application/xml':
    +    schema:
    +      $ref: '#/components/schemas/User'
    +    examples:
    +      user:
    +        summary: User Example in XML
    +        externalValue: 'http://foo.bar/examples/user-example.xml'
    +  'text/plain':
    +    examples:
    +      user:
    +        summary: User example in text plain format
    +        externalValue: 'http://foo.bar/examples/user-example.txt'
    +  '*/*':
    +    examples:
    +      user: 
    +        summary: User example in other format
    +        externalValue: 'http://foo.bar/examples/user-example.whatever'
    +
    +

    A body parameter that is an array of string values:

    +
    
    +{
    +  "description": "user to add to the system",
    +  "content": {
    +    "text/plain": {
    +      "schema": {
    +        "type": "array",
    +        "items": {
    +          "type": "string"
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    
    +description: user to add to the system
    +required: true
    +content:
    +  text/plain:
    +    schema:
    +      type: array
    +      items:
    +        type: string
    +
    +

    Media Type Object

    +

    Each Media Type Object provides schema and examples for the media type identified by its key.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    schemaSchema Object ¦ Reference ObjectThe schema defining the type used for the request body.
    exampleAnyExample of the media type. The example object SHOULD be in the correct format as specified by the media type. The example field is mutually exclusive of the examples field. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema.
    examplesMap[ string, Example Object ¦ Reference Object]Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The examples field is mutually exclusive of the example field. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema.
    encodingMap[string, Encoding Object]A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded.
    +

    This object MAY be extended with Specification Extensions.

    +
    Media Type Examples
    +
    
    +{
    +  "application/json": {
    +    "schema": {
    +         "$ref": "#/components/schemas/Pet"
    +    },
    +    "examples": {
    +      "cat" : {
    +        "summary": "An example of a cat",
    +        "value": 
    +          {
    +            "name": "Fluffy",
    +            "petType": "Cat",
    +            "color": "White",
    +            "gender": "male",
    +            "breed": "Persian"
    +          }
    +      },
    +      "dog": {
    +        "summary": "An example of a dog with a cat's name",
    +        "value" :  { 
    +          "name": "Puma",
    +          "petType": "Dog",
    +          "color": "Black",
    +          "gender": "Female",
    +          "breed": "Mixed"
    +        },
    +      "frog": {
    +          "$ref": "#/components/examples/frog-example"
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    
    +application/json: 
    +  schema:
    +    $ref: "#/components/schemas/Pet"
    +  examples:
    +    cat:
    +      summary: An example of a cat
    +      value:
    +        name: Fluffy
    +        petType: Cat
    +        color: White
    +        gender: male
    +        breed: Persian
    +    dog:
    +      summary: An example of a dog with a cat's name
    +      value:
    +        name: Puma
    +        petType: Dog
    +        color: Black
    +        gender: Female
    +        breed: Mixed
    +    frog:
    +      $ref: "#/components/examples/frog-example"
    +
    +
    Considerations for File Uploads
    +

    In contrast with the 2.0 specification, file input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically:

    +
    
    +# content transferred with base64 encoding
    +schema:
    +  type: string
    +  format: base64
    +
    +
    
    +# content transferred in binary (octet-stream):
    +schema:
    +  type: string
    +  format: binary
    +
    +

    These examples apply to either input payloads of file uploads or response payloads.

    +

    A requestBody for submitting a file in a POST operation may look like the following example:

    +
    
    +requestBody:
    +  content:
    +    application/octet-stream:
    +      # any media type is accepted, functionally equivalent to `*/*`
    +      schema:
    +        # a binary file of any type
    +        type: string
    +        format: binary
    +
    +

    In addition, specific media types MAY be specified:

    +
    
    +# multiple, specific media types may be specified:
    +requestBody:
    +  content:
    +      # a binary file of type png or jpeg
    +    'image/jpeg':
    +      schema:
    +        type: string
    +        format: binary
    +    'image/png':
    +      schema:
    +        type: string
    +        format: binary        
    +
    +

    To upload multiple files, a multipart media type MUST be used:

    +
    
    +requestBody:
    +  content:
    +    multipart/form-data:
    +      schema:
    +        properties:
    +          # The property name 'file' will be used for all files.
    +          file:
    +            type: array
    +            items:
    +              type: string
    +              format: binary
    +
    +
    +
    Support for x-www-form-urlencoded Request Bodies
    +

    To submit content using form url encoding via [[!rfc1866]], the following +definition may be used:

    +
    
    +requestBody:
    +  content:
    +    application/x-www-form-urlencoded:
    +      schema:
    +        type: object
    +        properties:
    +          id:
    +            type: string
    +            format: uuid
    +          address:
    +            # complex types are stringified to support RFC 1866
    +            type: object
    +            properties: {}
    +
    +

    In this example, the contents in the requestBody MUST be stringified per [[!rfc1866]]) when passed to the server. In addition, the address field complex object will be stringified.

    +

    When passing complex objects in the application/x-www-form-urlencoded content type, the default serialization strategy of such properties is described in the Encoding Object's style property as form.

    +
    Special Considerations for multipart Content
    +

    It is common to use multipart/form-data as a Content-Type when transferring request bodies to operations. In contrast to 2.0, a schema is REQUIRED to define the input parameters to the operation when using multipart content. This supports complex structures as well as supporting mechanisms for multiple file uploads.

    +

    When passing in multipart types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default Content-Types are defined for multipart:

    +
      +
    • If the property is a primitive, or an array of primitive values, the default Content-Type is text/plain
    • +
    • If the property is complex, or an array of complex values, the default Content-Type is application/json
    • +
    • If the property is a type: string with format: binary or format: base64 (aka a file object), the default Content-Type is application/octet-stream
    • +
    +

    Examples:

    +
    
    +requestBody:
    +  content:
    +    multipart/form-data:
    +      schema:
    +        type: object
    +        properties:
    +          id:
    +            type: string
    +            format: uuid
    +          address:
    +            # default Content-Type for objects is `application/json`
    +            type: object
    +            properties: {}
    +          profileImage:
    +            # default Content-Type for string/binary is `application/octet-stream`
    +            type: string
    +            format: binary
    +          children:
    +            # default Content-Type for arrays is based on the `inner` type (text/plain here)
    +            type: array
    +            items:
    +              type: string
    +          addresses:
    +            # default Content-Type for arrays is based on the `inner` type (object shown, so `application/json` in this example)
    +            type: array
    +            items:
    +              type: '#/components/schemas/Address'
    +
    +

    An encoding attribute is introduced to give you control over the serialization of parts of multipart request bodies. This attribute is only applicable to multipart and application/x-www-form-urlencoded request bodies.

    +

    Encoding Object

    +

    A single encoding definition applied to a single schema property.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    contentTypestringThe Content-Type for encoding a specific property. Default value depends on the property type: for string with format being binaryapplication/octet-stream; for other primitive types – text/plain; for object - application/json; for array – the default is defined based on the inner type. The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types.
    headersMap[string, Header Object ¦ Reference Object]A map allowing additional information to be provided as headers, for example Content-Disposition. Content-Type is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a multipart.
    stylestringDescribes how a specific property value will be serialized depending on its type. See Parameter Object for details on the style property. The behavior follows the same values as query parameters, including default values. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
    explodebooleanWhen this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
    allowReservedbooleanDetermines whether the parameter value SHOULD allow reserved characters, as defined by [[!rfc3986]]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
    +

    This object MAY be extended with Specification Extensions.

    +
    Encoding Object Example
    +
    
    +requestBody:
    +  content:
    +    multipart/mixed:
    +      schema:
    +        type: object
    +        properties:
    +          id:
    +            # default is text/plain
    +            type: string
    +            format: uuid
    +          address:
    +            # default is application/json
    +            type: object
    +            properties: {}
    +          historyMetadata:
    +            # need to declare XML format!
    +            description: metadata in XML format
    +            type: object
    +            properties: {}
    +          profileImage:
    +            # default is application/octet-stream, need to declare an image type only!
    +            type: string
    +            format: binary
    +      encoding:
    +        historyMetadata:
    +          # require XML Content-Type in utf-8 encoding
    +          contentType: application/xml; charset=utf-8
    +        profileImage:
    +          # only accept png/jpeg
    +          contentType: image/png, image/jpeg
    +          headers:
    +            X-Rate-Limit-Limit:
    +              description: The number of allowed requests in the current period
    +              schema:
    +                type: integer
    +
    +

    Responses Object

    +

    A container for the expected responses of an operation. +The container maps a HTTP response code to the expected response.

    +

    The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. +However, documentation is expected to cover a successful operation response and any known errors.

    +

    The default MAY be used as a default response object for all HTTP codes +that are not covered individually by the specification.

    +

    The Responses Object MUST contain at least one response code, and it +SHOULD be the response for a successful operation call.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    defaultResponse Object ¦ Reference ObjectThe documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. A Reference Object can link to a response that the OpenAPI Object’s components/responses section defines.
    +
    Patterned Fields
    + + + + + + + + + + + + + + + +
    Field PatternTypeDescription
    HTTP Status CodeResponse Object ¦ Reference ObjectAny HTTP status code can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A Reference Object can link to a response that is defined in the OpenAPI Object’s components/responses section. This field MUST be enclosed in quotation marks (for example, “200”) for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character X. For example, 2XX represents all response codes between [200-299]. The following range definitions are allowed: 1XX, 2XX, 3XX, 4XX, and 5XX. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code.
    +

    This object MAY be extended with Specification Extensions.

    +
    Responses Object Example
    +

    A 200 response for a successful operation and a default response for others (implying an error):

    +
    
    +{
    +  "200": {
    +    "description": "a pet to be returned",
    +    "content": {
    +      "application/json": {
    +        "schema": {
    +          "$ref": "#/components/schemas/Pet"
    +        }
    +      }
    +    }
    +  },
    +  "default": {
    +    "description": "Unexpected error",
    +    "content": {
    +      "application/json": {
    +        "schema": {
    +          "$ref": "#/components/schemas/ErrorModel"
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    
    +'200':
    +  description: a pet to be returned
    +  content: 
    +    application/json:
    +      schema:
    +        $ref: '#/components/schemas/Pet'
    +default:
    +  description: Unexpected error
    +  content:
    +    application/json:
    +      schema:
    +        $ref: '#/components/schemas/ErrorModel'
    +
    +

    Response Object

    +

    Describes a single response from an API Operation, including design-time, static +links to operations based on the response.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    descriptionstringREQUIRED. A short description of the response. CommonMark syntax MAY be used for rich text representation.
    headersMap[string, Header Object ¦ Reference Object]Maps a header name to its definition. [[!rfc7230]]page-22) states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored.
    contentMap[string, Media Type Object]A map containing descriptions of potential response payloads. The key is a media type or [media type range]appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
    linksMap[string, Link Object ¦ Reference Object]A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for Component Objects.
    +

    This object MAY be extended with Specification Extensions.

    +
    Response Object Examples
    +

    Response of an array of a complex type:

    +
    
    +{
    +  "description": "A complex object array response",
    +  "content": {
    +    "application/json": {
    +      "schema": {
    +        "type": "array",
    +        "items": {
    +          "$ref": "#/components/schemas/VeryComplexType"
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    
    +description: A complex object array response
    +content: 
    +  application/json:
    +    schema: 
    +      type: array
    +      items:
    +        $ref: '#/components/schemas/VeryComplexType'
    +
    +

    Response with a string type:

    +
    
    +{
    +  "description": "A simple string response",
    +  "content": {
    +    "text/plain": {
    +      "schema": {
    +        "type": "string"
    +      }
    +    }
    +  }
    +
    +}
    +
    +
    
    +description: A simple string response
    +content:
    +  text/plain:
    +    schema:
    +      type: string
    +
    +

    Plain text response with headers:

    +
    
    +{
    +  "description": "A simple string response",
    +  "content": {
    +    "text/plain": {
    +      "schema": {
    +        "type": "string"
    +      }
    +    }
    +  },
    +  "headers": {
    +    "X-Rate-Limit-Limit": {
    +      "description": "The number of allowed requests in the current period",
    +      "schema": {
    +        "type": "integer"
    +      }
    +    },
    +    "X-Rate-Limit-Remaining": {
    +      "description": "The number of remaining requests in the current period",
    +      "schema": {
    +        "type": "integer"
    +      }
    +    },
    +    "X-Rate-Limit-Reset": {
    +      "description": "The number of seconds left in the current period",
    +      "schema": {
    +        "type": "integer"
    +      }
    +    }
    +  }
    +}
    +
    +
    
    +description: A simple string response
    +content:
    +  text/plain:
    +    schema:
    +      type: string
    +    example: 'whoa!'
    +headers:
    +  X-Rate-Limit-Limit:
    +    description: The number of allowed requests in the current period
    +    schema:
    +      type: integer
    +  X-Rate-Limit-Remaining:
    +    description: The number of remaining requests in the current period
    +    schema:
    +      type: integer
    +  X-Rate-Limit-Reset:
    +    description: The number of seconds left in the current period
    +    schema:
    +      type: integer
    +
    +

    Response with no return value:

    +
    
    +{
    +  "description": "object created"
    +}
    +
    +
    
    +description: object created
    +
    +

    Callback Object

    +

    A map of possible out-of band callbacks related to the parent operation. +Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. +The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

    +
    Patterned Fields
    + + + + + + + + + + + + + + + +
    Field PatternTypeDescription
    {expression}Path Item ObjectA Path Item Object used to define a callback request and expected responses. A complete example is available.
    +

    This object MAY be extended with Specification Extensions.

    +
    Key Expression
    +

    The key that identifies the Path Item Object is a runtime expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. +A simple example might be $request.body#/url. +However, using a runtime expression the complete HTTP message can be accessed. +This includes accessing any part of a body that a JSON Pointer [[!rfc6901]] can reference.

    +

    For example, given the following HTTP request:

    +
    
    +POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1
    +Host: example.org
    +Content-Type: application/json
    +Content-Length: 187
    +
    +{
    +  "failedUrl" : "http://clientdomain.com/failed",
    +  "successUrls" : [
    +    "http://clientdomain.com/fast",
    +    "http://clientdomain.com/medium",
    +    "http://clientdomain.com/slow"
    +  ] 
    +}
    +
    +201 Created
    +Location: http://example.org/subscription/1
    +
    +

    The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named eventType and a query parameter named queryUrl.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ExpressionValue
    $urlhttp://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning
    $methodPOST
    $request.path.eventTypemyevent
    $request.query.queryUrlhttp://clientdomain.com/stillrunning
    $request.header.content-Typeapplication/json
    $request.body#/failedUrlhttp://clientdomain.com/stillrunning
    $request.body#/successUrls/2http://clientdomain.com/medium
    $response.header.Locationhttp://example.org/subscription/1
    +
    Callback Object Example
    +

    The following example shows a callback to the URL specified by the id and email property in the request body.

    +
    
    +myWebhook:
    +  'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
    +    post:
    +      requestBody:
    +        description: Callback payload
    +        content: 
    +          'application/json':
    +            schema:
    +              $ref: '#/components/schemas/SomePayload'
    +      responses:
    +        '200':
    +          description: webhook successfully processed and no retries will be performed
    +
    +

    Example Object

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    summarystringShort description for the example.
    descriptionstringLong description for the example. CommonMark syntax MAY be used for rich text representation.
    valueAnyEmbedded literal example. The value field and externalValue field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary.
    externalValuestringA URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The value field and externalValue field are mutually exclusive.
    +

    This object MAY be extended with Specification Extensions.

    +

    In all cases, the example value is expected to be compatible with the type schema +of its associated value. Tooling implementations MAY choose to +validate compatibility automatically, and reject the example value(s) if incompatible.

    +
    Example Object Example
    +
    
    +# in a model
    +schemas:
    +  properties:
    +    name:
    +      type: string
    +      examples:
    +        name:
    +          $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example
    +
    +# in a request body:
    +  requestBody:
    +    content:
    +      'application/json':
    +        schema:
    +          $ref: '#/components/schemas/Address'
    +        examples: 
    +          foo:
    +            summary: A foo example
    +            value: {"foo": "bar"}
    +          bar:
    +            summary: A bar example
    +            value: {"bar": "baz"}
    +      'application/xml':
    +        examples: 
    +          xmlExample:
    +            summary: This is an example in XML
    +            externalValue: 'http://example.org/examples/address-example.xml'
    +      'text/plain':
    +        examples:
    +          textExample: 
    +            summary: This is a text example
    +            externalValue: 'http://foo.bar/examples/address-example.txt' 
    +
    +
    +# in a parameter
    +  parameters:
    +    - name: 'zipCode'
    +      in: 'query'
    +      schema:
    +        type: 'string'
    +        format: 'zip-code'
    +        examples:
    +          zip-example: 
    +            $ref: '#/components/examples/zip-example'
    +
    +# in a response
    +  responses:
    +    '200':
    +      description: your car appointment has been booked
    +      content: 
    +        application/json:
    +          schema:
    +            $ref: '#/components/schemas/SuccessResponse'
    +          examples:
    +            confirmation-success:
    +              $ref: '#/components/examples/confirmation-success'
    +
    +

    Link Object

    +

    The Link object represents a possible design-time link for a response. +The presence of a link does not guarantee the caller’s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.

    +

    Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.

    +

    For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    operationRefstringA relative or absolute reference to an OAS operation. This field is mutually exclusive of the operationId field, and MUST point to an Operation Object. Relative operationRef values MAY be used to locate an existing Operation Object in the OpenAPI definition.
    operationIdstringThe name of an existing, resolvable OAS operation, as defined with a unique operationId. This field is mutually exclusive of the operationRef field.
    parametersMap[string, Any ¦ {expression}]A map representing parameters to pass to an operation as specified with operationId or identified via operationRef. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id).
    requestBodyAny ¦ {expression}A literal value or {expression} to use as a request body when calling the target operation.
    descriptionstringA description of the link. CommonMark syntax MAY be used for rich text representation.
    serverServer ObjectA server object to be used by the target operation.
    +

    This object MAY be extended with Specification Extensions.

    +

    A linked operation MUST be identified using either an operationRef or operationId. +In the case of an operationId, it MUST be unique and resolved in the scope of the OAS document. +Because of the potential for name clashes, the operationRef syntax is preferred +for specifications with external references.

    +
    Examples
    +

    Computing a link from a request operation where the $request.path.id is used to pass a request parameter to the linked operation.

    +
    
    +paths:
    +  /users/{id}:
    +    parameters:
    +    - name: id
    +      in: path
    +      required: true
    +      description: the user identifier, as userId 
    +      schema:
    +        type: string
    +    get:
    +      responses:
    +        '200':
    +          description: the user being returned
    +          content:
    +            application/json:
    +              schema:
    +                type: object
    +                properties:
    +                  uuid: # the unique user id
    +                    type: string
    +                    format: uuid
    +          links:
    +            address:
    +              # the target link operationId
    +              operationId: getUserAddress
    +              parameters:
    +                # get the `id` field from the request path parameter named `id`
    +                userId: $request.path.id
    +  # the path item of the linked operation
    +  /users/{userid}/address:
    +    parameters:
    +    - name: userid
    +      in: path
    +      required: true
    +      description: the user identifier, as userId 
    +      schema:
    +        type: string
    +    # linked operation
    +    get:
    +      operationId: getUserAddress
    +      responses:
    +        '200':
    +          description: the user's address
    +
    +

    When a runtime expression fails to evaluate, no parameter value is passed to the target operation.

    +

    Values from the response body can be used to drive a linked operation.

    +
    
    +links:
    +  address:
    +    operationId: getUserAddressByUUID
    +    parameters:
    +      # get the `uuid` field from the `uuid` field in the response body
    +      userUuid: $response.body#/uuid
    +
    +

    Clients follow all links at their discretion. +Neither permissions, nor the capability to make a successful call to that link, is guaranteed +solely by the existence of a relationship.

    +
    OperationRef Examples
    +

    As references to operationId MAY NOT be possible (the operationId is an optional +value), references MAY also be made through a relative operationRef:

    +
    
    +links:
    +  UserRepositories:
    +    # returns array of '#/components/schemas/repository'
    +    operationRef: '#/paths/~12.0~1repositories~1{username}/get'
    +    parameters:
    +      username: $response.body#/username
    +
    +

    or an absolute operationRef:

    +
    
    +links:
    +  UserRepositories:
    +    # returns array of '#/components/schemas/repository'
    +    operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get'
    +    parameters:
    +      username: $response.body#/username
    +
    +

    Note that in the use of operationRef, the escaped forward-slash is necessary when +using JSON references.

    +
    Runtime Expressions
    +

    Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. +This mechanism is used by Link Objects and Callback Objects.

    +

    The runtime expression is defined by the following [Augmented Backus-Naur Form] syntax

    +
    
    +      expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source )
    +      source = ( header-reference | query-reference | path-reference | body-reference )  
    +      header-reference = "header." token
    +      query-reference = "query." name  
    +      path-reference = "path." name
    +      body-reference = "body" ["#" fragment]
    +      fragment = a JSON Pointer [[!rfc6901]]  
    +      name = *( char )
    +      char = as per RFC [7159]section-7)
    +      token = as per RFC [7230]section-3.2.6)
    +
    +

    The name identifier is case-sensitive, whereas token is not.

    +

    The table below provides examples of runtime expressions and examples of their use in a value:

    +
    Examples
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Source Locationexample expressionnotes
    HTTP Method$methodThe allowable values for the $method will be those for the HTTP operation.
    Requested media type$request.header.accept
    Request parameter$request.path.idRequest parameters MUST be declared in the parameters section of the parent operation or they cannot be evaluated. This includes request headers.
    Request body property$request.body#/user/uuidIn operations which accept payloads, references may be made to portions of the requestBody or the entire body.
    Request URL$url
    Response value$response.body#/statusIn operations which return payloads, references may be made to portions of the response body or the entire body.
    Response header$response.header.ServerSingle header values only are available
    +

    Runtime expressions preserve the type of the referenced value. +Expressions can be embedded into string values by surrounding the expression with {} curly braces.

    +

    Header Object

    +

    The Header Object follows the structure of the Parameter Object with the following changes:

    +
      +
    1. name MUST NOT be specified, it is given in the corresponding headers map.
    2. +
    3. in MUST NOT be specified, it is implicitly in header.
    4. +
    5. All traits that are affected by the location MUST be applicable to a location of header (for example, style).
    6. +
    +
    Header Object Example
    +

    A simple header of type integer:

    +
    
    +{
    +  "description": "The number of allowed requests in the current period",
    +  "schema": {
    +    "type": "integer"
    +  }
    +}
    +
    +
    
    +description: The number of allowed requests in the current period
    +schema:
    +  type: integer
    +
    +

    Tag Object

    +

    Adds metadata to a single tag that is used by the Operation Object. +It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    namestringREQUIRED. The name of the tag.
    descriptionstringA short description for the tag. CommonMark syntax MAY be used for rich text representation.
    externalDocsExternal Documentation ObjectAdditional external documentation for this tag.
    +

    This object MAY be extended with Specification Extensions.

    +
    Tag Object Example
    +
    
    +{
    +	"name": "pet",
    +	"description": "Pets operations"
    +}
    +
    +
    
    +name: pet
    +description: Pets operations
    +
    +

    Reference Object

    +

    A simple object to allow referencing other components in the specification, internally and externally.

    +

    The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.

    +

    For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    $refstringREQUIRED. The reference string.
    +

    This object cannot be extended with additional properties and any properties added SHALL be ignored.

    +
    Reference Object Example
    +
    
    +{
    +	"$ref": "#/components/schemas/Pet"
    +}
    +
    +
    
    +$ref: '#/components/schemas/Pet'
    +
    +
    Relative Schema Document Example
    +
    
    +{
    +  "$ref": "Pet.json"
    +}
    +
    +
    
    +$ref: Pet.yaml
    +
    +
    Relative Documents With Embedded Schema Example
    +
    
    +{
    +  "$ref": "definitions.json#/Pet"
    +}
    +
    +
    
    +$ref: definitions.yaml#/Pet
    +
    +

    Schema Object

    +

    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 an extended subset of the JSON Schema Specification Wright Draft 00.

    +

    For more information about the properties, see JSON Schema Core and JSON Schema Validation. +Unless stated otherwise, the property definitions follow the JSON Schema.

    +
    Properties
    +

    The following properties are taken directly from the JSON Schema definition and follow the same specifications:

    +
      +
    • title
    • +
    • multipleOf
    • +
    • maximum
    • +
    • exclusiveMaximum
    • +
    • minimum
    • +
    • exclusiveMinimum
    • +
    • maxLength
    • +
    • minLength
    • +
    • pattern (This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect)
    • +
    • maxItems
    • +
    • minItems
    • +
    • uniqueItems
    • +
    • maxProperties
    • +
    • minProperties
    • +
    • required
    • +
    • enum
    • +
    +

    The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification.

    +
      +
    • type - Value MUST be a string. Multiple types via an array are not supported.
    • +
    • allOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • +
    • oneOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • +
    • anyOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • +
    • not - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • +
    • items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. items MUST be present if the type is array.
    • +
    • properties - Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced).
    • +
    • additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • +
    • description - CommonMark syntax MAY be used for rich text representation.
    • +
    • format - See Data Type Formats for further details. While relying on JSON Schema’s defined formats, the OAS offers a few additional predefined formats.
    • +
    • default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if type is string, then default can be "foo" but cannot be 1.
    • +
    +

    Alternatively, any time a Schema Object can be used, a Reference Object can be used in its place. This allows referencing definitions instead of defining them inline.

    +

    Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported.

    +

    Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation:

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    nullablebooleanAllows sending a null value for the defined schema. Default value is false.
    discriminatorDiscriminator ObjectAdds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See Composition and Inheritance for more details.
    readOnlybooleanRelevant only for Schema "properties" definitions. Declares the property as “read only”. This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.
    writeOnlybooleanRelevant only for Schema "properties" definitions. Declares the property as “write only”. Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as writeOnly being true and is in the required list, the required will take effect on the request only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.
    xmlXML ObjectThis MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property.
    externalDocsExternal Documentation ObjectAdditional external documentation for this schema.
    exampleAnyA free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary.
    deprecatedbooleanSpecifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false.
    +

    This object MAY be extended with Specification Extensions.

    +
    Composition and Inheritance (Polymorphism)
    +

    The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. +allOf takes an array of object definitions that are validated independently but together compose a single object.

    +

    While composition offers model extensibility, it does not imply a hierarchy between the models. +To support polymorphism, the OpenAPI Specification adds the discriminator field. +When used, the discriminator will be the name of the property that decides which schema definition validates the structure of the model. +As such, the discriminator field MUST be a required field. +There are two ways to define the value of a discriminator for an inheriting instance.

    +
      +
    • Use the schema name.
    • +
    • Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name. +As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism.
    • +
    +
    XML Modeling
    +

    The xml property allows extra definitions when translating the JSON definition to XML. +The XML Object contains additional information about the available options.

    +
    Schema Object Examples
    +
    Primitive Sample
    +
    
    +{
    +  "type": "string",
    +  "format": "email"
    +}
    +
    +
    
    +type: string
    +format: email
    +
    +
    Simple Model
    +
    
    +{
    +  "type": "object",
    +  "required": [
    +    "name"
    +  ],
    +  "properties": {
    +    "name": {
    +      "type": "string"
    +    },
    +    "address": {
    +      "$ref": "#/components/schemas/Address"
    +    },
    +    "age": {
    +      "type": "integer",
    +      "format": "int32",
    +      "minimum": 0
    +    }
    +  }
    +}
    +
    +
    
    +type: object
    +required:
    +- name
    +properties:
    +  name:
    +    type: string
    +  address:
    +    $ref: '#/components/schemas/Address'
    +  age:
    +    type: integer
    +    format: int32
    +    minimum: 0
    +
    +
    Model with Map/Dictionary Properties
    +

    For a simple string to string mapping:

    +
    
    +{
    +  "type": "object",
    +  "additionalProperties": {
    +    "type": "string"
    +  }
    +}
    +
    +
    
    +type: object
    +additionalProperties:
    +  type: string
    +
    +

    For a string to model mapping:

    +
    
    +{
    +  "type": "object",
    +  "additionalProperties": {
    +    "$ref": "#/components/schemas/ComplexModel"
    +  }
    +}
    +
    +
    
    +type: object
    +additionalProperties:
    +  $ref: '#/components/schemas/ComplexModel'
    +
    +
    Model with Example
    +
    
    +{
    +  "type": "object",
    +  "properties": {
    +    "id": {
    +      "type": "integer",
    +      "format": "int64"
    +    },
    +    "name": {
    +      "type": "string"
    +    }
    +  },
    +  "required": [
    +    "name"
    +  ],
    +  "example": {
    +    "name": "Puma",
    +    "id": 1
    +  }
    +}
    +
    +
    
    +type: object
    +properties:
    +  id:
    +    type: integer
    +    format: int64
    +  name:
    +    type: string
    +required:
    +- name
    +example:
    +  name: Puma
    +  id: 1
    +
    +
    Models with Composition
    +
    
    +{
    +  "components": {
    +    "schemas": {
    +      "ErrorModel": {
    +        "type": "object",
    +        "required": [
    +          "message",
    +          "code"
    +        ],
    +        "properties": {
    +          "message": {
    +            "type": "string"
    +          },
    +          "code": {
    +            "type": "integer",
    +            "minimum": 100,
    +            "maximum": 600
    +          }
    +        }
    +      },
    +      "ExtendedErrorModel": {
    +        "allOf": [
    +          {
    +            "$ref": "#/components/schemas/ErrorModel"
    +          },
    +          {
    +            "type": "object",
    +            "required": [
    +              "rootCause"
    +            ],
    +            "properties": {
    +              "rootCause": {
    +                "type": "string"
    +              }
    +            }
    +          }
    +        ]
    +      }
    +    }
    +  }
    +}
    +
    +
    
    +components:
    +  schemas:
    +    ErrorModel:
    +      type: object
    +      required:
    +      - message
    +      - code
    +      properties:
    +        message:
    +          type: string
    +        code:
    +          type: integer
    +          minimum: 100
    +          maximum: 600
    +    ExtendedErrorModel:
    +      allOf:
    +      - $ref: '#/components/schemas/ErrorModel'
    +      - type: object
    +        required:
    +        - rootCause
    +        properties:
    +          rootCause:
    +            type: string
    +
    +
    Models with Polymorphism Support
    +
    
    +{
    +  "components": {
    +    "schemas": {
    +      "Pet": {
    +        "type": "object",
    +        "discriminator": {
    +          "propertyName": "petType"
    +        },
    +        "properties": {
    +          "name": {
    +            "type": "string"
    +          },
    +          "petType": {
    +            "type": "string"
    +          }
    +        },
    +        "required": [
    +          "name",
    +          "petType"
    +        ]
    +      },
    +      "Cat": {
    +        "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.",
    +        "allOf": [
    +          {
    +            "$ref": "#/components/schemas/Pet"
    +          },
    +          {
    +            "type": "object",
    +            "properties": {
    +              "huntingSkill": {
    +                "type": "string",
    +                "description": "The measured skill for hunting",
    +                "default": "lazy",
    +                "enum": [
    +                  "clueless",
    +                  "lazy",
    +                  "adventurous",
    +                  "aggressive"
    +                ]
    +              }
    +            },
    +            "required": [
    +              "huntingSkill"
    +            ]
    +          }
    +        ]
    +      },
    +      "Dog": {
    +        "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.",
    +        "allOf": [
    +          {
    +            "$ref": "#/components/schemas/Pet"
    +          },
    +          {
    +            "type": "object",
    +            "properties": {
    +              "packSize": {
    +                "type": "integer",
    +                "format": "int32",
    +                "description": "the size of the pack the dog is from",
    +                "default": 0,
    +                "minimum": 0
    +              }
    +            },
    +            "required": [
    +              "packSize"
    +            ]
    +          }
    +        ]
    +      }
    +    }
    +  }
    +}
    +
    +
    
    +components:
    +  schemas:
    +    Pet:
    +      type: object
    +      discriminator:
    +        propertyName: petType
    +      properties:
    +        name:
    +          type: string
    +        petType:
    +          type: string
    +      required:
    +      - name
    +      - petType
    +    Cat:  ## "Cat" will be used as the discriminator value
    +      description: A representation of a cat
    +      allOf:
    +      - $ref: '#/components/schemas/Pet'
    +      - type: object
    +        properties:
    +          huntingSkill:
    +            type: string
    +            description: The measured skill for hunting
    +            enum:
    +            - clueless
    +            - lazy
    +            - adventurous
    +            - aggressive
    +        required:
    +        - huntingSkill
    +    Dog:  ## "Dog" will be used as the discriminator value
    +      description: A representation of a dog
    +      allOf:
    +      - $ref: '#/components/schemas/Pet'
    +      - type: object
    +        properties:
    +          packSize:
    +            type: integer
    +            format: int32
    +            description: the size of the pack the dog is from
    +            default: 0
    +            minimum: 0
    +        required:
    +        - packSize
    +
    +

    Discriminator Object

    +

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    +

    When using the discriminator, inline schemas will not be considered.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    propertyNamestringREQUIRED. The name of the property in the payload that will hold the discriminator value.
    mappingMap[string, string]An object to hold mappings between payload values and schema names or references.
    +

    The discriminator attribute is legal only when using one of the composite keywords oneOf, anyOf, allOf.

    +

    In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:

    +
    
    +MyResponseType:
    +  oneOf:
    +  - $ref: '#/components/schemas/Cat'
    +  - $ref: '#/components/schemas/Dog'
    +  - $ref: '#/components/schemas/Lizard'
    +
    +

    which means the payload MUST, by validation, match exactly one of the schemas described by Cat, Dog, or Lizard. In this case, a discriminator MAY act as a “hint” to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use:

    +
    
    +MyResponseType:
    +  oneOf:
    +  - $ref: '#/components/schemas/Cat'
    +  - $ref: '#/components/schemas/Dog'
    +  - $ref: '#/components/schemas/Lizard'
    +  discriminator:
    +    propertyName: pet_type
    +
    +

    The expectation now is that a property with name pet_type MUST be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload:

    +
    
    +{
    +  "id": 12345,
    +  "pet_type": "Cat"
    +}
    +
    +

    Will indicate that the Cat schema be used in conjunction with this payload.

    +

    In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional mapping definition MAY be used:

    +
    
    +MyResponseType:
    +  oneOf:
    +  - $ref: '#/components/schemas/Cat'
    +  - $ref: '#/components/schemas/Dog'
    +  - $ref: '#/components/schemas/Lizard'
    +  - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json'
    +  discriminator:
    +    propertyName: pet_type
    +    mapping:
    +      dog: '#/components/schemas/Dog'
    +      monster: 'https://gigantic-server.com/schemas/Monster/schema.json'
    +
    +

    Here the discriminator value of dog will map to the schema #/components/schemas/Dog, rather than the default (implicit) value of Dog. If the discriminator value does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison.

    +

    When used in conjunction with the anyOf construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload.

    +

    In both the oneOf and anyOf use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an allOf construct may be used as an alternate schema.

    +

    For example:

    +
    
    +components:
    +  schemas:
    +    Pet:
    +      type: object
    +      required:
    +      - pet_type
    +      properties:
    +        pet_type:
    +          type: string
    +      discriminator:
    +        propertyName: pet_type
    +        mapping:
    +          cachorro: Dog
    +    Cat:
    +      allOf:
    +      - $ref: '#/components/schemas/Pet'
    +      - type: object
    +        # all other properties specific to a `Cat`
    +        properties:
    +          name:
    +            type: string
    +    Dog:
    +      allOf:
    +      - $ref: '#/components/schemas/Pet'
    +      - type: object
    +        # all other properties specific to a `Dog`
    +        properties:
    +          bark:
    +            type: string
    +    Lizard:
    +      allOf:
    +      - $ref: '#/components/schemas/Pet'
    +      - type: object
    +        # all other properties specific to a `Lizard`
    +        properties:
    +          lovesRocks:
    +            type: boolean
    +
    +

    a payload like this:

    +
    
    +{
    +  "pet_type": "Cat",
    +  "name": "misty"
    +}
    +
    +

    will indicate that the Cat schema be used. Likewise this schema:

    +
    
    +{
    +  "pet_type": "cachorro",
    +  "bark": "soft"
    +}
    +
    +

    will map to Dog because of the definition in the mappings element.

    +

    XML Object

    +

    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.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    namestringReplaces the name of the element/attribute used for the described schema property. When defined within 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.
    namespacestringThe URI of the namespace definition. Value MUST be in the form of an absolute URI.
    prefixstringThe prefix to be used for the name.
    attributebooleanDeclares whether the property definition translates to an attribute instead of an element. Default value is false.
    wrappedbooleanMAY 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).
    +

    This object MAY be extended with Specification Extensions.

    +
    XML Object Examples
    +

    The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

    +
    No XML Element
    +

    Basic string property:

    +
    
    +{
    +    "animals": {
    +        "type": "string"
    +    }
    +}
    +
    +
    
    +animals:
    +  type: string
    +
    +
    
    +<animals>...</animals>
    +
    +

    Basic string array property (wrapped is false by default):

    +
    
    +{
    +    "animals": {
    +        "type": "array",
    +        "items": {
    +            "type": "string"
    +        }
    +    }
    +}
    +
    +
    
    +animals:
    +  type: array
    +  items:
    +    type: string
    +
    +
    
    +<animals>...</animals>
    +<animals>...</animals>
    +<animals>...</animals>
    +
    +
    XML Name Replacement
    +
    
    +{
    +  "animals": {
    +    "type": "string",
    +    "xml": {
    +      "name": "animal"
    +    }
    +  }
    +}
    +
    +
    
    +animals:
    +  type: string
    +  xml:
    +    name: animal
    +
    +
    
    +<animal>...</animal>
    +
    +
    XML Attribute, Prefix and Namespace
    +

    In this example, a full model definition is shown.

    +
    
    +{
    +  "Person": {
    +    "type": "object",
    +    "properties": {
    +      "id": {
    +        "type": "integer",
    +        "format": "int32",
    +        "xml": {
    +          "attribute": true
    +        }
    +      },
    +      "name": {
    +        "type": "string",
    +        "xml": {
    +          "namespace": "http://example.com/schema/sample",
    +          "prefix": "sample"
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +
    
    +Person:
    +  type: object
    +  properties:
    +    id:
    +      type: integer
    +      format: int32
    +      xml:
    +        attribute: true
    +    name:
    +      type: string
    +      xml:
    +        namespace: http://example.com/schema/sample
    +        prefix: sample
    +
    +
    
    +<Person id="123">
    +    <sample:name xmlns:sample="http://example.com/schema/sample">example</sample:name>
    +</Person>
    +
    +
    XML Arrays
    +

    Changing the element names:

    +
    
    +{
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string",
    +      "xml": {
    +        "name": "animal"
    +      }
    +    }
    +  }
    +}
    +
    +
    
    +animals:
    +  type: array
    +  items:
    +    type: string
    +    xml:
    +      name: animal
    +
    +
    
    +<animal>value</animal>
    +<animal>value</animal>
    +
    +

    The external name property has no effect on the XML:

    +
    
    +{
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string",
    +      "xml": {
    +        "name": "animal"
    +      }
    +    },
    +    "xml": {
    +      "name": "aliens"
    +    }
    +  }
    +}
    +
    +
    
    +animals:
    +  type: array
    +  items:
    +    type: string
    +    xml:
    +      name: animal
    +  xml:
    +    name: aliens
    +
    +
    
    +<animal>value</animal>
    +<animal>value</animal>
    +
    +

    Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally:

    +
    
    +{
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string"
    +    },
    +    "xml": {
    +      "wrapped": true
    +    }
    +  }
    +}
    +
    +
    
    +animals:
    +  type: array
    +  items:
    +    type: string
    +  xml:
    +    wrapped: true
    +
    +
    
    +<animals>
    +  <animals>value</animals>
    +  <animals>value</animals>
    +</animals>
    +
    +

    To overcome the naming problem in the example above, the following definition can be used:

    +
    
    +{
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string",
    +      "xml": {
    +        "name": "animal"
    +      }
    +    },
    +    "xml": {
    +      "wrapped": true
    +    }
    +  }
    +}
    +
    +
    
    +animals:
    +  type: array
    +  items:
    +    type: string
    +    xml:
    +      name: animal
    +  xml:
    +    wrapped: true
    +
    +
    
    +<animals>
    +  <animal>value</animal>
    +  <animal>value</animal>
    +</animals>
    +
    +

    Affecting both internal and external names:

    +
    
    +{
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string",
    +      "xml": {
    +        "name": "animal"
    +      }
    +    },
    +    "xml": {
    +      "name": "aliens",
    +      "wrapped": true
    +    }
    +  }
    +}
    +
    +
    
    +animals:
    +  type: array
    +  items:
    +    type: string
    +    xml:
    +      name: animal
    +  xml:
    +    name: aliens
    +    wrapped: true
    +
    +
    
    +<aliens>
    +  <animal>value</animal>
    +  <animal>value</animal>
    +</aliens>
    +
    +

    If we change the external element but not the internal ones:

    +
    
    +{
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string"
    +    },
    +    "xml": {
    +      "name": "aliens",
    +      "wrapped": true
    +    }
    +  }
    +}
    +
    +
    
    +animals:
    +  type: array
    +  items:
    +    type: string
    +  xml:
    +    name: aliens
    +    wrapped: true
    +
    +
    
    +<aliens>
    +  <aliens>value</aliens>
    +  <aliens>value</aliens>
    +</aliens>
    +
    +

    Security Scheme Object

    +

    Defines a security scheme that can be used by the operations. +Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [[!rfc6749]], and OpenID Connect Discovery.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeApplies ToDescription
    typestringAnyREQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "oauth2", "openIdConnect".
    descriptionstringAnyA short description for security scheme. CommonMark syntax MAY be used for rich text representation.
    namestringapiKeyREQUIRED. The name of the header, query or cookie parameter to be used.
    instringapiKeyREQUIRED. The location of the API key. Valid values are "query", "header" or "cookie".
    schemestringhttpREQUIRED. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235]section-5.1).
    bearerFormatstringhttp ("bearer")A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes.
    flowsOAuth Flows Objectoauth2REQUIRED. An object containing configuration information for the flow types supported.
    openIdConnectUrlstringopenIdConnectREQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL.
    +

    This object MAY be extended with Specification Extensions.

    +
    Security Scheme Object Example
    +
    Basic Authentication Sample
    +
    
    +{
    +  "type": "http",
    +  "scheme": "basic"
    +}
    +
    +
    
    +type: http
    +scheme: basic
    +
    +
    API Key Sample
    +
    
    +{
    +  "type": "apiKey",
    +  "name": "api_key",
    +  "in": "header"
    +}
    +
    +
    
    +type: apiKey
    +name: api_key
    +in: header
    +
    +
    JWT Bearer Sample
    +
    
    +{
    +  "type": "http",
    +  "scheme": "bearer",
    +  "bearerFormat": "JWT",
    +}
    +
    +
    
    +type: http
    +scheme: bearer
    +bearerFormat: JWT
    +
    +
    Implicit OAuth2 Sample
    +
    
    +{
    +  "type": "oauth2",
    +  "flows": {
    +    "implicit": {
    +      "authorizationUrl": "https://example.com/api/oauth/dialog",
    +      "scopes": {
    +        "write:pets": "modify pets in your account",
    +        "read:pets": "read your pets"
    +      }
    +    }
    +  }
    +}
    +
    +
    
    +type: oauth2
    +flows: 
    +  implicit:
    +    authorizationUrl: https://example.com/api/oauth/dialog
    +    scopes:
    +      write:pets: modify pets in your account
    +      read:pets: read your pets
    +
    +

    OAuth Flows Object

    +

    Allows configuration of the supported OAuth Flows.

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeDescription
    implicitOAuth Flow ObjectConfiguration for the OAuth Implicit flow
    passwordOAuth Flow ObjectConfiguration for the OAuth Resource Owner Password flow
    clientCredentialsOAuth Flow ObjectConfiguration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0.
    authorizationCodeOAuth Flow ObjectConfiguration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.
    +

    This object MAY be extended with Specification Extensions.

    +

    OAuth Flow Object

    +

    Configuration details for a supported OAuth Flow

    +
    Fixed Fields
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Field NameTypeApplies ToDescription
    authorizationUrlstringoauth2 ("implicit", "authorizationCode")REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL.
    tokenUrlstringoauth2 ("password", "clientCredentials", "authorizationCode")REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL.
    refreshUrlstringoauth2The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.
    scopesMap[string, string]oauth2REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it.
    +

    This object MAY be extended with Specification Extensions.

    +
    OAuth Flow Object Examples
    +
    
    +{
    +  "type": "oauth2",
    +  "flows": {
    +    "implicit": {
    +      "authorizationUrl": "https://example.com/api/oauth/dialog",
    +      "scopes": {
    +        "write:pets": "modify pets in your account",
    +        "read:pets": "read your pets"
    +      }
    +    },
    +    "authorizationCode": {
    +      "authorizationUrl": "https://example.com/api/oauth/dialog",
    +      "tokenUrl": "https://example.com/api/oauth/token",
    +      "scopes": {
    +        "write:pets": "modify pets in your account",
    +        "read:pets": "read your pets"
    +      }
    +    }
    +  }
    +}
    +
    +
    
    +type: oauth2
    +flows: 
    +  implicit:
    +    authorizationUrl: https://example.com/api/oauth/dialog
    +    scopes:
    +      write:pets: modify pets in your account
    +      read:pets: read your pets
    +  authorizationCode:
    +    authorizationUrl: https://example.com/api/oauth/dialog
    +    tokenUrl: https://example.com/api/oauth/token
    +    scopes:
    +      write:pets: modify pets in your account
    +      read:pets: read your pets 
    +
    +

    Security Requirement Object

    +

    Lists the required security schemes to execute this operation. +The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.

    +

    Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. +This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.

    +

    When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.

    +
    Patterned Fields
    + + + + + + + + + + + + + + + +
    Field PatternTypeDescription
    {name}[string]Each name MUST correspond to a security scheme which is declared in the Security Schemes under the Components Object. If the security scheme is of type "oauth2" or "openIdConnect", then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty.
    +
    Security Requirement Object Examples
    +
    Non-OAuth2 Security Requirement
    +
    
    +{
    +  "api_key": []
    +}
    +
    +
    
    +api_key: []
    +
    +
    OAuth2 Security Requirement
    +
    
    +{
    +  "petstore_auth": [
    +    "write:pets",
    +    "read:pets"
    +  ]
    +}
    +
    +
    
    +petstore_auth:
    +- write:pets
    +- read:pets
    +
    +

    Specification Extensions

    +

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    +

    The extensions properties are implemented as patterned fields that are always prefixed by "x-".

    + + + + + + + + + + + + + + + +
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the OpenAPI Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. 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).

    +

    Security Filtering

    +

    Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.

    +

    The reasoning is to allow an additional layer of access control over the documentation. +While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.

    +

    Two examples of this:

    +
      +
    1. The Paths Object MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication.
    2. +
    3. The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object, so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see.
    4. +
    +

    Appendix A: Revision History

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    VersionDateNotes
    3.0.12017-12-06Patch release of the OpenAPI Specification 3.0.1
    3.0.02017-07-26Release of the OpenAPI Specification 3.0.0
    3.0.0-rc22017-06-16rc2 of the 3.0 specification
    3.0.0-rc12017-04-27rc1 of the 3.0 specification
    3.0.0-rc02017-02-28Implementer’s Draft of the 3.0 specification
    2.02015-12-31Donation of Swagger 2.0 to the Open API Initiative
    2.02014-09-08Release of Swagger 2.0
    1.22014-03-14Initial release of the formal document.
    1.12012-08-22Release of Swagger 1.1
    1.02011-08-10First release of the Swagger Specification
    + diff --git a/md2html/respec.sh b/md2html/respec.sh new file mode 100755 index 0000000000..916dbab8cd --- /dev/null +++ b/md2html/respec.sh @@ -0,0 +1,2 @@ +#!/bin/sh +node md2html.js --respec --maintainers ../MAINTAINERS.md ../versions/3.0.1.md > respec.html diff --git a/md2html/style-start.html b/md2html/style-start.html index 747b621cc6..cfb7bf781a 100644 --- a/md2html/style-start.html +++ b/md2html/style-start.html @@ -2,3 +2,4 @@ /*.highlight:not(.idl) { background: hsl(24, 20%, 95%); } code.highlight { padding: .1em; border-radius: .3em; } */ pre > code { background: hsl(24, 20%, 95%); display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; } +h1,h2,h3 { color: #629b34; }a[href] { color: #45512c; }body:not(.toc-inline) #toc h2 { color: #45512c; } diff --git a/md2html/v2/2.0.bs b/md2html/v2/2.0.bs index 5a2f85a66a..894bfcff0d 100644 --- a/md2html/v2/2.0.bs +++ b/md2html/v2/2.0.bs @@ -1,12 +1,13 @@ -

    OpenAPI Specification

    -

    (fka Swagger RESTful API Documentation Specification)

    -

    Version 2.0

    +OpenAPI Specification +

    OpenAPI Specification

    +

    (fka Swagger RESTful API Documentation Specification)

    +

    Version 2.0

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [!rfc2119].

    The Swagger specification is licensed under The Apache License, Version 2.0.

    -

    Introductions

    +

    Introductions

    Swagger™ is a project used to describe and document RESTful APIs.

    The Swagger specification defines a set of files required to describe such an API. These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various languages. Additional utilities can also take advantage of the resulting files, such as testing tools.

    -

    Revision History

    +

    Revision History

    @@ -38,11 +39,11 @@
    -

    Definitions

    -

    Path Templating

    -Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters. -

    Mime Types

    -Mime type definitions are spread across several resources. The mime type definitions should be in compliance with [[!rfc6838]]. +

    Definitions

    +

    Path Templating

    +

    Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters.

    +

    Mime Types

    +

    Mime type definitions are spread across several resources. The mime type definitions should be in compliance with [[!rfc6838]].

    Some examples of possible mime type definitions:

    
       text/plain; charset=utf-8
    @@ -56,10 +57,10 @@ Mime type definitions are spread across several resources. The mime type definit
       application/vnd.github.v3.diff
       application/vnd.github.v3.patch
     
    -

    HTTP Status Codes

    -The HTTP Status Codes are used to indicate the status of the executed operation. The available status codes are described by [[!rfc7231]]section-6) and in the [IANA Status Code Registry](http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml). -

    Specification

    -

    Format

    +
    HTTP Status Codes
    +

    The HTTP Status Codes are used to indicate the status of the executed operation. The available status codes are described by [[!rfc7231]]section-6) and in the IANA Status Code Registry.

    +

    Specification

    +

    Format

    The files describing the RESTful API in accordance with the Swagger specification are represented as JSON objects and conform to the JSON standards. YAML, being a superset of JSON, can be used as well to represent a Swagger specification file.

    For example, if a field is said to have an array value, the JSON array representation will be used:

    @@ -71,10 +72,10 @@ represent a Swagger specification file.

    While the API is described using JSON it does not impose a JSON input/output to the API itself.

    All field names in the specification are case sensitive.

    The schema exposes two types of fields. Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. Patterned fields can have multiple occurrences as long as each has a unique name.

    -

    File Structure

    +

    File Structure

    The Swagger representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for $ref fields in the specification as follows from the JSON Schema definitions.

    By convention, the Swagger specification file is named swagger.json.

    -

    Data Types

    +

    Data Types

    Primitive data types in the Swagger Specification are based on the types supported by the JSON-Schema Draft 4. Models are described using the Schema Object which is a subset of JSON Schema Draft 4.

    An additional primitive data type "file" is used by the Parameter Object and the Response Object to set the parameter type or the response as being a file.

    Primitives have an optional modifier property format. Swagger uses several known formats to more finely define the data type being used. However, the format property is an open string-valued property, and can have any value to support documentation needs. Formats such as "email", "uuid", etc., can be used even though they are not defined by this specification. Types that are not accompanied by a format property follow their definition from the JSON Schema (except for file type which is defined above). The formats defined by the Swagger Specification are:

    @@ -156,10 +157,10 @@ represent a Swagger specification file.

    -

    Schema

    -

    Swagger Object

    +

    Schema

    +

    Swagger Object

    This is the root document object for the API specification. It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document.

    -

    Fixed Fields

    +
    Fixed Fields
    @@ -246,7 +247,7 @@ represent a Swagger specification file.

    -
    Patterned Objects
    +
    Patterned Objects
    @@ -263,9 +264,9 @@ represent a Swagger specification file.

    -

    Info Object

    +

    Info Object

    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.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -307,7 +308,7 @@ represent a Swagger specification file.

    -
    Patterned Objects
    +
    Patterned Objects
    @@ -324,7 +325,7 @@ represent a Swagger specification file.

    -
    Info Object Example:
    +
    Info Object Example:
    
     {
       "title": "Swagger Sample App",
    @@ -355,9 +356,9 @@ represent a Swagger specification file.

    url: http://www.apache.org/licenses/LICENSE-2.0.html version: 1.0.1
    -

    Contact Object

    +

    Contact Object

    Contact information for the exposed API.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -384,7 +385,7 @@ represent a Swagger specification file.

    -
    Patterned Objects
    +
    Patterned Objects
    @@ -401,7 +402,7 @@ represent a Swagger specification file.

    -
    Contact Object Example:
    +
    Contact Object Example:
    
     {
       "name": "API Support",
    @@ -414,9 +415,9 @@ represent a Swagger specification file.

    url: http://www.swagger.io/support email: support@swagger.io
    -

    License Object

    +

    License Object

    License information for the exposed API.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -438,7 +439,7 @@ represent a Swagger specification file.

    -
    Patterned Objects
    +
    Patterned Objects
    @@ -455,7 +456,7 @@ represent a Swagger specification file.

    -
    License Object Example:
    +
    License Object Example:
    
     {
       "name": "Apache 2.0",
    @@ -466,10 +467,10 @@ represent a Swagger specification file.

    name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html
    -

    Paths Object

    +

    Paths Object

    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.

    -
    Patterned Fields
    +
    Patterned Fields
    @@ -491,7 +492,7 @@ The Paths may be empty, due to ACL constraints.
    -
    Paths Object Example
    +
    Paths Object Example
    
     {
       "/pets": {
    @@ -529,10 +530,10 @@ The Paths may be empty, due to ACL constraints.
               items:
                 $ref: '#/definitions/pet'
     
    -

    Path Item Object

    +

    Path Item Object

    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.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -589,7 +590,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Fields
    +
    Patterned Fields
    @@ -606,7 +607,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Path Item Object Example
    +
    Path Item Object Example
    
     {
       "get": {
    @@ -679,9 +680,9 @@ A Path Item may be empty, due to ACL constraints    type: string
       collectionFormat: csv
     
    -

    Operation Object

    +

    Operation Object

    Describes a single API operation on a path.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -753,7 +754,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Objects
    +
    Patterned Objects
    @@ -770,7 +771,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Operation Object Example
    +
    Operation Object Example
    
     {
       "tags": [
    @@ -864,9 +865,9 @@ A Path Item may be empty, due to ACL constraints  - write:pets
       - read:pets
     
    -

    External Documentation Object

    +

    External Documentation Object

    Allows referencing an external resource for extended documentation.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -888,7 +889,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Objects
    +
    Patterned Objects
    @@ -905,7 +906,7 @@ A Path Item may be empty, due to ACL constraints
    -
    External Documentation Object Example
    +
    External Documentation Object Example
    
     {
       "description": "Find more info here",
    @@ -916,7 +917,7 @@ A Path Item may be empty, due to ACL constraintsdescription: Find more info here
     url: https://swagger.io
     
    -

    Parameter Object

    +

    Parameter Object

    Describes a single operation parameter.

    A unique parameter is defined by a combination of a name and location.

    There are five possible parameter types.

    @@ -932,7 +933,7 @@ A Path Item may be empty, due to ACL constraints -
    Fixed Fields
    +
    Fixed Fields
    @@ -1083,7 +1084,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Fields
    +
    Patterned Fields
    @@ -1100,8 +1101,8 @@ A Path Item may be empty, due to ACL constraints
    -
    Parameter Object Examples
    -
    Body Parameters
    +
    Parameter Object Examples
    +
    Body Parameters

    A body parameter with a referenced schema definition (normally for a model definition):

    
     {
    @@ -1147,7 +1148,7 @@ A Path Item may be empty, due to ACL constraints  items:
         type: string
     
    -
    Other Parameters
    +
    Other Parameters

    A header parameter with an array of 64 bit integer numbers:

    
     {
    @@ -1232,9 +1233,9 @@ A Path Item may be empty, due to ACL constraintsrequired: true
     type: file
     
    -
    Items Object
    +
    Items Object

    A limited subset of JSON-Schema’s items object. It is used by parameter definitions that are not located in "body".

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -1331,7 +1332,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Objects
    +
    Patterned Objects
    @@ -1348,7 +1349,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Items Object Examples
    +
    Items Object Examples

    Items must be of type string and have the minimum length of 2 characters:

    
     {
    @@ -1378,11 +1379,11 @@ A Path Item may be empty, due to ACL constraints  minimum: 0
       maximum: 63
     
    -

    Responses Object

    +

    Responses Object

    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 Responses Object MUST contain at least one response code, and it SHOULD be the response for a successful operation call.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -1399,7 +1400,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Fields
    +
    Patterned Fields
    @@ -1421,7 +1422,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Responses Object Example
    +
    Responses Object Example

    A 200 response for successful operation and a default response for others (implying an error):

    
     {
    @@ -1449,9 +1450,9 @@ A Path Item may be empty, due to ACL constraints  schema:
         $ref: '#/definitions/ErrorModel'
     
    -

    Response Object

    -Describes a single response from an API Operation. -
    Fixed Fields
    +

    Response Object

    +

    Describes a single response from an API Operation.

    +
    Fixed Fields
    @@ -1483,7 +1484,7 @@ Describes a single response from an API Operation.
    -
    Patterned Objects
    +
    Patterned Objects
    @@ -1500,7 +1501,7 @@ Describes a single response from an API Operation.
    -
    Response Object Examples
    +
    Response Object Examples

    Response of an array of a complex type:

    
     {
    @@ -1581,9 +1582,9 @@ Describes a single response from an API Operation.
     
    
     description: object created
     
    -

    Headers Object

    -Lists the headers that can be sent as part of a response. -
    Patterned Fields
    +

    Headers Object

    +

    Lists the headers that can be sent as part of a response.

    +
    Patterned Fields
    @@ -1600,7 +1601,7 @@ Lists the headers that can be sent as part of a response.
    -
    Headers Object Example
    +
    Headers Object Example

    Rate-limit headers:

    
     {
    @@ -1629,9 +1630,9 @@ Lists the headers that can be sent as part of a response.
       description: The number of seconds left in the current period
       type: integer
     
    -

    Example Object

    +

    Example Object

    Allows sharing examples for operation responses.

    -
    Patterned Fields
    +
    Patterned Fields
    @@ -1648,7 +1649,7 @@ Lists the headers that can be sent as part of a response.
    -
    Example Object Example
    +
    Example Object Example

    Example response for application/json mimetype of a Pet data type:

    
     {
    @@ -1669,7 +1670,7 @@ Lists the headers that can be sent as part of a response.
       gender: Female
       breed: Mixed
     
    -

    Header Object

    +

    Header Object

    @@ -1771,7 +1772,7 @@ Lists the headers that can be sent as part of a response.
    -
    Patterned Objects
    +
    Patterned Objects
    @@ -1788,7 +1789,7 @@ Lists the headers that can be sent as part of a response.
    -
    Header Object Example
    +
    Header Object Example

    A simple header with of an integer type:

    
     {
    @@ -1800,9 +1801,9 @@ Lists the headers that can be sent as part of a response.
     description: The number of allowed requests in the current period
     type: integer
     
    -

    Tag Object

    +

    Tag Object

    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.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -1829,7 +1830,7 @@ Lists the headers that can be sent as part of a response.
    -
    Patterned Fields
    +
    Patterned Fields
    @@ -1846,7 +1847,7 @@ Lists the headers that can be sent as part of a response.
    -
    Tag Object Example
    +
    Tag Object Example
    
     {
     	"name": "pet",
    @@ -1857,10 +1858,10 @@ Lists the headers that can be sent as part of a response.
     name: pet
     description: Pets operations
     
    -

    Reference Object

    +

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

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -1877,7 +1878,7 @@ Lists the headers that can be sent as part of a response.
    -
    Reference Object Example
    +
    Reference Object Example
    
     {
     	"$ref": "#/definitions/Pet"
    @@ -1886,7 +1887,7 @@ Lists the headers that can be sent as part of a response.
     
    
     $ref: '#/definitions/Pet'
     
    -
    Relative Schema File Example
    +
    Relative Schema File Example
    
     {
       "$ref": "Pet.json"
    @@ -1895,7 +1896,7 @@ Lists the headers that can be sent as part of a response.
     
    
     $ref: 'Pet.yaml'
     
    -
    Relative Files With Embedded Schema Example
    +
    Relative Files With Embedded Schema Example
    
     {
       "$ref": "definitions.json#/Pet"
    @@ -1904,7 +1905,7 @@ Lists the headers that can be sent as part of a response.
     
    
     $ref: 'definitions.yaml#/Pet'
     
    -

    Schema Object

    +

    Schema Object

    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.

    Further information about the properties can be found in JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here.

    The following properties are taken directly from the JSON Schema definition and follow the same specifications:

    @@ -1939,7 +1940,7 @@ Lists the headers that can be sent as part of a response.
  • additionalProperties
  • Other than the JSON Schema subset fields, the following fields may be used for further schema documentation.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -1976,7 +1977,7 @@ Lists the headers that can be sent as part of a response.
    -
    Patterned Objects
    +
    Patterned Objects
    @@ -1993,13 +1994,13 @@ Lists the headers that can be sent as part of a response.
    -
    Composition and Inheritance (Polymorphism)
    +
    Composition and Inheritance (Polymorphism)

    Swagger allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. allOf takes in an array of object definitions that are validated independently but together compose a single object.

    While composition offers model extensibility, it does not imply a hierarchy between the models. To support polymorphism, Swagger adds the support of the discriminator field. When used, the discriminator will be the name of the property used to decide which schema definition is used to validate the structure of the model. As such, the discriminator field MUST be a required field. The value of the chosen property has to be the friendly name given to the model under the definitions property. As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism.

    -
    XML Modeling
    +
    XML Modeling

    The xml property allows extra definitions when translating the JSON definition to XML. The XML Object contains additional information about the available options.

    -
    Schema Object Examples
    -
    Primitive Sample
    +
    Schema Object Examples
    +
    Primitive Sample

    Unlike previous versions of Swagger, Schema definitions can be used to describe primitive and arrays as well.

    
     {
    @@ -2011,7 +2012,7 @@ Lists the headers that can be sent as part of a response.
     type: string
     format: email
     
    -
    Simple Model
    +
    Simple Model
    
     {
       "type": "object",
    @@ -2047,7 +2048,7 @@ Lists the headers that can be sent as part of a response.
         format: int32
         minimum: 0
     
    -
    Model with Map/Dictionary Properties
    +
    Model with Map/Dictionary Properties

    For a simple string to string mapping:

    
     {
    @@ -2076,7 +2077,7 @@ Lists the headers that can be sent as part of a response.
     additionalProperties:
       $ref: '#/definitions/ComplexModel'
     
    -
    Model with Example
    +
    Model with Example
    
     {
       "type": "object",
    @@ -2112,7 +2113,7 @@ Lists the headers that can be sent as part of a response.
       name: Puma
       id: 1
     
    -
    Models with Composition
    +
    Models with Composition
    
     {
       "definitions": {
    @@ -2178,7 +2179,7 @@ Lists the headers that can be sent as part of a response.
             rootCause:
               type: string
     
    -
    Models with Polymorphism Support
    +
    Models with Polymorphism Support
    
     {
       "definitions": {
    @@ -2296,10 +2297,10 @@ Lists the headers that can be sent as part of a response.
           required:
           - packSize
     
    -
    XML Object
    +
    XML Object

    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.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -2336,7 +2337,7 @@ Lists the headers that can be sent as part of a response.
    -
    Patterned Objects
    +
    Patterned Objects
    @@ -2353,9 +2354,9 @@ Lists the headers that can be sent as part of a response.
    -
    XML Object Examples
    +
    XML Object Examples

    The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

    -
    No XML Element
    +
    No XML Element

    Basic string property:

    
     {
    @@ -2393,7 +2394,7 @@ Lists the headers that can be sent as part of a response.
     <animals>...</animals>
     <animals>...</animals>
     
    -
    XML Name Replacement
    +
    XML Name Replacement
    
     {
       "animals": {
    @@ -2413,7 +2414,7 @@ Lists the headers that can be sent as part of a response.
     
    
     <animal>...</animal>
     
    -
    XML Attribute, Prefix and Namespace
    +
    XML Attribute, Prefix and Namespace

    In this example, a full model definition is shown.

    
     {
    @@ -2458,7 +2459,7 @@ Lists the headers that can be sent as part of a response.
         <sample:name xmlns:sample="http://swagger.io/schema/sample">example</sample:name>
     </Person>
     
    -
    XML Arrays
    +
    XML Arrays

    Changing the element names:

    
     {
    @@ -2642,9 +2643,9 @@ Lists the headers that can be sent as part of a response.
       <aliens>value</aliens>
     </aliens>
     
    -
    Definitions Object
    +
    Definitions Object

    An object to hold data types that can be consumed and produced by operations. These data types can be primitives, arrays or models.

    -
    Patterned Fields
    +
    Patterned Fields
    @@ -2661,7 +2662,7 @@ Lists the headers that can be sent as part of a response.
    -
    Definitions Object Example
    +
    Definitions Object Example
    
     {
       "Category": {
    @@ -2708,10 +2709,10 @@ Lists the headers that can be sent as part of a response.
         name:
           type: string
     
    -

    Parameters Definitions Object

    +

    Parameters Definitions Object

    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.

    -
    Patterned Fields
    +
    Patterned Fields
    @@ -2728,7 +2729,7 @@ Lists the headers that can be sent as part of a response.
    -
    Parameters Definition Object Example
    +
    Parameters Definition Object Example
    
     {
       "skipParam": {
    @@ -2765,10 +2766,10 @@ Lists the headers that can be sent as part of a response.
       type: integer
       format: int32
     
    -

    Responses Definitions Object

    +

    Responses Definitions Object

    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.

    -
    Patterned Fields
    +
    Patterned Fields
    @@ -2785,7 +2786,7 @@ Lists the headers that can be sent as part of a response.
    -
    Responses Definitions Object Example
    +
    Responses Definitions Object Example
    
     {
       "NotFound": {
    @@ -2812,9 +2813,9 @@ Lists the headers that can be sent as part of a response.
       schema:
         $ref: '#/definitions/GeneralError'
     
    -

    Security Definitions Object

    +

    Security Definitions Object

    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.

    -
    Patterned Fields
    +
    Patterned Fields
    @@ -2831,7 +2832,7 @@ Lists the headers that can be sent as part of a response.
    -
    Security Definitions Object Example
    +
    Security Definitions Object Example
    
     {
       "api_key": {
    @@ -2863,9 +2864,9 @@ Lists the headers that can be sent as part of a response.
         write:pets: modify pets in your account
         read:pets: read your pets
     
    -

    Security Scheme Object

    +

    Security Scheme Object

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

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -2926,7 +2927,7 @@ Lists the headers that can be sent as part of a response.
    -
    Patterned Fields
    +
    Patterned Fields
    @@ -2943,8 +2944,8 @@ Lists the headers that can be sent as part of a response.
    -
    Security Scheme Object Example
    -
    Basic Authentication Sample
    +
    Security Scheme Object Example
    +
    Basic Authentication Sample
    
     {
       "type": "basic"
    @@ -2953,7 +2954,7 @@ Lists the headers that can be sent as part of a response.
     
    
     type: basic
     
    -
    API Key Sample
    +
    API Key Sample
    
     {
       "type": "apiKey",
    @@ -2966,7 +2967,7 @@ Lists the headers that can be sent as part of a response.
     name: api_key
     in: header
     
    -
    Implicit OAuth2 Sample
    +
    Implicit OAuth2 Sample
    
     {
       "type": "oauth2",
    @@ -2986,9 +2987,9 @@ Lists the headers that can be sent as part of a response.
       write:pets: modify pets in your account
       read:pets: read your pets
     
    -
    Scopes Object
    +
    Scopes Object

    Lists the available scopes for an OAuth2 security scheme.

    -
    Patterned Fields
    +
    Patterned Fields
    @@ -3005,7 +3006,7 @@ Lists the headers that can be sent as part of a response.
    -
    Patterned Objects
    +
    Patterned Objects
    @@ -3022,7 +3023,7 @@ Lists the headers that can be sent as part of a response.
    -
    Scopes Object Example
    +
    Scopes Object Example
    
     {
       "write:pets": "modify pets in your account",
    @@ -3033,10 +3034,10 @@ Lists the headers that can be sent as part of a response.
     write:pets: modify pets in your account
     read:pets: read your pets
     
    -

    Security Requirement Object

    +

    Security Requirement Object

    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.

    -
    Patterned Fields
    +
    Patterned Fields
    @@ -3053,8 +3054,8 @@ Lists the headers that can be sent as part of a response.
    -
    Security Requirement Object Examples
    -
    Non-OAuth2 Security Requirement
    +
    Security Requirement Object Examples
    +
    Non-OAuth2 Security Requirement
    
     {
       "api_key": []
    @@ -3063,7 +3064,7 @@ Lists the headers that can be sent as part of a response.
     
    
     api_key: []
     
    -
    OAuth2 Security Requirement
    +
    OAuth2 Security Requirement
    
     {
       "petstore_auth": [
    @@ -3077,11 +3078,11 @@ Lists the headers that can be sent as part of a response.
     - write:pets
     - read:pets
     
    -
    Specification Extensions
    +
    Specification Extensions

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

    -
    Security Filtering
    +

    Security Filtering

    Some objects in the Swagger specification may be declared and remain empty, or completely be removed, even though they are inherently the core of the API documentation.

    The reasoning behind it is to allow an additional layer of access control over the documentation itself. While not part of the specification itself, certain libraries may choose to allow access to parts of the documentation based on some form of authentication/authorization.

    Two examples for this:

    diff --git a/md2html/v2/oas_2.0.html b/md2html/v2/oas_2.0.html index fc216f783e..bd848f0fb3 100644 --- a/md2html/v2/oas_2.0.html +++ b/md2html/v2/oas_2.0.html @@ -1179,7 +1179,7 @@ } } - + + - + + - - + + + '; preface += '
    '; preface += 'The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.'; @@ -131,6 +129,8 @@ if (argv.respec) { let lines = s.split('\r').join().split('\n'); let prevIndent = 0; +let lastIndent = 0; +let prevHeading = 0; let inTOC = false; let inDefs = false; let inCodeBlock = false; @@ -147,24 +147,45 @@ for (let l in lines) { } else if (line.startsWith('## ')) inDefs = false; - if (line.startsWith('#') && line.indexOf('1) { - if (delta<0) indent = prevIndent-1; - if (delta>0) indent = prevIndent+1; + if (!argv.respec) { + if (delta===0) indent = lastIndent + else if (delta<0) indent = lastIndent-1 + else if (delta>0) indent = lastIndent+1; + } + + lastIndent = indent; + if (indent < 0) { + console.warn(indent,line); + indent = 1; + } + if (argv.respec && (indent > 1)) { + indent--; } - let comp = line.split(''); - let title = comp[1]; - if (inDefs) title = ''+title+''; - let link = comp[0].split(''); - line = ('#'.repeat(indent)+' '); + if (line.indexOf(''); + let title = comp[1]; + if (inDefs) title = ''+title+''; + let link = comp[0].split(''); + } + else { + let title = line.split('# ')[1]; + if (inDefs) title = ''+title+''; + line = ('#'.repeat(indent)+' '+title); + } + + //prevIndent = originalIndent; + prevIndent = indent; } if (line.indexOf('">')>=0) { @@ -179,10 +200,6 @@ for (let l in lines) { }); } - line = line.replace(/\[([RGB])\]/,function(match,group1){ - return '\\['+group1+']'; - }); - line = line.split('\\|').join('¦'); while (line.indexOf('https://tools.ietf.org/html/rfc')>=0) { @@ -202,14 +219,13 @@ for (let l in lines) { } if (!inCodeBlock && line.startsWith('#')) { - let indent = 0; - while (line[indent] === '#') indent++; - - if (argv.respec && (indent > 1)) indent--; - - let delta = indent-prevIndent; - let oIndent = indent; + let heading = 0; + while (line[heading] === '#') heading++; + let delta = heading-prevHeading; + if (Math.abs(delta)>1) console.warn(delta,line); let prefix = ''; + + /*let oIndent = indent; if (!argv.respec && Math.abs(delta)>1) { // if we're skipping more than one indent level up or down correct it if (delta<0) { @@ -222,26 +238,36 @@ for (let l in lines) { } line = line.replace('#'.repeat(oIndent),'#'.repeat(indent)); } - else { + else { */ // heading level delta is either 0 or is +1/-1, or we're in respec mode /* respec insists on
    ...
    breaks around headings */ - if (delta == 0) { - prefix = '
    '; - } - else if (delta > 0) { - prefix = '
    '.repeat(delta); - } - else { - prefix = '
    '+('
    ').repeat(Math.abs(delta))+'
    '; - } - } + + //if (argv.respec) { + if (delta == 0) { + prefix = '
    '; + } + else if (delta > 0) { + prefix = '
    '.repeat(delta); + } + else { + prefix = ('
    ').repeat(Math.abs(delta)+1)+'
    '; + } + //} + prevHeading = heading; + /*}*/ line = prefix+md.render(line); - prevIndent = indent; } lines[l] = line; } +fs.writeFileSync('./md2html.tmp',lines.join('\n'),'utf8'); + s = preface('OpenAPI Specification',argv)+'\n\n'+lines.join('\n'); -console.log(md.render(s)); +let out = md.render(s); +out = out.replace(/\[([RGB])\]/g,function(match,group1){ + console.warn('Fixing',match,group1); + return '\\'+group1; +}); +console.log(out); diff --git a/md2html/respec.html b/md2html/respec.html index 3d6c24e82e..e89340920a 100644 --- a/md2html/respec.html +++ b/md2html/respec.html @@ -1,18 +1,18 @@ OpenAPI Specification
    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    State of the document

    The source-of-truth for the specification is the GitHub markdown file referenced above.

    OpenAPI Specification

    -

    Version 3.0.1

    +

    Version 3.0.1

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [[!rfc2119]] [[!rfc8174]] when, and only when, they appear in all capitals, as shown here.

    This document is licensed under The Apache License, Version 2.0.

    -

    Introduction

    +

    Introduction

    The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.

    An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.

    -

    Definitions

    -
    OpenAPI Document
    +

    Definitions

    +

    OpenAPI Document

    A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification.

    -
    Path Templating
    +

    Path Templating

    Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters.

    -
    Media Types
    +

    Media Types

    Media type definitions are spread across several resources. The media type definitions SHOULD be in compliance with [[!rfc6838]].

    Some examples of possible media type definitions:

    @@ -28,16 +28,16 @@ application/vnd.github.v3.diff application/vnd.github.v3.patch
    -
    HTTP Status Codes
    +

    HTTP Status Codes

    The HTTP Status Codes are used to indicate the status of the executed operation. The available status codes are defined by [[!rfc7231]]section-6) and registered status codes are listed in the IANA Status Code Registry.

    -

    Specification

    -

    Versions

    +

    Specification

    +

    Versions

    The OpenAPI Specification is versioned using Semantic Versioning 2.0.0 (semver) and follows the semver specification.

    The major.minor portion of the semver (for example 3.0) SHALL designate the OAS feature set. Typically, .patch versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between 3.0.0 and 3.0.1 for example.

    Subsequent minor version releases of the OpenAPI Specification (incrementing the minor version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical 3.1.0 specification SHOULD be usable with tooling designed for 3.0.0.

    An OpenAPI document compatible with OAS 3.*.* contains a required openapi field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named swagger and value "2.0".)

    -

    Format

    +

    Format

    An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format.

    For example, if a field has an array value, the JSON array representation will be used:

    
    @@ -54,10 +54,10 @@
     
  • Keys used in YAML maps MUST be limited to a scalar string, as defined by the YAML Failsafe schema ruleset.
  • Note: While APIs may be defined by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML.

    -

    Document Structure

    +

    Document Structure

    An OpenAPI document MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the user. In the latter case, $ref fields MUST be used in the specification to reference those parts as follows from the JSON Schema definitions.

    It is RECOMMENDED that the root OpenAPI document be named: openapi.json or openapi.yaml.

    -

    Data Types

    +

    Data Types

    Primitive data types in the OAS are based on the types supported by the JSON Schema Specification Wright Draft 00. Note that integer as a type is also supported and is defined as a JSON number without a fraction or exponent part. null is not supported as a type (see nullable for an alternative solution). @@ -146,18 +146,18 @@ -

    Rich Text Formatting

    +

    Rich Text Formatting

    Throughout the specification description fields are noted as supporting CommonMark markdown formatting. Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by CommonMark 0.27. Tooling MAY choose to ignore some CommonMark features to address security concerns.

    -

    Relative References in URLs

    +

    Relative References in URLs

    Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [[!rfc3986]]section-4.2). Relative references are resolved using the URLs defined in the Server Object as a Base URI.

    Relative references used in $ref are processed as per JSON Reference, using the URL of the current document as the base URI. See also the Reference Object.

    -

    Schema

    +

    Schema

    In the following description, if a field is not explicitly REQUIRED or described with a MUST or SHALL, it can be considered OPTIONAL.

    -

    OpenAPI Object

    +

    OpenAPI Object

    This is the root document object of the OpenAPI document.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -210,10 +210,10 @@

    This object MAY be extended with Specification Extensions.

    -

    Info Object

    +

    Info Object

    The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -256,7 +256,7 @@

    This object MAY be extended with Specification Extensions.

    -
    Info Object Example:
    +

    Info Object Example:

    
     {
       "title": "Sample Pet Store App",
    @@ -287,9 +287,9 @@
       url: https://www.apache.org/licenses/LICENSE-2.0.html
     version: 1.0.1
     
    -

    Contact Object

    +

    Contact Object

    Contact information for the exposed API.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -317,7 +317,7 @@

    This object MAY be extended with Specification Extensions.

    -
    Contact Object Example:
    +

    Contact Object Example:

    
     {
       "name": "API Support",
    @@ -330,9 +330,9 @@
     url: http://www.example.com/support
     email: support@example.com
     
    -

    License Object

    +

    License Object

    License information for the exposed API.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -355,7 +355,7 @@

    This object MAY be extended with Specification Extensions.

    -
    License Object Example:
    +

    License Object Example:

    
     {
       "name": "Apache 2.0",
    @@ -366,9 +366,9 @@
     name: Apache 2.0
     url: https://www.apache.org/licenses/LICENSE-2.0.html
     
    -

    Server Object

    +

    Server Object

    An object representing a Server.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -396,7 +396,7 @@

    This object MAY be extended with Specification Extensions.

    -
    Server Object Example
    +

    Server Object Example

    A single server would be described as:

    
     {
    @@ -481,9 +481,9 @@
           # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2`
           default: v2
     
    -

    Server Variable Object

    +

    Server Variable Object

    An object representing a Server Variable for server URL template substitution.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -511,10 +511,10 @@

    This object MAY be extended with Specification Extensions.

    -

    Components Object

    +

    Components Object

    Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -581,7 +581,7 @@ user-name my.org.User -
    Components Object Example
    +

    Components Object Example

    
     "components": {
       "schemas": {
    @@ -732,10 +732,10 @@
                 write:pets: modify pets in your account
                 read:pets: read your pets
     
    -

    Paths Object

    +

    Paths Object

    Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.

    -
    Patterned Fields
    +

    Patterned Fields

    @@ -753,7 +753,7 @@

    This object MAY be extended with Specification Extensions.

    -
    Path Templating Matching
    +

    Path Templating Matching

    Assuming the following paths, the concrete definition, /pets/mine, will be matched first if used:

    
       /pets/{petId}
    @@ -769,7 +769,7 @@
       /{entity}/me
       /books/{id}
     
    -
    Paths Object Example
    +

    Paths Object Example

    
     {
       "/pets": {
    @@ -808,11 +808,11 @@
                   items:
                     $ref: '#/components/schemas/pet'
     
    -

    Path Item Object

    +

    Path Item Object

    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.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -890,7 +890,7 @@

    This object MAY be extended with Specification Extensions.

    -
    Path Item Object Example
    +

    Path Item Object Example

    
     {
       "get": {
    @@ -971,9 +971,9 @@
         items:
           type: string  
     
    -

    Operation Object

    +

    Operation Object

    Describes a single API operation on a path.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -1046,7 +1046,7 @@

    This object MAY be extended with Specification Extensions.

    -
    Operation Object Example
    +

    Operation Object Example

    
     {
       "tags": [
    @@ -1152,9 +1152,9 @@
       - write:pets
       - read:pets
     
    -

    External Documentation Object

    +

    External Documentation Object

    Allows referencing an external resource for extended documentation.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -1177,7 +1177,7 @@

    This object MAY be extended with Specification Extensions.

    -
    External Documentation Object Example
    +

    External Documentation Object Example

    
     {
       "description": "Find more info here",
    @@ -1188,10 +1188,10 @@
     description: Find more info here
     url: https://example.com
     
    -

    Parameter Object

    +

    Parameter Object

    Describes a single operation parameter.

    A unique parameter is defined by a combination of a name and location.

    -
    Parameter Locations
    +

    Parameter Locations

    There are four possible parameter locations specified by the in field:

    • path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId.
    • @@ -1199,7 +1199,7 @@
    • header - Custom headers that are expected as part of the request. Note that [[!rfc7230]]page-22) states header names are case insensitive.
    • cookie - Used to pass a specific cookie value to the API.
    -
    Fixed Fields
    +

    Fixed Fields

    @@ -1303,7 +1303,7 @@
    -
    Style Values
    +

    Style Values

    In order to support common ways of serializing simple parameters, a set of style values are defined.

    @@ -1359,7 +1359,7 @@
    -
    Style Examples
    +

    Style Examples

    Assume a parameter named color has one of the following values:

    
        string -> "blue"
    @@ -1465,12 +1465,12 @@
     n/a
     n/a
     n/a
    -color[R]=100&color[G]=200&color[B]=150
    +color\R=100&color\G=200&color\B=150
     
     
     
     

    This object MAY be extended with Specification Extensions.

    -
    Parameter Object Examples
    +

    Parameter Object Examples

    A header parameter with an array of 64 bit integer numbers:

    
     {
    @@ -1614,9 +1614,9 @@
             long:
               type: number
     
    -

    Request Body Object

    +

    Request Body Object

    Describes a single request body.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -1644,7 +1644,7 @@

    This object MAY be extended with Specification Extensions.

    -
    Request Body Examples
    +

    Request Body Examples

    A request body with a referenced model definition.

    
     {
    @@ -1745,9 +1745,9 @@
           items:
             type: string
     
    -

    Media Type Object

    +

    Media Type Object

    Each Media Type Object provides schema and examples for the media type identified by its key.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -1780,7 +1780,7 @@

    This object MAY be extended with Specification Extensions.

    -
    Media Type Examples
    +

    Media Type Examples

    
     {
       "application/json": {
    @@ -1840,7 +1840,7 @@
         frog:
           $ref: "#/components/examples/frog-example"
     
    -
    Considerations for File Uploads
    +

    Considerations for File Uploads

    In contrast with the 2.0 specification, file input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically:

    
     # content transferred with base64 encoding
    @@ -1896,7 +1896,7 @@
                   format: binary
     
     
    -
    Support for x-www-form-urlencoded Request Bodies
    +

    Support for x-www-form-urlencoded Request Bodies

    To submit content using form url encoding via [[!rfc1866]], the following definition may be used:

    
    @@ -1916,7 +1916,7 @@
     

    In this example, the contents in the requestBody MUST be stringified per [[!rfc1866]]) when passed to the server. In addition, the address field complex object will be stringified.

    When passing complex objects in the application/x-www-form-urlencoded content type, the default serialization strategy of such properties is described in the Encoding Object's style property as form.

    -
    Special Considerations for multipart Content
    +

    Special Considerations for multipart Content

    It is common to use multipart/form-data as a Content-Type when transferring request bodies to operations. In contrast to 2.0, a schema is REQUIRED to define the input parameters to the operation when using multipart content. This supports complex structures as well as supporting mechanisms for multiple file uploads.

    When passing in multipart types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default Content-Types are defined for multipart:

      @@ -1955,9 +1955,9 @@ type: '#/components/schemas/Address'

    An encoding attribute is introduced to give you control over the serialization of parts of multipart request bodies. This attribute is only applicable to multipart and application/x-www-form-urlencoded request bodies.

    -

    Encoding Object

    +

    Encoding Object

    A single encoding definition applied to a single schema property.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -1995,7 +1995,7 @@

    This object MAY be extended with Specification Extensions.

    -
    Encoding Object Example
    +

    Encoding Object Example

    
     requestBody:
       content:
    @@ -2033,7 +2033,7 @@
                   schema:
                     type: integer
     
    -

    Responses Object

    +

    Responses Object

    A container for the expected responses of an operation. The container maps a HTTP response code to the expected response.

    The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. @@ -2042,7 +2042,7 @@ that are not covered individually by the specification.

    The Responses Object MUST contain at least one response code, and it SHOULD be the response for a successful operation call.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -2059,7 +2059,7 @@
    -
    Patterned Fields
    +

    Patterned Fields

    @@ -2077,7 +2077,7 @@

    This object MAY be extended with Specification Extensions.

    -
    Responses Object Example
    +

    Responses Object Example

    A 200 response for a successful operation and a default response for others (implying an error):

    
     {
    @@ -2117,10 +2117,10 @@
           schema:
             $ref: '#/components/schemas/ErrorModel'
     
    -

    Response Object

    +

    Response Object

    Describes a single response from an API Operation, including design-time, static links to operations based on the response.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -2153,7 +2153,7 @@

    This object MAY be extended with Specification Extensions.

    -
    Response Object Examples
    +

    Response Object Examples

    Response of an array of a complex type:

    
     {
    @@ -2263,11 +2263,11 @@
     
    
     description: object created
     
    -

    Callback Object

    +

    Callback Object

    A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

    -
    Patterned Fields
    +

    Patterned Fields

    @@ -2285,7 +2285,7 @@

    This object MAY be extended with Specification Extensions.

    -
    Key Expression
    +

    Key Expression

    The key that identifies the Path Item Object is a runtime expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. A simple example might be $request.body#/url. However, using a runtime expression the complete HTTP message can be accessed. @@ -2352,7 +2352,7 @@ -

    Callback Object Example
    +

    Callback Object Example

    The following example shows a callback to the URL specified by the id and email property in the request body.

    
     myWebhook:
    @@ -2368,8 +2368,8 @@
             '200':
               description: webhook successfully processed and no retries will be performed
     
    -

    Example Object

    -
    Fixed Fields
    +

    Example Object

    +

    Fixed Fields

    @@ -2405,7 +2405,7 @@

    In all cases, the example value is expected to be compatible with the type schema of its associated value. Tooling implementations MAY choose to validate compatibility automatically, and reject the example value(s) if incompatible.

    -
    Example Object Example
    +

    Example Object Example

    
     # in a model
     schemas:
    @@ -2464,12 +2464,12 @@
                 confirmation-success:
                   $ref: '#/components/examples/confirmation-success'
     
    -

    Link Object

    +

    Link Object

    The Link object represents a possible design-time link for a response. The presence of a link does not guarantee the caller’s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.

    Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.

    For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -2516,7 +2516,7 @@ In the case of an operationId, it MUST be unique and resolved in the scope of the OAS document. Because of the potential for name clashes, the operationRef syntax is preferred for specifications with external references.

    -
    Examples
    +

    Examples

    Computing a link from a request operation where the $request.path.id is used to pass a request parameter to the linked operation.

    
     paths:
    @@ -2576,7 +2576,7 @@
     

    Clients follow all links at their discretion. Neither permissions, nor the capability to make a successful call to that link, is guaranteed solely by the existence of a relationship.

    -
    OperationRef Examples
    +

    OperationRef Examples

    As references to operationId MAY NOT be possible (the operationId is an optional value), references MAY also be made through a relative operationRef:

    
    @@ -2598,7 +2598,7 @@
     

    Note that in the use of operationRef, the escaped forward-slash is necessary when using JSON references.

    -
    Runtime Expressions
    +

    Runtime Expressions

    Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. This mechanism is used by Link Objects and Callback Objects.

    The runtime expression is defined by the following [Augmented Backus-Naur Form] syntax

    @@ -2616,7 +2616,7 @@

    The name identifier is case-sensitive, whereas token is not.

    The table below provides examples of runtime expressions and examples of their use in a value:

    -
    Examples
    +

    Examples

    @@ -2665,14 +2665,14 @@

    Runtime expressions preserve the type of the referenced value. Expressions can be embedded into string values by surrounding the expression with {} curly braces.

    -

    Header Object

    +

    Header Object

    The Header Object follows the structure of the Parameter Object with the following changes:

    1. name MUST NOT be specified, it is given in the corresponding headers map.
    2. in MUST NOT be specified, it is implicitly in header.
    3. All traits that are affected by the location MUST be applicable to a location of header (for example, style).
    -
    Header Object Example
    +

    Header Object Example

    A simple header of type integer:

    
     {
    @@ -2687,10 +2687,10 @@
     schema:
       type: integer
     
    -

    Tag Object

    +

    Tag Object

    Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -2718,7 +2718,7 @@

    This object MAY be extended with Specification Extensions.

    -
    Tag Object Example
    +

    Tag Object Example

    
     {
     	"name": "pet",
    @@ -2729,11 +2729,11 @@
     name: pet
     description: Pets operations
     
    -

    Reference Object

    +

    Reference Object

    A simple object to allow referencing other components in the specification, internally and externally.

    The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.

    For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -2751,7 +2751,7 @@

    This object cannot be extended with additional properties and any properties added SHALL be ignored.

    -
    Reference Object Example
    +

    Reference Object Example

    
     {
     	"$ref": "#/components/schemas/Pet"
    @@ -2760,7 +2760,7 @@
     
    
     $ref: '#/components/schemas/Pet'
     
    -
    Relative Schema Document Example
    +

    Relative Schema Document Example

    
     {
       "$ref": "Pet.json"
    @@ -2769,7 +2769,7 @@
     
    
     $ref: Pet.yaml
     
    -
    Relative Documents With Embedded Schema Example
    +

    Relative Documents With Embedded Schema Example

    
     {
       "$ref": "definitions.json#/Pet"
    @@ -2778,13 +2778,13 @@
     
    
     $ref: definitions.yaml#/Pet
     
    -

    Schema Object

    +

    Schema Object

    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 an extended subset of the JSON Schema Specification Wright Draft 00.

    For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.

    -
    Properties
    +

    Properties

    The following properties are taken directly from the JSON Schema definition and follow the same specifications:

    • title
    • @@ -2821,7 +2821,7 @@

      Alternatively, any time a Schema Object can be used, a Reference Object can be used in its place. This allows referencing definitions instead of defining them inline.

      Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported.

      Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation:

      -
    Fixed Fields
    +

    Fixed Fields

    @@ -2874,7 +2874,7 @@

    This object MAY be extended with Specification Extensions.

    -
    Composition and Inheritance (Polymorphism)
    +
    Composition and Inheritance (Polymorphism)

    The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. allOf takes an array of object definitions that are validated independently but together compose a single object.

    While composition offers model extensibility, it does not imply a hierarchy between the models. @@ -2887,11 +2887,11 @@

  • Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name. As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism.
  • -
    XML Modeling
    +
    XML Modeling

    The xml property allows extra definitions when translating the JSON definition to XML. The XML Object contains additional information about the available options.

    -
    Schema Object Examples
    -
    Primitive Sample
    +

    Schema Object Examples

    +
    Primitive Sample
    
     {
       "type": "string",
    @@ -2902,7 +2902,7 @@
     type: string
     format: email
     
    -
    Simple Model
    +
    Simple Model
    
     {
       "type": "object",
    @@ -2938,7 +2938,7 @@
         format: int32
         minimum: 0
     
    -
    Model with Map/Dictionary Properties
    +
    Model with Map/Dictionary Properties

    For a simple string to string mapping:

    
     {
    @@ -2967,7 +2967,7 @@
     additionalProperties:
       $ref: '#/components/schemas/ComplexModel'
     
    -
    Model with Example
    +
    Model with Example
    
     {
       "type": "object",
    @@ -3003,7 +3003,7 @@
       name: Puma
       id: 1
     
    -
    Models with Composition
    +
    Models with Composition
    
     {
       "components": {
    @@ -3072,7 +3072,7 @@
               rootCause:
                 type: string
     
    -
    Models with Polymorphism Support
    +
    Models with Polymorphism Support
    
     {
       "components": {
    @@ -3195,10 +3195,10 @@
             required:
             - packSize
     
    -

    Discriminator Object

    +

    Discriminator Object

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    When using the discriminator, inline schemas will not be considered.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -3319,11 +3319,11 @@ }

    will map to Dog because of the definition in the mappings element.

    -

    XML Object

    +

    XML Object

    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.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -3361,9 +3361,9 @@

    This object MAY be extended with Specification Extensions.

    -
    XML Object Examples
    +

    XML Object Examples

    The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

    -
    No XML Element
    +
    No XML Element

    Basic string property:

    
     {
    @@ -3401,7 +3401,7 @@
     <animals>...</animals>
     <animals>...</animals>
     
    -
    XML Name Replacement
    +
    XML Name Replacement
    
     {
       "animals": {
    @@ -3421,7 +3421,7 @@
     
    
     <animal>...</animal>
     
    -
    XML Attribute, Prefix and Namespace
    +
    XML Attribute, Prefix and Namespace

    In this example, a full model definition is shown.

    
     {
    @@ -3466,7 +3466,7 @@
         <sample:name xmlns:sample="http://example.com/schema/sample">example</sample:name>
     </Person>
     
    -
    XML Arrays
    +
    XML Arrays

    Changing the element names:

    
     {
    @@ -3650,10 +3650,10 @@
       <aliens>value</aliens>
     </aliens>
     
    -

    Security Scheme Object

    +

    Security Scheme Object

    Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [[!rfc6749]], and OpenID Connect Discovery.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -3715,8 +3715,8 @@

    This object MAY be extended with Specification Extensions.

    -
    Security Scheme Object Example
    -
    Basic Authentication Sample
    +

    Security Scheme Object Example

    +
    Basic Authentication Sample
    
     {
       "type": "http",
    @@ -3727,7 +3727,7 @@
     type: http
     scheme: basic
     
    -
    API Key Sample
    +
    API Key Sample
    
     {
       "type": "apiKey",
    @@ -3740,7 +3740,7 @@
     name: api_key
     in: header
     
    -
    JWT Bearer Sample
    +
    JWT Bearer Sample
    
     {
       "type": "http",
    @@ -3753,7 +3753,7 @@
     scheme: bearer
     bearerFormat: JWT
     
    -
    Implicit OAuth2 Sample
    +
    Implicit OAuth2 Sample
    
     {
       "type": "oauth2",
    @@ -3777,9 +3777,9 @@
           write:pets: modify pets in your account
           read:pets: read your pets
     
    -

    OAuth Flows Object

    +

    OAuth Flows Object

    Allows configuration of the supported OAuth Flows.

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -3812,9 +3812,9 @@

    This object MAY be extended with Specification Extensions.

    -

    OAuth Flow Object

    +

    OAuth Flow Object

    Configuration details for a supported OAuth Flow

    -
    Fixed Fields
    +

    Fixed Fields

    @@ -3852,7 +3852,7 @@

    This object MAY be extended with Specification Extensions.

    -
    OAuth Flow Object Examples
    +

    OAuth Flow Object Examples

    
     {
       "type": "oauth2",
    @@ -3890,13 +3890,13 @@
           write:pets: modify pets in your account
           read:pets: read your pets 
     
    -

    Security Requirement Object

    +

    Security Requirement Object

    Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.

    Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.

    When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.

    -
    Patterned Fields
    +

    Patterned Fields

    @@ -3913,8 +3913,8 @@
    -
    Security Requirement Object Examples
    -
    Non-OAuth2 Security Requirement
    +

    Security Requirement Object Examples

    +
    Non-OAuth2 Security Requirement
    
     {
       "api_key": []
    @@ -3923,7 +3923,7 @@
     
    
     api_key: []
     
    -
    OAuth2 Security Requirement
    +
    OAuth2 Security Requirement
    
     {
       "petstore_auth": [
    @@ -3937,7 +3937,7 @@
     - write:pets
     - read:pets
     
    -

    Specification Extensions

    +

    Specification Extensions

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    The extensions properties are implemented as patterned fields that are always prefixed by "x-".

    @@ -3957,7 +3957,7 @@

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

    -

    Security Filtering

    +

    Security Filtering

    Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.

    The reasoning is to allow an additional layer of access control over the documentation. While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.

    @@ -3966,7 +3966,7 @@
  • The Paths Object MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication.
  • The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object, so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see.
  • -

    Appendix A: Revision History

    +

    Appendix A: Revision History

    diff --git a/md2html/v2/2.0.bs b/md2html/v2/2.0.bs index 894bfcff0d..b8fa547027 100644 --- a/md2html/v2/2.0.bs +++ b/md2html/v2/2.0.bs @@ -1,13 +1,13 @@ OpenAPI Specification -

    OpenAPI Specification

    -

    (fka Swagger RESTful API Documentation Specification)

    -

    Version 2.0

    +

    OpenAPI Specification

    +

    (fka Swagger RESTful API Documentation Specification)

    +

    Version 2.0

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [!rfc2119].

    The Swagger specification is licensed under The Apache License, Version 2.0.

    -

    Introductions

    +

    Introductions

    Swagger™ is a project used to describe and document RESTful APIs.

    The Swagger specification defines a set of files required to describe such an API. These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various languages. Additional utilities can also take advantage of the resulting files, such as testing tools.

    -

    Revision History

    +

    Revision History

    @@ -39,10 +39,10 @@
    -

    Definitions

    -

    Path Templating

    +

    Definitions

    +

    Path Templating

    Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters.

    -

    Mime Types

    +
    Mime Types

    Mime type definitions are spread across several resources. The mime type definitions should be in compliance with [[!rfc6838]].

    Some examples of possible mime type definitions:

    
    @@ -57,10 +57,10 @@
       application/vnd.github.v3.diff
       application/vnd.github.v3.patch
     
    -
    HTTP Status Codes
    +
    HTTP Status Codes

    The HTTP Status Codes are used to indicate the status of the executed operation. The available status codes are described by [[!rfc7231]]section-6) and in the IANA Status Code Registry.

    -

    Specification

    -

    Format

    +

    Specification

    +

    Format

    The files describing the RESTful API in accordance with the Swagger specification are represented as JSON objects and conform to the JSON standards. YAML, being a superset of JSON, can be used as well to represent a Swagger specification file.

    For example, if a field is said to have an array value, the JSON array representation will be used:

    @@ -72,10 +72,10 @@ represent a Swagger specification file.

    While the API is described using JSON it does not impose a JSON input/output to the API itself.

    All field names in the specification are case sensitive.

    The schema exposes two types of fields. Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. Patterned fields can have multiple occurrences as long as each has a unique name.

    -

    File Structure

    +

    File Structure

    The Swagger representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for $ref fields in the specification as follows from the JSON Schema definitions.

    By convention, the Swagger specification file is named swagger.json.

    -

    Data Types

    +

    Data Types

    Primitive data types in the Swagger Specification are based on the types supported by the JSON-Schema Draft 4. Models are described using the Schema Object which is a subset of JSON Schema Draft 4.

    An additional primitive data type "file" is used by the Parameter Object and the Response Object to set the parameter type or the response as being a file.

    Primitives have an optional modifier property format. Swagger uses several known formats to more finely define the data type being used. However, the format property is an open string-valued property, and can have any value to support documentation needs. Formats such as "email", "uuid", etc., can be used even though they are not defined by this specification. Types that are not accompanied by a format property follow their definition from the JSON Schema (except for file type which is defined above). The formats defined by the Swagger Specification are:

    @@ -157,10 +157,10 @@ represent a Swagger specification file.

    -

    Schema

    -

    Swagger Object

    +

    Schema

    +

    Swagger Object

    This is the root document object for the API specification. It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -247,7 +247,7 @@ represent a Swagger specification file.

    -
    Patterned Objects
    +
    Patterned Objects
    @@ -264,9 +264,9 @@ represent a Swagger specification file.

    -

    Info Object

    +

    Info Object

    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.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -308,7 +308,7 @@ represent a Swagger specification file.

    -
    Patterned Objects
    +
    Patterned Objects
    @@ -325,7 +325,7 @@ represent a Swagger specification file.

    -
    Info Object Example:
    +
    Info Object Example:
    
     {
       "title": "Swagger Sample App",
    @@ -356,9 +356,9 @@ represent a Swagger specification file.

    url: http://www.apache.org/licenses/LICENSE-2.0.html version: 1.0.1
    -

    Contact Object

    +

    Contact Object

    Contact information for the exposed API.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -385,7 +385,7 @@ represent a Swagger specification file.

    -
    Patterned Objects
    +
    Patterned Objects
    @@ -402,7 +402,7 @@ represent a Swagger specification file.

    -
    Contact Object Example:
    +
    Contact Object Example:
    
     {
       "name": "API Support",
    @@ -415,9 +415,9 @@ represent a Swagger specification file.

    url: http://www.swagger.io/support email: support@swagger.io
    -

    License Object

    +

    License Object

    License information for the exposed API.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -439,7 +439,7 @@ represent a Swagger specification file.

    -
    Patterned Objects
    +
    Patterned Objects
    @@ -456,7 +456,7 @@ represent a Swagger specification file.

    -
    License Object Example:
    +
    License Object Example:
    
     {
       "name": "Apache 2.0",
    @@ -467,10 +467,10 @@ represent a Swagger specification file.

    name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html
    -

    Paths Object

    +

    Paths Object

    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.

    -
    Patterned Fields
    +
    Patterned Fields
    @@ -492,7 +492,7 @@ The Paths may be empty, due to ACL constraints.
    -
    Paths Object Example
    +
    Paths Object Example
    
     {
       "/pets": {
    @@ -530,10 +530,10 @@ The Paths may be empty, due to ACL constraints.
               items:
                 $ref: '#/definitions/pet'
     
    -

    Path Item Object

    +

    Path Item Object

    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.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -590,7 +590,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Fields
    +
    Patterned Fields
    @@ -607,7 +607,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Path Item Object Example
    +
    Path Item Object Example
    
     {
       "get": {
    @@ -680,9 +680,9 @@ A Path Item may be empty, due to ACL constraints    type: string
       collectionFormat: csv
     
    -

    Operation Object

    +

    Operation Object

    Describes a single API operation on a path.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -754,7 +754,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Objects
    +
    Patterned Objects
    @@ -771,7 +771,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Operation Object Example
    +
    Operation Object Example
    
     {
       "tags": [
    @@ -865,9 +865,9 @@ A Path Item may be empty, due to ACL constraints  - write:pets
       - read:pets
     
    -

    External Documentation Object

    +

    External Documentation Object

    Allows referencing an external resource for extended documentation.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -889,7 +889,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Objects
    +
    Patterned Objects
    @@ -906,7 +906,7 @@ A Path Item may be empty, due to ACL constraints
    -
    External Documentation Object Example
    +
    External Documentation Object Example
    
     {
       "description": "Find more info here",
    @@ -917,7 +917,7 @@ A Path Item may be empty, due to ACL constraintsdescription: Find more info here
     url: https://swagger.io
     
    -

    Parameter Object

    +

    Parameter Object

    Describes a single operation parameter.

    A unique parameter is defined by a combination of a name and location.

    There are five possible parameter types.

    @@ -933,7 +933,7 @@ A Path Item may be empty, due to ACL constraints -
    Fixed Fields
    +
    Fixed Fields
    @@ -1084,7 +1084,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Fields
    +
    Patterned Fields
    @@ -1101,8 +1101,8 @@ A Path Item may be empty, due to ACL constraints
    -
    Parameter Object Examples
    -
    Body Parameters
    +
    Parameter Object Examples
    +
    Body Parameters

    A body parameter with a referenced schema definition (normally for a model definition):

    
     {
    @@ -1148,7 +1148,7 @@ A Path Item may be empty, due to ACL constraints  items:
         type: string
     
    -
    Other Parameters
    +
    Other Parameters

    A header parameter with an array of 64 bit integer numbers:

    
     {
    @@ -1233,9 +1233,9 @@ A Path Item may be empty, due to ACL constraintsrequired: true
     type: file
     
    -
    Items Object
    +

    Items Object

    A limited subset of JSON-Schema’s items object. It is used by parameter definitions that are not located in "body".

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -1332,7 +1332,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Objects
    +
    Patterned Objects
    @@ -1349,7 +1349,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Items Object Examples
    +
    Items Object Examples

    Items must be of type string and have the minimum length of 2 characters:

    
     {
    @@ -1379,11 +1379,11 @@ A Path Item may be empty, due to ACL constraints  minimum: 0
       maximum: 63
     
    -

    Responses Object

    +

    Responses Object

    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 Responses Object MUST contain at least one response code, and it SHOULD be the response for a successful operation call.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -1400,7 +1400,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Fields
    +
    Patterned Fields
    @@ -1422,7 +1422,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Responses Object Example
    +
    Responses Object Example

    A 200 response for successful operation and a default response for others (implying an error):

    
     {
    @@ -1450,9 +1450,9 @@ A Path Item may be empty, due to ACL constraints  schema:
         $ref: '#/definitions/ErrorModel'
     
    -

    Response Object

    +

    Response Object

    Describes a single response from an API Operation.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -1484,7 +1484,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Objects
    +
    Patterned Objects
    @@ -1501,7 +1501,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Response Object Examples
    +
    Response Object Examples

    Response of an array of a complex type:

    
     {
    @@ -1582,9 +1582,9 @@ A Path Item may be empty, due to ACL constraints
     description: object created
     
    -

    Headers Object

    +

    Headers Object

    Lists the headers that can be sent as part of a response.

    -
    Patterned Fields
    +
    Patterned Fields
    @@ -1601,7 +1601,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Headers Object Example
    +
    Headers Object Example

    Rate-limit headers:

    
     {
    @@ -1630,9 +1630,9 @@ A Path Item may be empty, due to ACL constraints  description: The number of seconds left in the current period
       type: integer
     
    -

    Example Object

    +

    Example Object

    Allows sharing examples for operation responses.

    -
    Patterned Fields
    +
    Patterned Fields
    @@ -1649,7 +1649,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Example Object Example
    +
    Example Object Example

    Example response for application/json mimetype of a Pet data type:

    
     {
    @@ -1670,7 +1670,7 @@ A Path Item may be empty, due to ACL constraints  gender: Female
       breed: Mixed
     
    -

    Header Object

    +

    Header Object

    @@ -1772,7 +1772,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Objects
    +
    Patterned Objects
    @@ -1789,7 +1789,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Header Object Example
    +
    Header Object Example

    A simple header with of an integer type:

    
     {
    @@ -1801,9 +1801,9 @@ A Path Item may be empty, due to ACL constraintsdescription: The number of allowed requests in the current period
     type: integer
     
    -

    Tag Object

    +

    Tag Object

    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.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -1830,7 +1830,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Fields
    +
    Patterned Fields
    @@ -1847,7 +1847,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Tag Object Example
    +
    Tag Object Example
    
     {
     	"name": "pet",
    @@ -1858,10 +1858,10 @@ A Path Item may be empty, due to ACL constraintsname: pet
     description: Pets operations
     
    -

    Reference Object

    +

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

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -1878,7 +1878,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Reference Object Example
    +
    Reference Object Example
    
     {
     	"$ref": "#/definitions/Pet"
    @@ -1887,7 +1887,7 @@ A Path Item may be empty, due to ACL constraints
     $ref: '#/definitions/Pet'
     
    -
    Relative Schema File Example
    +
    Relative Schema File Example
    
     {
       "$ref": "Pet.json"
    @@ -1896,7 +1896,7 @@ A Path Item may be empty, due to ACL constraints
     $ref: 'Pet.yaml'
     
    -
    Relative Files With Embedded Schema Example
    +
    Relative Files With Embedded Schema Example
    
     {
       "$ref": "definitions.json#/Pet"
    @@ -1905,7 +1905,7 @@ A Path Item may be empty, due to ACL constraints
     $ref: 'definitions.yaml#/Pet'
     
    -

    Schema Object

    +

    Schema Object

    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.

    Further information about the properties can be found in JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here.

    The following properties are taken directly from the JSON Schema definition and follow the same specifications:

    @@ -1940,7 +1940,7 @@ A Path Item may be empty, due to ACL constraintsadditionalProperties

    Other than the JSON Schema subset fields, the following fields may be used for further schema documentation.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -1977,7 +1977,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Objects
    +
    Patterned Objects
    @@ -1994,13 +1994,13 @@ A Path Item may be empty, due to ACL constraints
    -
    Composition and Inheritance (Polymorphism)
    +
    Composition and Inheritance (Polymorphism)

    Swagger allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. allOf takes in an array of object definitions that are validated independently but together compose a single object.

    While composition offers model extensibility, it does not imply a hierarchy between the models. To support polymorphism, Swagger adds the support of the discriminator field. When used, the discriminator will be the name of the property used to decide which schema definition is used to validate the structure of the model. As such, the discriminator field MUST be a required field. The value of the chosen property has to be the friendly name given to the model under the definitions property. As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism.

    -
    XML Modeling
    +
    XML Modeling

    The xml property allows extra definitions when translating the JSON definition to XML. The XML Object contains additional information about the available options.

    -
    Schema Object Examples
    -
    Primitive Sample
    +
    Schema Object Examples
    +
    Primitive Sample

    Unlike previous versions of Swagger, Schema definitions can be used to describe primitive and arrays as well.

    
     {
    @@ -2012,7 +2012,7 @@ A Path Item may be empty, due to ACL constraintstype: string
     format: email
     
    -
    Simple Model
    +
    Simple Model
    
     {
       "type": "object",
    @@ -2048,7 +2048,7 @@ A Path Item may be empty, due to ACL constraints    format: int32
         minimum: 0
     
    -
    Model with Map/Dictionary Properties
    +
    Model with Map/Dictionary Properties

    For a simple string to string mapping:

    
     {
    @@ -2077,7 +2077,7 @@ A Path Item may be empty, due to ACL constraintsadditionalProperties:
       $ref: '#/definitions/ComplexModel'
     
    -
    Model with Example
    +
    Model with Example
    
     {
       "type": "object",
    @@ -2113,7 +2113,7 @@ A Path Item may be empty, due to ACL constraints  name: Puma
       id: 1
     
    -
    Models with Composition
    +
    Models with Composition
    
     {
       "definitions": {
    @@ -2179,7 +2179,7 @@ A Path Item may be empty, due to ACL constraints        rootCause:
               type: string
     
    -
    Models with Polymorphism Support
    +
    Models with Polymorphism Support
    
     {
       "definitions": {
    @@ -2297,10 +2297,10 @@ A Path Item may be empty, due to ACL constraints      required:
           - packSize
     
    -
    XML Object
    +

    XML Object

    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.

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -2337,7 +2337,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Objects
    +
    Patterned Objects
    @@ -2354,9 +2354,9 @@ A Path Item may be empty, due to ACL constraints
    -
    XML Object Examples
    +
    XML Object Examples

    The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

    -
    No XML Element
    +
    No XML Element

    Basic string property:

    
     {
    @@ -2394,7 +2394,7 @@ A Path Item may be empty, due to ACL constraints<animals>...</animals>
     <animals>...</animals>
     
    -
    XML Name Replacement
    +
    XML Name Replacement
    
     {
       "animals": {
    @@ -2414,7 +2414,7 @@ A Path Item may be empty, due to ACL constraints
     <animal>...</animal>
     
    -
    XML Attribute, Prefix and Namespace
    +
    XML Attribute, Prefix and Namespace

    In this example, a full model definition is shown.

    
     {
    @@ -2459,7 +2459,7 @@ A Path Item may be empty, due to ACL constraints<sample:name xmlns:sample="http://swagger.io/schema/sample">example</sample:name>
     </Person>
     
    -
    XML Arrays
    +
    XML Arrays

    Changing the element names:

    
     {
    @@ -2643,9 +2643,9 @@ A Path Item may be empty, due to ACL constraints<aliens>value</aliens>
     </aliens>
     
    -
    Definitions Object
    +

    Definitions Object

    An object to hold data types that can be consumed and produced by operations. These data types can be primitives, arrays or models.

    -
    Patterned Fields
    +
    Patterned Fields
    @@ -2662,7 +2662,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Definitions Object Example
    +
    Definitions Object Example
    
     {
       "Category": {
    @@ -2709,10 +2709,10 @@ A Path Item may be empty, due to ACL constraints    name:
           type: string
     
    -

    Parameters Definitions Object

    +

    Parameters Definitions Object

    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.

    -
    Patterned Fields
    +
    Patterned Fields
    @@ -2729,7 +2729,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Parameters Definition Object Example
    +
    Parameters Definition Object Example
    
     {
       "skipParam": {
    @@ -2766,10 +2766,10 @@ A Path Item may be empty, due to ACL constraints  type: integer
       format: int32
     
    -

    Responses Definitions Object

    +

    Responses Definitions Object

    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.

    -
    Patterned Fields
    +
    Patterned Fields
    @@ -2786,7 +2786,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Responses Definitions Object Example
    +
    Responses Definitions Object Example
    
     {
       "NotFound": {
    @@ -2813,9 +2813,9 @@ A Path Item may be empty, due to ACL constraints  schema:
         $ref: '#/definitions/GeneralError'
     
    -

    Security Definitions Object

    +

    Security Definitions Object

    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.

    -
    Patterned Fields
    +
    Patterned Fields
    @@ -2832,7 +2832,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Security Definitions Object Example
    +
    Security Definitions Object Example
    
     {
       "api_key": {
    @@ -2864,9 +2864,9 @@ A Path Item may be empty, due to ACL constraints    write:pets: modify pets in your account
         read:pets: read your pets
     
    -

    Security Scheme Object

    +

    Security Scheme Object

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

    -
    Fixed Fields
    +
    Fixed Fields
    @@ -2927,7 +2927,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Fields
    +
    Patterned Fields
    @@ -2944,8 +2944,8 @@ A Path Item may be empty, due to ACL constraints
    -
    Security Scheme Object Example
    -
    Basic Authentication Sample
    +
    Security Scheme Object Example
    +
    Basic Authentication Sample
    
     {
       "type": "basic"
    @@ -2954,7 +2954,7 @@ A Path Item may be empty, due to ACL constraints
     type: basic
     
    -
    API Key Sample
    +
    API Key Sample
    
     {
       "type": "apiKey",
    @@ -2967,7 +2967,7 @@ A Path Item may be empty, due to ACL constraintsname: api_key
     in: header
     
    -
    Implicit OAuth2 Sample
    +
    Implicit OAuth2 Sample
    
     {
       "type": "oauth2",
    @@ -2987,9 +2987,9 @@ A Path Item may be empty, due to ACL constraints  write:pets: modify pets in your account
       read:pets: read your pets
     
    -
    Scopes Object
    +

    Scopes Object

    Lists the available scopes for an OAuth2 security scheme.

    -
    Patterned Fields
    +
    Patterned Fields
    @@ -3006,7 +3006,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Patterned Objects
    +
    Patterned Objects
    @@ -3023,7 +3023,7 @@ A Path Item may be empty, due to ACL constraints
    -
    Scopes Object Example
    +
    Scopes Object Example
    
     {
       "write:pets": "modify pets in your account",
    @@ -3034,10 +3034,10 @@ A Path Item may be empty, due to ACL constraintswrite:pets: modify pets in your account
     read:pets: read your pets
     
    -

    Security Requirement Object

    +

    Security Requirement Object

    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.

    -
    Patterned Fields
    +
    Patterned Fields
    @@ -3054,8 +3054,8 @@ A Path Item may be empty, due to ACL constraints
    -
    Security Requirement Object Examples
    -
    Non-OAuth2 Security Requirement
    +
    Security Requirement Object Examples
    +
    Non-OAuth2 Security Requirement
    
     {
       "api_key": []
    @@ -3064,7 +3064,7 @@ A Path Item may be empty, due to ACL constraints
     api_key: []
     
    -
    OAuth2 Security Requirement
    +
    OAuth2 Security Requirement
    
     {
       "petstore_auth": [
    @@ -3078,11 +3078,11 @@ A Path Item may be empty, due to ACL constraints- write:pets
     - read:pets
     
    -
    Specification Extensions
    +

    Specification Extensions

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

    -

    Security Filtering

    +

    Security Filtering

    Some objects in the Swagger specification may be declared and remain empty, or completely be removed, even though they are inherently the core of the API documentation.

    The reasoning behind it is to allow an additional layer of access control over the documentation itself. While not part of the specification itself, certain libraries may choose to allow access to parts of the documentation based on some form of authentication/authorization.

    Two examples for this:

    diff --git a/md2html/v2/oas_2.0.html b/md2html/v2/oas_2.0.html index bd848f0fb3..b0cafe19ce 100644 --- a/md2html/v2/oas_2.0.html +++ b/md2html/v2/oas_2.0.html @@ -1179,7 +1179,7 @@ } } - + - + - +
    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    State of the document

    The source-of-truth for the specification is the GitHub markdown file referenced above.

    OpenAPI Specification

    -

    Version 3.0.1

    +

    Version 3.0.1

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [[!rfc2119]] [[!rfc8174]] when, and only when, they appear in all capitals, as shown here.

    This document is licensed under The Apache License, Version 2.0.

    -

    Introduction

    +

    Introduction

    The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.

    An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.

    Definitions

    -

    OpenAPI Document

    +

    OpenAPI Document

    A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification.

    Path Templating

    Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters.

    @@ -31,7 +31,7 @@

    HTTP Status Codes

    The HTTP Status Codes are used to indicate the status of the executed operation. The available status codes are defined by [[!rfc7231]]section-6) and registered status codes are listed in the IANA Status Code Registry.

    -

    Specification

    +

    Specification

    Versions

    The OpenAPI Specification is versioned using Semantic Versioning 2.0.0 (semver) and follows the semver specification.

    The major.minor portion of the semver (for example 3.0) SHALL designate the OAS feature set. Typically, .patch versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between 3.0.0 and 3.0.1 for example.

    @@ -3195,7 +3195,7 @@ required: - packSize
    -

    Discriminator Object

    +

    Discriminator Object

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    When using the discriminator, inline schemas will not be considered.

    Fixed Fields

    @@ -3650,7 +3650,7 @@ <aliens>value</aliens> </aliens>
    -

    Security Scheme Object

    +

    Security Scheme Object

    Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [[!rfc6749]], and OpenID Connect Discovery.

    Fixed Fields

    @@ -3777,7 +3777,7 @@ write:pets: modify pets in your account read:pets: read your pets -

    OAuth Flows Object

    +

    OAuth Flows Object

    Allows configuration of the supported OAuth Flows.

    Fixed Fields

    @@ -3937,7 +3937,7 @@ - write:pets - read:pets -

    Specification Extensions

    +

    Specification Extensions

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    The extensions properties are implemented as patterned fields that are always prefixed by "x-".

    From e13a565728cea959b0dc9c312fdcf2ca24af324b Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Wed, 2 May 2018 11:51:22 +0100 Subject: [PATCH 16/34] md2html; fix another bikeshed toc bug --- md2html/md2html.js | 60 ++++++++---------- md2html/respec.html | 12 ++-- md2html/v3/3.0.1.bs | 12 ++-- md2html/v3/oas_3.0.1.html | 125 ++++++++++++++++++++------------------ 4 files changed, 103 insertions(+), 106 deletions(-) diff --git a/md2html/md2html.js b/md2html/md2html.js index 667bff7f74..c5d8ad4b39 100644 --- a/md2html/md2html.js +++ b/md2html/md2html.js @@ -136,7 +136,6 @@ let inCodeBlock = false; let bsFix = true; let indents = [0]; -let delta = 0; for (let l in lines) { let line = lines[l]; @@ -164,7 +163,7 @@ for (let l in lines) { let prevIndent = indents[indents.length-1]; // peek /* bikeshed is a bit of a pita when it comes to header nesting */ - delta = indent-prevIndent; + let delta = indent-prevIndent; if (!argv.respec) { if (delta===0) indent = lastIndent @@ -197,7 +196,14 @@ for (let l in lines) { } if (delta>0) indents.push(originalIndent); - if (delta<0) indents.pop(); + //if (delta<0) indents.pop(); + if (delta<0) { + let d = Math.abs(delta); + while (d>0) { + indents.pop(); + d--; + } + } lastIndent = indent; } @@ -226,46 +232,28 @@ for (let l in lines) { line = line.replace('[ABNF]','[Augmented Backus-Naur Form]'); } - if (!inCodeBlock && line.startsWith('#')) { + if (!inCodeBlock && argv.respec && line.startsWith('#')) { let heading = 0; while (line[heading] === '#') heading++; - //let delta = heading-prevHeading; - delta = heading-prevHeading; + let delta = heading-prevHeading; if (delta>0) delta = 1; - if (delta<0) delta = -1; + //if (delta<0) delta = -1; if (Math.abs(delta)>1) console.warn(delta,line); let prefix = ''; - /*let oIndent = indent; - if (!argv.respec && Math.abs(delta)>1) { - // if we're skipping more than one indent level up or down correct it - if (delta<0) { - indent = prevIndent-1; - prefix = '
    '; - } - if (delta>0) { - indent = prevIndent+1; - prefix = '
    '; - } - line = line.replace('#'.repeat(oIndent),'#'.repeat(indent)); + // heading level delta is either 0 or is +1/-1, or we're in respec mode + /* respec insists on
    ...
    breaks around headings */ + + if (delta === 0) { + prefix = '
    '; } - else { */ - // heading level delta is either 0 or is +1/-1, or we're in respec mode - /* respec insists on
    ...
    breaks around headings */ - - if (argv.respec) { - if (delta === 0) { - prefix = '
    '; - } - else if (delta > 0) { - prefix = '
    '.repeat(delta); - } - else { - prefix = '
    '+('
    ').repeat(Math.abs(delta))+'
    '; - } - } - prevHeading = heading; - /*}*/ + else if (delta > 0) { + prefix = '
    '.repeat(delta); + } + else { + prefix = '
    '+('
    ').repeat(Math.abs(delta))+'
    '; + } + prevHeading = heading; line = prefix+md.render(line); } diff --git a/md2html/respec.html b/md2html/respec.html index 0605105443..ea8b519752 100644 --- a/md2html/respec.html +++ b/md2html/respec.html @@ -3,7 +3,7 @@

    Version 3.0.1

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [[!rfc2119]] [[!rfc8174]] when, and only when, they appear in all capitals, as shown here.

    This document is licensed under The Apache License, Version 2.0.

    -

    Introduction

    +

    Introduction

    The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.

    An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.

    @@ -31,7 +31,7 @@

    HTTP Status Codes

    The HTTP Status Codes are used to indicate the status of the executed operation. The available status codes are defined by [[!rfc7231]]section-6) and registered status codes are listed in the IANA Status Code Registry.

    -

    Specification

    +

    Specification

    Versions

    The OpenAPI Specification is versioned using Semantic Versioning 2.0.0 (semver) and follows the semver specification.

    The major.minor portion of the semver (for example 3.0) SHALL designate the OAS feature set. Typically, .patch versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between 3.0.0 and 3.0.1 for example.

    @@ -3195,7 +3195,7 @@ required: - packSize -

    Discriminator Object

    +

    Discriminator Object

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    When using the discriminator, inline schemas will not be considered.

    Fixed Fields

    @@ -3650,7 +3650,7 @@ <aliens>value</aliens> </aliens> -

    Security Scheme Object

    +

    Security Scheme Object

    Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [[!rfc6749]], and OpenID Connect Discovery.

    Fixed Fields

    @@ -3777,7 +3777,7 @@ write:pets: modify pets in your account read:pets: read your pets -

    OAuth Flows Object

    +

    OAuth Flows Object

    Allows configuration of the supported OAuth Flows.

    Fixed Fields

    @@ -3937,7 +3937,7 @@ - write:pets - read:pets -

    Specification Extensions

    +

    Specification Extensions

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    The extensions properties are implemented as patterned fields that are always prefixed by "x-".

    diff --git a/md2html/v3/3.0.1.bs b/md2html/v3/3.0.1.bs index 616290326b..c9d4017233 100644 --- a/md2html/v3/3.0.1.bs +++ b/md2html/v3/3.0.1.bs @@ -3195,7 +3195,7 @@ The XML Object contains additional information about th required: -packSize -
    Discriminator Object
    +

    Discriminator Object

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    When using the discriminator, inline schemas will not be considered.

    Fixed Fields
    @@ -3650,7 +3650,7 @@ See examples for expected behavior.

    <aliens>value</aliens></aliens> -
    Security Scheme Object
    +

    Security Scheme Object

    Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [[!rfc6749]], and OpenID Connect Discovery.

    Fixed Fields
    @@ -3777,7 +3777,7 @@ Supported schemes are HTTP authentication, an API key (either as a header or as write:pets:modifypetsinyouraccount read:pets:readyourpets -
    OAuth Flows Object
    +

    OAuth Flows Object

    Allows configuration of the supported OAuth Flows.

    Fixed Fields
    @@ -3937,7 +3937,7 @@ This enables support for scenarios where multiple query parameters or HTTP heade - write:pets- read:pets -
    Specification Extensions
    +

    Specification Extensions

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    The extensions properties are implemented as patterned fields that are always prefixed by "x-".

    @@ -3957,7 +3957,7 @@ This enables support for scenarios where multiple query parameters or HTTP heade

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

    -

    Security Filtering

    +

    Security Filtering

    Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.

    The reasoning is to allow an additional layer of access control over the documentation. While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.

    @@ -3966,7 +3966,7 @@ While not part of the specification itself, certain libraries MAY choose to allo
  • The Paths Object MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication.
  • The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object, so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see.
  • -

    Appendix A: Revision History

    +

    Appendix A: Revision History

    diff --git a/md2html/v3/oas_3.0.1.html b/md2html/v3/oas_3.0.1.html index 95b6d16928..0f00f77fa4 100644 --- a/md2html/v3/oas_3.0.1.html +++ b/md2html/v3/oas_3.0.1.html @@ -1726,56 +1726,65 @@

    Table of Contents

  • 4.7.24.3.5 Models with Composition
  • 4.7.24.3.6 Models with Polymorphism Support -
  • 4.7.24.4 Discriminator Object -
  • 4.7.24.5 Fixed Fields
  • - 4.7.25 XML Object + 4.7.25 Discriminator Object
      -
    1. 4.7.25.1 Fixed Fields +
    2. 4.7.25.1 Fixed Fields +
    +
  • + 4.7.26 XML Object +
      +
    1. 4.7.26.1 Fixed Fields
    2. - 4.7.25.2 XML Object Examples + 4.7.26.2 XML Object Examples
        -
      1. 4.7.25.2.1 No XML Element -
      2. 4.7.25.2.2 XML Name Replacement -
      3. 4.7.25.2.3 XML Attribute, Prefix and Namespace -
      4. 4.7.25.2.4 XML Arrays +
      5. 4.7.26.2.1 No XML Element +
      6. 4.7.26.2.2 XML Name Replacement +
      7. 4.7.26.2.3 XML Attribute, Prefix and Namespace +
      8. 4.7.26.2.4 XML Arrays
      -
    3. 4.7.25.3 Security Scheme Object -
    4. 4.7.25.4 Fixed Fields +
    +
  • + 4.7.27 Security Scheme Object +
      +
    1. 4.7.27.1 Fixed Fields
    2. - 4.7.25.5 Security Scheme Object Example + 4.7.27.2 Security Scheme Object Example
        -
      1. 4.7.25.5.1 Basic Authentication Sample -
      2. 4.7.25.5.2 API Key Sample -
      3. 4.7.25.5.3 JWT Bearer Sample -
      4. 4.7.25.5.4 Implicit OAuth2 Sample +
      5. 4.7.27.2.1 Basic Authentication Sample +
      6. 4.7.27.2.2 API Key Sample +
      7. 4.7.27.2.3 JWT Bearer Sample +
      8. 4.7.27.2.4 Implicit OAuth2 Sample
      -
    3. 4.7.25.6 OAuth Flows Object -
    4. 4.7.25.7 Fixed Fields
  • - 4.7.26 OAuth Flow Object + 4.7.28 OAuth Flows Object +
      +
    1. 4.7.28.1 Fixed Fields +
    +
  • + 4.7.29 OAuth Flow Object
      -
    1. 4.7.26.1 Fixed Fields -
    2. 4.7.26.2 OAuth Flow Object Examples +
    3. 4.7.29.1 Fixed Fields +
    4. 4.7.29.2 OAuth Flow Object Examples
  • - 4.7.27 Security Requirement Object + 4.7.30 Security Requirement Object
      -
    1. 4.7.27.1 Patterned Fields +
    2. 4.7.30.1 Patterned Fields
    3. - 4.7.27.2 Security Requirement Object Examples + 4.7.30.2 Security Requirement Object Examples
        -
      1. 4.7.27.2.1 Non-OAuth2 Security Requirement -
      2. 4.7.27.2.2 OAuth2 Security Requirement +
      3. 4.7.30.2.1 Non-OAuth2 Security Requirement +
      4. 4.7.30.2.2 OAuth2 Security Requirement
      -
    4. 4.7.27.3 Specification Extensions
    -
  • 4.7.28 Security Filtering -
  • Appendix A: Revision History +
  • 4.8 Specification Extensions +
  • 4.9 Security Filtering +
  • Appendix A: Revision History
  • Conformance
  • Index @@ -4650,10 +4659,10 @@
    required: - packSize -
    4.7.24.4. Discriminator Object
    +

    4.7.25. Discriminator Object

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    When using the discriminator, inline schemas will not be considered.

    -
    4.7.24.5. Fixed Fields
    +
    4.7.25.1. Fixed Fields
  • @@ -4762,11 +4771,11 @@

    will map to Dog because of the definition in the mappings element.

    -

    4.7.25. XML Object

    +

    4.7.26. XML Object

    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.

    -
    4.7.25.1. Fixed Fields
    +
    4.7.26.1. Fixed Fields
    @@ -4796,9 +4805,9 @@
    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).

    This object MAY be extended with Specification Extensions.

    -
    4.7.25.2. XML Object Examples
    +
    4.7.26.2. XML Object Examples

    The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

    -
    4.7.25.2.1. No XML Element
    +
    4.7.26.2.1. No XML Element

    Basic string property:

    {
         "animals": {
    @@ -4830,7 +4839,7 @@ 
    <animals>...</animals> <animals>...</animals>
    -
    4.7.25.2.2. XML Name Replacement
    +
    4.7.26.2.2. XML Name Replacement
    {
       "animals": {
         "type": "string",
    @@ -4847,7 +4856,7 @@ 
    <animal>...</animal>
     
    -
    4.7.25.2.3. XML Attribute, Prefix and Namespace
    +
    4.7.26.2.3. XML Attribute, Prefix and Namespace

    In this example, a full model definition is shown.

    {
       "Person": {
    @@ -4889,7 +4898,7 @@ 
    <sample:name xmlns:sample="http://example.com/schema/sample">example</sample:name> </Person>
    -
    4.7.25.2.4. XML Arrays
    +
    4.7.26.2.4. XML Arrays

    Changing the element names:

    {
       "animals": {
    @@ -5055,10 +5064,10 @@ 
    <aliens>value</aliens> </aliens>
    -
    4.7.25.3. Security Scheme Object
    +

    4.7.27. Security Scheme Object

    Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [rfc6749], and OpenID Connect Discovery.

    -
    4.7.25.4. Fixed Fields
    +
    4.7.27.1. Fixed Fields
    @@ -5109,8 +5118,8 @@
    REQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL.

    This object MAY be extended with Specification Extensions.

    -
    4.7.25.5. Security Scheme Object Example
    -
    4.7.25.5.1. Basic Authentication Sample
    +
    4.7.27.2. Security Scheme Object Example
    +
    4.7.27.2.1. Basic Authentication Sample
    {
       "type": "http",
       "scheme": "basic"
    @@ -5119,7 +5128,7 @@ 
    type: http scheme: basic
    -
    4.7.25.5.2. API Key Sample
    +
    4.7.27.2.2. API Key Sample
    {
       "type": "apiKey",
       "name": "api_key",
    @@ -5130,7 +5139,7 @@ 
    name: api_key in: header
    -
    4.7.25.5.3. JWT Bearer Sample
    +
    4.7.27.2.3. JWT Bearer Sample
    {
       "type": "http",
       "scheme": "bearer",
    @@ -5141,7 +5150,7 @@ 
    scheme: bearer bearerFormat: JWT
    -
    4.7.25.5.4. Implicit OAuth2 Sample
    +
    4.7.27.2.4. Implicit OAuth2 Sample
    {
       "type": "oauth2",
       "flows": {
    @@ -5163,9 +5172,9 @@ 
    write:pets: modify pets in your account read:pets: read your pets
    -
    4.7.25.6. OAuth Flows Object
    +

    4.7.28. OAuth Flows Object

    Allows configuration of the supported OAuth Flows.

    -
    4.7.25.7. Fixed Fields
    +
    4.7.28.1. Fixed Fields
    @@ -5191,9 +5200,9 @@
    Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.

    This object MAY be extended with Specification Extensions.

    -

    4.7.26. OAuth Flow Object

    +

    4.7.29. OAuth Flow Object

    Configuration details for a supported OAuth Flow

    -
    4.7.26.1. Fixed Fields
    +
    4.7.29.1. Fixed Fields
    @@ -5224,7 +5233,7 @@
    REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it.

    This object MAY be extended with Specification Extensions.

    -
    4.7.26.2. OAuth Flow Object Examples
    +
    4.7.29.2. OAuth Flow Object Examples
    {
       "type": "oauth2",
       "flows": {
    @@ -5260,13 +5269,13 @@ 
    write:pets: modify pets in your account read:pets: read your pets
    -

    4.7.27. Security Requirement Object

    +

    4.7.30. Security Requirement Object

    Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.

    Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.

    When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.

    -
    4.7.27.1. Patterned Fields
    +
    4.7.30.1. Patterned Fields
    @@ -5279,15 +5288,15 @@
    [string]
    Each name MUST correspond to a security scheme which is declared in the Security Schemes under the Components Object. If the security scheme is of type "oauth2" or "openIdConnect", then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty.
    -
    4.7.27.2. Security Requirement Object Examples
    -
    4.7.27.2.1. Non-OAuth2 Security Requirement
    +
    4.7.30.2. Security Requirement Object Examples
    +
    4.7.30.2.1. Non-OAuth2 Security Requirement
    {
       "api_key": []
     }
     
    api_key: []
     
    -
    4.7.27.2.2. OAuth2 Security Requirement
    +
    4.7.30.2.2. OAuth2 Security Requirement
    {
       "petstore_auth": [
         "write:pets",
    @@ -5299,7 +5308,7 @@ 
    - write:pets - read:pets
    -
    4.7.27.3. Specification Extensions
    +

    4.8. Specification Extensions

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    The extensions properties are implemented as patterned fields that are always prefixed by "x-".

    @@ -5315,7 +5324,7 @@
    Allows extensions to the OpenAPI Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. 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).

    -

    4.7.28. Security Filtering

    +

    4.9. Security Filtering

    Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.

    The reasoning is to allow an additional layer of access control over the documentation. While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.

    @@ -5324,7 +5333,7 @@

    The Paths Object MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication.
  • The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object, so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see. -

    Appendix A: Revision History

    +

    Appendix A: Revision History

    From 252d0d73f85cdfd2fc12e5ccce817ad9f195da3d Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Fri, 18 May 2018 10:06:28 +0100 Subject: [PATCH 17/34] respec; former editor support - needs ReSpec 20.x --- md2html/md2html.js | 8 +++++++- md2html/respec.html | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/md2html/md2html.js b/md2html/md2html.js index c5d8ad4b39..815caa983e 100644 --- a/md2html/md2html.js +++ b/md2html/md2html.js @@ -26,6 +26,7 @@ let argv = require('yargs') .require(1) .argv; let maintainers = []; +let emeritus = []; const md = require('markdown-it')({ html: true, @@ -48,6 +49,7 @@ function preface(title,options) { const respec = { specStatus: "base", editors: maintainers, + formerEditors: emeritus, publishDate: options.publishDate, subtitle: 'Version '+options.subtitle, processVersion: 2017, @@ -102,6 +104,11 @@ function doMaintainers() { let t = $(this).text().split('@')[0]; maintainers.push({name:t}); }); + u = $('ul').eq(1); + $(u).children('li').each(function(e){ + let t = $(this).text().split('@')[0]; + emeritus.push({name:t}); + }); } function getPublishDate(m) { @@ -196,7 +203,6 @@ for (let l in lines) { } if (delta>0) indents.push(originalIndent); - //if (delta<0) indents.pop(); if (delta<0) { let d = Math.abs(delta); while (d>0) { diff --git a/md2html/respec.html b/md2html/respec.html index ea8b519752..975f7cfc75 100644 --- a/md2html/respec.html +++ b/md2html/respec.html @@ -1,4 +1,4 @@ -OpenAPI Specification
    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    State of the document

    The source-of-truth for the specification is the GitHub markdown file referenced above.
    +OpenAPI Specification
    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    State of the document

    The source-of-truth for the specification is the GitHub markdown file referenced above.

    OpenAPI Specification

    Version 3.0.1

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [[!rfc2119]] [[!rfc8174]] when, and only when, they appear in all capitals, as shown here.

    From b184453b862ac6ed03932f21d19abd9388328437 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 12 Jun 2018 08:54:25 +0100 Subject: [PATCH 18/34] Latest respec tweaks --- md2html/md2html.js | 12 +++--- md2html/respec.html | 90 ++++++++++++++++++++++----------------------- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/md2html/md2html.js b/md2html/md2html.js index 815caa983e..7b01014aaa 100644 --- a/md2html/md2html.js +++ b/md2html/md2html.js @@ -53,15 +53,15 @@ function preface(title,options) { publishDate: options.publishDate, subtitle: 'Version '+options.subtitle, processVersion: 2017, - edDraftURI: "http://github.com/OAI/openapi-specification", + edDraftURI: "http://github.com/OAI/openapi-specification/", github: { - repoURL: "https://github.com/OAI/openapi-specification", + repoURL: "https://github.com/OAI/openapi-specification/", branch: "master" }, - shortName: "dahut", + shortName: "OAS", noTOC: false, lint: false, - additionalCopyrightHolders: "Copyright the Linux Foundation", + additionalCopyrightHolders: "the Linux Foundation", includePermalinks: true }; @@ -85,7 +85,7 @@ function preface(title,options) { preface += 'The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.'; preface += '
    '; preface += '
    '; - preface += '

    State of the document

    '; + preface += '

    Status of This Document

    '; preface += 'The source-of-truth for the specification is the GitHub markdown file referenced above.'; preface += '
    '; } @@ -194,7 +194,7 @@ for (let l in lines) { let title = comp[1]; if (inDefs) title = ''+title+''; let link = comp[0].split(''); + line = ('#'.repeat(newIndent)+' '); } else { let title = line.split('# ')[1]; diff --git a/md2html/respec.html b/md2html/respec.html index 975f7cfc75..f09e0fe5f8 100644 --- a/md2html/respec.html +++ b/md2html/respec.html @@ -1,4 +1,4 @@ -OpenAPI Specification
    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    State of the document

    The source-of-truth for the specification is the GitHub markdown file referenced above.
    +OpenAPI Specification
    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    State of This Document

    The source-of-truth for the specification is the GitHub markdown file referenced above.

    OpenAPI Specification

    Version 3.0.1

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [[!rfc2119]] [[!rfc8174]] when, and only when, they appear in all capitals, as shown here.

    @@ -8,11 +8,11 @@

    An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.

    Definitions

    -

    OpenAPI Document

    +

    OpenAPI Document

    A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification.

    -

    Path Templating

    +

    Path Templating

    Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters.

    -

    Media Types

    +

    Media Types

    Media type definitions are spread across several resources. The media type definitions SHOULD be in compliance with [[!rfc6838]].

    Some examples of possible media type definitions:

    @@ -28,7 +28,7 @@ application/vnd.github.v3.diff application/vnd.github.v3.patch -

    HTTP Status Codes

    +

    HTTP Status Codes

    The HTTP Status Codes are used to indicate the status of the executed operation. The available status codes are defined by [[!rfc7231]]section-6) and registered status codes are listed in the IANA Status Code Registry.

    Specification

    @@ -54,10 +54,10 @@
  • Keys used in YAML maps MUST be limited to a scalar string, as defined by the YAML Failsafe schema ruleset.
  • Note: While APIs may be defined by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML.

    -

    Document Structure

    +

    Document Structure

    An OpenAPI document MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the user. In the latter case, $ref fields MUST be used in the specification to reference those parts as follows from the JSON Schema definitions.

    It is RECOMMENDED that the root OpenAPI document be named: openapi.json or openapi.yaml.

    -

    Data Types

    +

    Data Types

    Primitive data types in the OAS are based on the types supported by the JSON Schema Specification Wright Draft 00. Note that integer as a type is also supported and is defined as a JSON number without a fraction or exponent part. null is not supported as a type (see nullable for an alternative solution). @@ -146,16 +146,16 @@

    -
  • Rich Text Formatting

    +

    Rich Text Formatting

    Throughout the specification description fields are noted as supporting CommonMark markdown formatting. Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by CommonMark 0.27. Tooling MAY choose to ignore some CommonMark features to address security concerns.

    -

    Relative References in URLs

    +

    Relative References in URLs

    Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [[!rfc3986]]section-4.2). Relative references are resolved using the URLs defined in the Server Object as a Base URI.

    Relative references used in $ref are processed as per JSON Reference, using the URL of the current document as the base URI. See also the Reference Object.

    Schema

    In the following description, if a field is not explicitly REQUIRED or described with a MUST or SHALL, it can be considered OPTIONAL.

    -

    OpenAPI Object

    +

    OpenAPI Object

    This is the root document object of the OpenAPI document.

    Fixed Fields

    @@ -210,7 +210,7 @@

    This object MAY be extended with Specification Extensions.

    -

    Info Object

    +

    Info Object

    The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.

    Fixed Fields

    @@ -287,7 +287,7 @@ url: https://www.apache.org/licenses/LICENSE-2.0.html version: 1.0.1
    -

    Contact Object

    +

    Contact Object

    Contact information for the exposed API.

    Fixed Fields

    @@ -330,7 +330,7 @@ url: http://www.example.com/support email: support@example.com -

    License Object

    +

    License Object

    License information for the exposed API.

    Fixed Fields

    @@ -366,7 +366,7 @@ name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0.html -

    Server Object

    +

    Server Object

    An object representing a Server.

    Fixed Fields

    @@ -481,7 +481,7 @@ # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2` default: v2 -

    Server Variable Object

    +

    Server Variable Object

    An object representing a Server Variable for server URL template substitution.

    Fixed Fields

    @@ -511,7 +511,7 @@

    This object MAY be extended with Specification Extensions.

    -

    Components Object

    +

    Components Object

    Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.

    Fixed Fields

    @@ -732,7 +732,7 @@ write:pets: modify pets in your account read:pets: read your pets
    -

    Paths Object

    +

    Paths Object

    Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.

    Patterned Fields

    @@ -808,7 +808,7 @@ items: $ref: '#/components/schemas/pet' -

    Path Item Object

    +

    Path Item Object

    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.

    @@ -971,7 +971,7 @@ items: type: string -

    Operation Object

    +

    Operation Object

    Describes a single API operation on a path.

    Fixed Fields

    @@ -1152,7 +1152,7 @@ - write:pets - read:pets -

    External Documentation Object

    +

    External Documentation Object

    Allows referencing an external resource for extended documentation.

    Fixed Fields

    @@ -1188,7 +1188,7 @@ description: Find more info here url: https://example.com -

    Parameter Object

    +

    Parameter Object

    Describes a single operation parameter.

    A unique parameter is defined by a combination of a name and location.

    Parameter Locations

    @@ -1614,7 +1614,7 @@ long: type: number -

    Request Body Object

    +

    Request Body Object

    Describes a single request body.

    Fixed Fields

    @@ -1745,7 +1745,7 @@ items: type: string -

    Media Type Object

    +

    Media Type Object

    Each Media Type Object provides schema and examples for the media type identified by its key.

    Fixed Fields

    @@ -1955,7 +1955,7 @@ type: '#/components/schemas/Address'

    An encoding attribute is introduced to give you control over the serialization of parts of multipart request bodies. This attribute is only applicable to multipart and application/x-www-form-urlencoded request bodies.

    -

    Encoding Object

    +

    Encoding Object

    A single encoding definition applied to a single schema property.

    Fixed Fields

    @@ -2033,7 +2033,7 @@ schema: type: integer -

    Responses Object

    +

    Responses Object

    A container for the expected responses of an operation. The container maps a HTTP response code to the expected response.

    The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. @@ -2117,7 +2117,7 @@ schema: $ref: '#/components/schemas/ErrorModel' -

    Response Object

    +

    Response Object

    Describes a single response from an API Operation, including design-time, static links to operations based on the response.

    Fixed Fields

    @@ -2263,7 +2263,7 @@
    
     description: object created
     
    -

    Callback Object

    +

    Callback Object

    A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

    @@ -2368,7 +2368,7 @@ '200': description: webhook successfully processed and no retries will be performed -

    Example Object

    +

    Example Object

    Fixed Fields

    @@ -2464,7 +2464,7 @@ confirmation-success: $ref: '#/components/examples/confirmation-success' -

    Link Object

    +

    Link Object

    The Link object represents a possible design-time link for a response. The presence of a link does not guarantee the caller’s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.

    Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.

    @@ -2598,7 +2598,7 @@

    Note that in the use of operationRef, the escaped forward-slash is necessary when using JSON references.

    -

    Runtime Expressions

    +

    Runtime Expressions

    Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. This mechanism is used by Link Objects and Callback Objects.

    The runtime expression is defined by the following [Augmented Backus-Naur Form] syntax

    @@ -2616,7 +2616,7 @@

    The name identifier is case-sensitive, whereas token is not.

    The table below provides examples of runtime expressions and examples of their use in a value:

    -

    Examples

    +

    Examples

    @@ -2665,7 +2665,7 @@

    Runtime expressions preserve the type of the referenced value. Expressions can be embedded into string values by surrounding the expression with {} curly braces.

    -

    Header Object

    +

    Header Object

    The Header Object follows the structure of the Parameter Object with the following changes:

    1. name MUST NOT be specified, it is given in the corresponding headers map.
    2. @@ -2687,7 +2687,7 @@ schema: type: integer -

    Tag Object

    +

    Tag Object

    Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

    Fixed Fields

    @@ -2729,7 +2729,7 @@ name: pet description: Pets operations -

    Reference Object

    +

    Reference Object

    A simple object to allow referencing other components in the specification, internally and externally.

    The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.

    For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.

    @@ -2778,7 +2778,7 @@
    
     $ref: definitions.yaml#/Pet
     
    -

    Schema Object

    +

    Schema Object

    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 an extended subset of the JSON Schema Specification Wright Draft 00.

    @@ -2874,7 +2874,7 @@

    This object MAY be extended with Specification Extensions.

    -
    Composition and Inheritance (Polymorphism)
    +
    Composition and Inheritance (Polymorphism)

    The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. allOf takes an array of object definitions that are validated independently but together compose a single object.

    While composition offers model extensibility, it does not imply a hierarchy between the models. @@ -3195,7 +3195,7 @@ required: - packSize -

    Discriminator Object

    +

    Discriminator Object

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    When using the discriminator, inline schemas will not be considered.

    Fixed Fields

    @@ -3319,7 +3319,7 @@ }

    will map to Dog because of the definition in the mappings element.

    -

    XML Object

    +

    XML Object

    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.

    @@ -3650,7 +3650,7 @@ <aliens>value</aliens> </aliens> -

    Security Scheme Object

    +

    Security Scheme Object

    Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [[!rfc6749]], and OpenID Connect Discovery.

    Fixed Fields

    @@ -3777,7 +3777,7 @@ write:pets: modify pets in your account read:pets: read your pets -

    OAuth Flows Object

    +

    OAuth Flows Object

    Allows configuration of the supported OAuth Flows.

    Fixed Fields

    @@ -3812,7 +3812,7 @@

    This object MAY be extended with Specification Extensions.

    -

    OAuth Flow Object

    +

    OAuth Flow Object

    Configuration details for a supported OAuth Flow

    Fixed Fields

    @@ -3890,7 +3890,7 @@ write:pets: modify pets in your account read:pets: read your pets -

    Security Requirement Object

    +

    Security Requirement Object

    Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.

    Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. @@ -3937,7 +3937,7 @@ - write:pets - read:pets -

    Specification Extensions

    +

    Specification Extensions

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    The extensions properties are implemented as patterned fields that are always prefixed by "x-".

    @@ -3957,7 +3957,7 @@

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

    -

    Security Filtering

    +

    Security Filtering

    Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.

    The reasoning is to allow an additional layer of access control over the documentation. While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.

    @@ -3966,7 +3966,7 @@
  • The Paths Object MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication.
  • The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object, so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see.
  • -

    Appendix A: Revision History

    +

    Appendix A: Revision History

    From 07f16b703e0e05cf0205a9e52057cba0bf4837d8 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 12 Jun 2018 23:38:11 +0100 Subject: [PATCH 19/34] pre block css background, RFC ref fixes --- md2html/md2html.js | 44 +- md2html/respec.html | 3048 +++++++++++++++++++++---------------------- 2 files changed, 1554 insertions(+), 1538 deletions(-) diff --git a/md2html/md2html.js b/md2html/md2html.js index 7b01014aaa..e89e6d95bd 100644 --- a/md2html/md2html.js +++ b/md2html/md2html.js @@ -33,7 +33,7 @@ const md = require('markdown-it')({ linkify: true, typographer: true, highlight: function (str, lang) { - if (lang && hljs.getLanguage(lang) && !argv.respec) { + if (lang && hljs.getLanguage(lang)) { // && !argv.respec) { try { return '
    ' +
                       hljs.highlight(lang, str, true).value +
    @@ -41,7 +41,7 @@ const md = require('markdown-it')({
               } catch (__) { }
           }
     
    -      return '
    ' + md.utils.escapeHtml(str) + '
    '; + return '
    ' + md.utils.escapeHtml(str) + '
    '; } }); @@ -80,6 +80,7 @@ function preface(title,options) { preface += 'table th, table td { padding: 6px 13px; border: 1px solid #dfe2e5; }'; preface += 'table tr { background-color: #fff; border-top: 1px solid #c6cbd1; }'; preface += 'table tr:nth-child(2n) { background-color: #f6f8fa; }'; + preface += 'pre { background-color: #f6f8fa !important; }'; preface += ''; preface += '
    '; preface += 'The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.'; @@ -218,20 +219,35 @@ for (let l in lines) { line = line.replace('">','"> '); } - if (line.indexOf('[RFC')>=0) { - line = line.replace(/\[RFC ?([0-9]{1,5})\]/g,function(match,group1){ - console.warn('Fixing RFC reference',match,group1); - return '[[!rfc'+group1+']]'; - }); - } - line = line.split('\\|').join('¦'); - while (line.indexOf('https://tools.ietf.org/html/rfc')>=0) { - line = line.replace(/.https:..tools.ietf.org.html.rfc[0-9]{1,5}./g,''); - } - while (line.indexOf('http://tools.ietf.org/html/rfc')>=0) { - line = line.replace(/.http:..tools.ietf.org.html.rfc[0-9]{1,5}./g,''); + if (!inCodeBlock) { + if (line.indexOf('RFC [')>=0) { + line = line.replace('RFC [','[RFC'); + } + + line = line.replace('[Authorization header as defined in ','Authorization header as defined in ['); + + if (line.indexOf('[RFC')>=0) { + line = line.replace(/\[RFC ?([0-9]{1,5})\]/g,function(match,group1){ + console.warn('Fixing RFC reference',match,group1); + return '[[!RFC'+group1+']]'; + }); + } + + line = line.replace('http://tools.ietf.org','https://tools.ietf.org'); + if (line.indexOf('xml2rfc.ietf.org')>0) { + line = line.replace('https://xml2rfc.ietf.org/public/rfc/html/rfc','https://tools.ietf.org/html/rfc'); + line = line.replace('.html',''); + } + line = line.replace(/\]\]\(https:\/\/tools.ietf.org\/html\/rfc[0-9]{1,5}\/?(\#.*?)?\)/g,function(match,group1){ + //return (group1 ? group1 : '')+']]'; + return ']]'; + }); + + while (line.indexOf('https://tools.ietf.org/html/rfc')>=0) { + line = line.replace(/.https:..tools.ietf.org.html.rfc[0-9]{1,5}./g,''); + } } if (line.indexOf('[ABNF]')>=0) { diff --git a/md2html/respec.html b/md2html/respec.html index f09e0fe5f8..9e5daf5bb3 100644 --- a/md2html/respec.html +++ b/md2html/respec.html @@ -1,7 +1,7 @@ -OpenAPI Specification
    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    State of This Document

    The source-of-truth for the specification is the GitHub markdown file referenced above.
    +OpenAPI Specification
    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    Status of This Document

    The source-of-truth for the specification is the GitHub markdown file referenced above.

    OpenAPI Specification

    Version 3.0.1

    -

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [[!rfc2119]] [[!rfc8174]] when, and only when, they appear in all capitals, as shown here.

    +

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [[!RFC2119]] [[!RFC8174]] when, and only when, they appear in all capitals, as shown here.

    This document is licensed under The Apache License, Version 2.0.

    Introduction

    The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.

    @@ -14,9 +14,9 @@

    Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters.

    Media Types

    Media type definitions are spread across several resources. -The media type definitions SHOULD be in compliance with [[!rfc6838]].

    +The media type definitions SHOULD be in compliance with [[!RFC6838]].

    Some examples of possible media type definitions:

    -
    
    +
    
       text/plain; charset=utf-8
       application/json
       application/vnd.github+json
    @@ -30,7 +30,7 @@
     

    HTTP Status Codes

    The HTTP Status Codes are used to indicate the status of the executed operation. -The available status codes are defined by [[!rfc7231]]section-6) and registered status codes are listed in the IANA Status Code Registry.

    +The available status codes are defined by [[!RFC7231]] and registered status codes are listed in the IANA Status Code Registry.

    Specification

    Versions

    The OpenAPI Specification is versioned using Semantic Versioning 2.0.0 (semver) and follows the semver specification.

    @@ -40,9 +40,9 @@

    Format

    An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format.

    For example, if a field has an array value, the JSON array representation will be used:

    -
    
    +
    
     {
    -   "field": [ 1, 2, 3 ]
    +   "field": [ 1, 2, 3 ]
     }
     

    All field names in the specification are case sensitive.

    @@ -130,13 +130,13 @@
    - + - + @@ -150,7 +150,7 @@

    Throughout the specification description fields are noted as supporting CommonMark markdown formatting. Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by CommonMark 0.27. Tooling MAY choose to ignore some CommonMark features to address security concerns.

    Relative References in URLs

    -

    Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [[!rfc3986]]section-4.2). +

    Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [[!RFC3986]]. Relative references are resolved using the URLs defined in the Server Object as a Base URI.

    Relative references used in $ref are processed as per JSON Reference, using the URL of the current document as the base URI. See also the Reference Object.

    Schema

    @@ -257,35 +257,35 @@
    date string dateAs defined by full-date - [!rfc3339]As defined by full-date - [[!RFC3339]]
    dateTime string date-timeAs defined by date-time - [!rfc3339]As defined by date-time - [[!RFC3339]]
    password

    This object MAY be extended with Specification Extensions.

    Info Object Example:

    -
    
    +
    
     {
    -  "title": "Sample Pet Store App",
    -  "description": "This is a sample server for a pet store.",
    -  "termsOfService": "http://example.com/terms/",
    -  "contact": {
    -    "name": "API Support",
    -    "url": "http://www.example.com/support",
    -    "email": "support@example.com"
    +  "title": "Sample Pet Store App",
    +  "description": "This is a sample server for a pet store.",
    +  "termsOfService": "http://example.com/terms/",
    +  "contact": {
    +    "name": "API Support",
    +    "url": "http://www.example.com/support",
    +    "email": "support@example.com"
       },
    -  "license": {
    -    "name": "Apache 2.0",
    -    "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    +  "license": {
    +    "name": "Apache 2.0",
    +    "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
       },
    -  "version": "1.0.1"
    +  "version": "1.0.1"
     }
     
    -
    
    -title: Sample Pet Store App
    -description: This is a sample server for a pet store.
    -termsOfService: http://example.com/terms/
    -contact:
    -  name: API Support
    -  url: http://www.example.com/support
    -  email: support@example.com
    -license:
    -  name: Apache 2.0
    -  url: https://www.apache.org/licenses/LICENSE-2.0.html
    -version: 1.0.1
    +
    
    +title: Sample Pet Store App
    +description: This is a sample server for a pet store.
    +termsOfService: http://example.com/terms/
    +contact:
    +  name: API Support
    +  url: http://www.example.com/support
    +  email: support@example.com
    +license:
    +  name: Apache 2.0
    +  url: https://www.apache.org/licenses/LICENSE-2.0.html
    +version: 1.0.1
     

    Contact Object

    Contact information for the exposed API.

    @@ -318,17 +318,17 @@

    This object MAY be extended with Specification Extensions.

    Contact Object Example:

    -
    
    +
    
     {
    -  "name": "API Support",
    -  "url": "http://www.example.com/support",
    -  "email": "support@example.com"
    +  "name": "API Support",
    +  "url": "http://www.example.com/support",
    +  "email": "support@example.com"
     }
     
    -
    
    -name: API Support
    -url: http://www.example.com/support
    -email: support@example.com
    +
    
    +name: API Support
    +url: http://www.example.com/support
    +email: support@example.com
     

    License Object

    License information for the exposed API.

    @@ -356,15 +356,15 @@

    This object MAY be extended with Specification Extensions.

    License Object Example:

    -
    
    +
    
     {
    -  "name": "Apache 2.0",
    -  "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    +  "name": "Apache 2.0",
    +  "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
     }
     
    -
    
    -name: Apache 2.0
    -url: https://www.apache.org/licenses/LICENSE-2.0.html
    +
    
    +name: Apache 2.0
    +url: https://www.apache.org/licenses/LICENSE-2.0.html
     

    Server Object

    An object representing a Server.

    @@ -398,88 +398,88 @@

    This object MAY be extended with Specification Extensions.

    Server Object Example

    A single server would be described as:

    -
    
    +
    
     {
    -  "url": "https://development.gigantic-server.com/v1",
    -  "description": "Development server"
    +  "url": "https://development.gigantic-server.com/v1",
    +  "description": "Development server"
     }
     
    -
    
    -url: https://development.gigantic-server.com/v1
    -description: Development server
    +
    
    +url: https://development.gigantic-server.com/v1
    +description: Development server
     

    The following shows how multiple servers can be described, for example, at the OpenAPI Object’s servers:

    -
    
    +
    
     {
    -  "servers": [
    +  "servers": [
         {
    -      "url": "https://development.gigantic-server.com/v1",
    -      "description": "Development server"
    +      "url": "https://development.gigantic-server.com/v1",
    +      "description": "Development server"
         },
         {
    -      "url": "https://staging.gigantic-server.com/v1",
    -      "description": "Staging server"
    +      "url": "https://staging.gigantic-server.com/v1",
    +      "description": "Staging server"
         },
         {
    -      "url": "https://api.gigantic-server.com/v1",
    -      "description": "Production server"
    +      "url": "https://api.gigantic-server.com/v1",
    +      "description": "Production server"
         }
       ]
     }
     
    -
    
    -servers:
    -- url: https://development.gigantic-server.com/v1
    -  description: Development server
    -- url: https://staging.gigantic-server.com/v1
    -  description: Staging server
    -- url: https://api.gigantic-server.com/v1
    -  description: Production server
    +
    
    +servers:
    +- url: https://development.gigantic-server.com/v1
    +  description: Development server
    +- url: https://staging.gigantic-server.com/v1
    +  description: Staging server
    +- url: https://api.gigantic-server.com/v1
    +  description: Production server
     

    The following shows how variables can be used for a server configuration:

    -
    
    +
    
     {
    -  "servers": [
    +  "servers": [
         {
    -      "url": "https://{username}.gigantic-server.com:{port}/{basePath}",
    -      "description": "The production API server",
    -      "variables": {
    -        "username": {
    -          "default": "demo",
    -          "description": "this value is assigned by the service provider, in this example `gigantic-server.com`"
    +      "url": "https://{username}.gigantic-server.com:{port}/{basePath}",
    +      "description": "The production API server",
    +      "variables": {
    +        "username": {
    +          "default": "demo",
    +          "description": "this value is assigned by the service provider, in this example `gigantic-server.com`"
             },
    -        "port": {
    -          "enum": [
    -            "8443",
    -            "443"
    +        "port": {
    +          "enum": [
    +            "8443",
    +            "443"
               ],
    -          "default": "8443"
    +          "default": "8443"
             },
    -        "basePath": {
    -          "default": "v2"
    +        "basePath": {
    +          "default": "v2"
             }
           }
         }
       ]
     }
     
    -
    
    -servers:
    -- url: https://{username}.gigantic-server.com:{port}/{basePath}
    -  description: The production API server
    -  variables:
    -    username:
    -      # note! no enum here means it is an open value
    -      default: demo
    -      description: this value is assigned by the service provider, in this example `gigantic-server.com`
    -    port:
    -      enum:
    -        - '8443'
    -        - '443'
    -      default: '8443'
    -    basePath:
    -      # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2`
    -      default: v2
    +
    
    +servers:
    +- url: https://{username}.gigantic-server.com:{port}/{basePath}
    +  description: The production API server
    +  variables:
    +    username:
    +      # note! no enum here means it is an open value
    +      default: demo
    +      description: this value is assigned by the service provider, in this example `gigantic-server.com`
    +    port:
    +      enum:
    +        - '8443'
    +        - '443'
    +      default: '8443'
    +    basePath:
    +      # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2`
    +      default: v2
     

    Server Variable Object

    An object representing a Server Variable for server URL template substitution.

    @@ -574,7 +574,7 @@

    This object MAY be extended with Specification Extensions.

    All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9\.\-_]+$.

    Field Name Examples:

    -
    
    +
    
     User
     User_1
     User_Name
    @@ -582,88 +582,88 @@
     my.org.User
     

    Components Object Example

    -
    
    -"components": {
    -  "schemas": {
    -    "Category": {
    -      "type": "object",
    -      "properties": {
    -        "id": {
    -          "type": "integer",
    -          "format": "int64"
    +
    
    +"components": {
    +  "schemas": {
    +    "Category": {
    +      "type": "object",
    +      "properties": {
    +        "id": {
    +          "type": "integer",
    +          "format": "int64"
             },
    -        "name": {
    -          "type": "string"
    +        "name": {
    +          "type": "string"
             }
           }
         },
    -    "Tag": {
    -      "type": "object",
    -      "properties": {
    -        "id": {
    -          "type": "integer",
    -          "format": "int64"
    +    "Tag": {
    +      "type": "object",
    +      "properties": {
    +        "id": {
    +          "type": "integer",
    +          "format": "int64"
             },
    -        "name": {
    -          "type": "string"
    +        "name": {
    +          "type": "string"
             }
           }
         }
       },
    -  "parameters": {
    -    "skipParam": {
    -      "name": "skip",
    -      "in": "query",
    -      "description": "number of items to skip",
    -      "required": true,
    -      "schema": {
    -        "type": "integer",
    -        "format": "int32"
    +  "parameters": {
    +    "skipParam": {
    +      "name": "skip",
    +      "in": "query",
    +      "description": "number of items to skip",
    +      "required": true,
    +      "schema": {
    +        "type": "integer",
    +        "format": "int32"
           }
         },
    -    "limitParam": {
    -      "name": "limit",
    -      "in": "query",
    -      "description": "max records to return",
    -      "required": true,
    -      "schema" : {
    -        "type": "integer",
    -        "format": "int32"
    +    "limitParam": {
    +      "name": "limit",
    +      "in": "query",
    +      "description": "max records to return",
    +      "required": true,
    +      "schema" : {
    +        "type": "integer",
    +        "format": "int32"
           }
         }
       },
    -  "responses": {
    -    "NotFound": {
    -      "description": "Entity not found."
    +  "responses": {
    +    "NotFound": {
    +      "description": "Entity not found."
         },
    -    "IllegalInput": {
    -      "description": "Illegal input for operation."
    +    "IllegalInput": {
    +      "description": "Illegal input for operation."
         },
    -    "GeneralError": {
    -      "description": "General Error",
    -      "content": {
    -        "application/json": {
    -          "schema": {
    -            "$ref": "#/components/schemas/GeneralError"
    +    "GeneralError": {
    +      "description": "General Error",
    +      "content": {
    +        "application/json": {
    +          "schema": {
    +            "$ref": "#/components/schemas/GeneralError"
               }
             }
           }
         }
       },
    -  "securitySchemes": {
    -    "api_key": {
    -      "type": "apiKey",
    -      "name": "api_key",
    -      "in": "header"
    +  "securitySchemes": {
    +    "api_key": {
    +      "type": "apiKey",
    +      "name": "api_key",
    +      "in": "header"
         },
    -    "petstore_auth": {
    -      "type": "oauth2",
    -      "flows": {
    -        "implicit": {
    -          "authorizationUrl": "http://example.org/api/oauth/dialog",
    -          "scopes": {
    -            "write:pets": "modify pets in your account",
    -            "read:pets": "read your pets"
    +    "petstore_auth": {
    +      "type": "oauth2",
    +      "flows": {
    +        "implicit": {
    +          "authorizationUrl": "http://example.org/api/oauth/dialog",
    +          "scopes": {
    +            "write:pets": "modify pets in your account",
    +            "read:pets": "read your pets"
               }
             }
           }
    @@ -671,66 +671,66 @@
       }
     }
     
    -
    
    -components:
    -  schemas:
    -    Category:
    -      type: object
    -      properties:
    -        id:
    -          type: integer
    -          format: int64
    -        name:
    -          type: string
    -    Tag:
    -      type: object
    -      properties:
    -        id:
    -          type: integer
    -          format: int64
    -        name:
    -          type: string
    -  parameters:
    -    skipParam:
    -      name: skip
    -      in: query
    -      description: number of items to skip
    -      required: true
    -      schema:
    -        type: integer
    -        format: int32
    -    limitParam:
    -      name: limit
    -      in: query
    -      description: max records to return
    -      required: true
    -      schema:
    -        type: integer
    -        format: int32
    -  responses:
    -    NotFound:
    -      description: Entity not found.
    -    IllegalInput:
    -      description: Illegal input for operation.
    -    GeneralError:
    -      description: General Error
    -      content:
    -        application/json:
    -          schema:
    -            $ref: '#/components/schemas/GeneralError'
    -  securitySchemes:
    -    api_key:
    -      type: apiKey
    -      name: api_key
    -      in: header
    -    petstore_auth:
    -      type: oauth2
    -      flows: 
    -        implicit:
    -          authorizationUrl: http://example.org/api/oauth/dialog
    -          scopes:
    -            write:pets: modify pets in your account
    -            read:pets: read your pets
    +
    
    +components:
    +  schemas:
    +    Category:
    +      type: object
    +      properties:
    +        id:
    +          type: integer
    +          format: int64
    +        name:
    +          type: string
    +    Tag:
    +      type: object
    +      properties:
    +        id:
    +          type: integer
    +          format: int64
    +        name:
    +          type: string
    +  parameters:
    +    skipParam:
    +      name: skip
    +      in: query
    +      description: number of items to skip
    +      required: true
    +      schema:
    +        type: integer
    +        format: int32
    +    limitParam:
    +      name: limit
    +      in: query
    +      description: max records to return
    +      required: true
    +      schema:
    +        type: integer
    +        format: int32
    +  responses:
    +    NotFound:
    +      description: Entity not found.
    +    IllegalInput:
    +      description: Illegal input for operation.
    +    GeneralError:
    +      description: General Error
    +      content:
    +        application/json:
    +          schema:
    +            $ref: '#/components/schemas/GeneralError'
    +  securitySchemes:
    +    api_key:
    +      type: apiKey
    +      name: api_key
    +      in: header
    +    petstore_auth:
    +      type: oauth2
    +      flows: 
    +        implicit:
    +          authorizationUrl: http://example.org/api/oauth/dialog
    +          scopes:
    +            write:pets: modify pets in your account
    +            read:pets: read your pets
     

    Paths Object

    Holds the relative paths to the individual endpoints and their operations. @@ -755,35 +755,35 @@

    This object MAY be extended with Specification Extensions.

    Path Templating Matching

    Assuming the following paths, the concrete definition, /pets/mine, will be matched first if used:

    -
    
    +
    
       /pets/{petId}
       /pets/mine
     

    The following paths are considered identical and invalid:

    -
    
    +
    
       /pets/{petId}
       /pets/{name}
     

    The following may lead to ambiguous resolution:

    -
    
    +
    
       /{entity}/me
       /books/{id}
     

    Paths Object Example

    -
    
    +
    
     {
    -  "/pets": {
    -    "get": {
    -      "description": "Returns all pets from the system that the user has access to",
    -      "responses": {
    -        "200": {          
    -          "description": "A list of pets.",
    -          "content": {
    -            "application/json": {
    -              "schema": {
    -                "type": "array",
    -                "items": {
    -                  "$ref": "#/components/schemas/pet"
    +  "/pets": {
    +    "get": {
    +      "description": "Returns all pets from the system that the user has access to",
    +      "responses": {
    +        "200": {          
    +          "description": "A list of pets.",
    +          "content": {
    +            "application/json": {
    +              "schema": {
    +                "type": "array",
    +                "items": {
    +                  "$ref": "#/components/schemas/pet"
                     }
                   }
                 }
    @@ -794,19 +794,19 @@
       }
     }
     
    -
    
    -/pets:
    -  get:
    -    description: Returns all pets from the system that the user has access to
    -    responses:
    -      '200':
    -        description: A list of pets.
    -        content:
    -          application/json:
    -            schema:
    -              type: array
    -              items:
    -                $ref: '#/components/schemas/pet'
    +
    
    +/pets:
    +  get:
    +    description: Returns all pets from the system that the user has access to
    +    responses:
    +      '200':
    +        description: A list of pets.
    +        content:
    +          application/json:
    +            schema:
    +              type: array
    +              items:
    +                $ref: '#/components/schemas/pet'
     

    Path Item Object

    Describes the operations available on a single path. @@ -891,85 +891,85 @@

    This object MAY be extended with Specification Extensions.

    Path Item Object Example

    -
    
    +
    
     {
    -  "get": {
    -    "description": "Returns pets based on ID",
    -    "summary": "Find pets by ID",
    -    "operationId": "getPetsById",
    -    "responses": {
    -      "200": {
    -        "description": "pet response",
    -        "content": {
    -          "*/*": {
    -            "schema": {
    -              "type": "array",
    -              "items": {
    -                "$ref": "#/components/schemas/Pet"
    +  "get": {
    +    "description": "Returns pets based on ID",
    +    "summary": "Find pets by ID",
    +    "operationId": "getPetsById",
    +    "responses": {
    +      "200": {
    +        "description": "pet response",
    +        "content": {
    +          "*/*": {
    +            "schema": {
    +              "type": "array",
    +              "items": {
    +                "$ref": "#/components/schemas/Pet"
                   }
                 }
               }
             }
           },
    -      "default": {
    -        "description": "error payload",
    -        "content": {
    -          "text/html": {
    -            "schema": {
    -              "$ref": "#/components/schemas/ErrorModel"
    +      "default": {
    +        "description": "error payload",
    +        "content": {
    +          "text/html": {
    +            "schema": {
    +              "$ref": "#/components/schemas/ErrorModel"
                 }
               }
             }
           }
         }
       },
    -  "parameters": [
    +  "parameters": [
         {
    -      "name": "id",
    -      "in": "path",
    -      "description": "ID of pet to use",
    -      "required": true,
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "type": "string"
    +      "name": "id",
    +      "in": "path",
    +      "description": "ID of pet to use",
    +      "required": true,
    +      "schema": {
    +        "type": "array",
    +        "items": {
    +          "type": "string"
             }
           },
    -      "style": "simple"
    +      "style": "simple"
         }
       ]
     }
     
    -
    
    -get:
    -  description: Returns pets based on ID
    -  summary: Find pets by ID
    -  operationId: getPetsById
    -  responses:
    -    '200':
    -      description: pet response
    -      content:
    -        '*/*' :
    -          schema:
    -            type: array
    -            items:
    -              $ref: '#/components/schemas/Pet'
    -    default:
    -      description: error payload
    -      content:
    -        'text/html':
    -          schema:
    -            $ref: '#/components/schemas/ErrorModel'
    -parameters:
    -- name: id
    -  in: path
    -  description: ID of pet to use
    -  required: true
    -  schema:
    -    type: array
    -    style: simple
    -    items:
    -      type: string  
    +
    
    +get:
    +  description: Returns pets based on ID
    +  summary: Find pets by ID
    +  operationId: getPetsById
    +  responses:
    +    '200':
    +      description: pet response
    +      content:
    +        '*/*' :
    +          schema:
    +            type: array
    +            items:
    +              $ref: '#/components/schemas/Pet'
    +    default:
    +      description: error payload
    +      content:
    +        'text/html':
    +          schema:
    +            $ref: '#/components/schemas/ErrorModel'
    +parameters:
    +- name: id
    +  in: path
    +  description: ID of pet to use
    +  required: true
    +  schema:
    +    type: array
    +    style: simple
    +    items:
    +      type: string  
     

    Operation Object

    Describes a single API operation on a path.

    @@ -1016,7 +1016,7 @@ requestBody Request Body Object ¦ Reference Object -The request body applicable for this operation. The requestBody is only supported in HTTP methods where the HTTP 1.1 specification [[!rfc7231]]section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers. +The request body applicable for this operation. The requestBody is only supported in HTTP methods where the HTTP 1.1 specification [[!RFC7231]] has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers. responses @@ -1047,110 +1047,110 @@

    This object MAY be extended with Specification Extensions.

    Operation Object Example

    -
    
    +
    
     {
    -  "tags": [
    -    "pet"
    +  "tags": [
    +    "pet"
       ],
    -  "summary": "Updates a pet in the store with form data",
    -  "operationId": "updatePetWithForm",
    -  "parameters": [
    +  "summary": "Updates a pet in the store with form data",
    +  "operationId": "updatePetWithForm",
    +  "parameters": [
         {
    -      "name": "petId",
    -      "in": "path",
    -      "description": "ID of pet that needs to be updated",
    -      "required": true,
    -      "schema": {
    -        "type": "string"
    +      "name": "petId",
    +      "in": "path",
    +      "description": "ID of pet that needs to be updated",
    +      "required": true,
    +      "schema": {
    +        "type": "string"
           }
         }
       ],
    -  "requestBody": {
    -    "content": {
    -      "application/x-www-form-urlencoded": {
    -        "schema": {
    -          "type": "object",
    -           "properties": {
    -              "name": { 
    -                "description": "Updated name of the pet",
    -                "type": "string"
    +  "requestBody": {
    +    "content": {
    +      "application/x-www-form-urlencoded": {
    +        "schema": {
    +          "type": "object",
    +           "properties": {
    +              "name": { 
    +                "description": "Updated name of the pet",
    +                "type": "string"
                   },
    -              "status": {
    -                "description": "Updated status of the pet",
    -                "type": "string"
    +              "status": {
    +                "description": "Updated status of the pet",
    +                "type": "string"
                  }
                },
    -        "required": ["status"] 
    +        "required": ["status"] 
             }
           }
         }
       },
    -  "responses": {
    -    "200": {
    -      "description": "Pet updated.",
    -      "content": {
    -        "application/json": {},
    -        "application/xml": {}
    +  "responses": {
    +    "200": {
    +      "description": "Pet updated.",
    +      "content": {
    +        "application/json": {},
    +        "application/xml": {}
           }
         },
    -    "405": {
    -      "description": "Invalid input",
    -      "content": {
    -        "application/json": {},
    -        "application/xml": {}
    +    "405": {
    +      "description": "Invalid input",
    +      "content": {
    +        "application/json": {},
    +        "application/xml": {}
           }
         }
       },
    -  "security": [
    +  "security": [
         {
    -      "petstore_auth": [
    -        "write:pets",
    -        "read:pets"
    +      "petstore_auth": [
    +        "write:pets",
    +        "read:pets"
           ]
         }
       ]
     }
     
    -
    
    -tags:
    -- pet
    -summary: Updates a pet in the store with form data
    -operationId: updatePetWithForm
    -parameters:
    -- name: petId
    -  in: path
    -  description: ID of pet that needs to be updated
    -  required: true
    -  schema:
    -    type: string
    -requestBody:
    -  content:
    -    'application/x-www-form-urlencoded':
    -      schema:
    -       properties:
    -          name: 
    -            description: Updated name of the pet
    -            type: string
    -          status:
    -            description: Updated status of the pet
    -            type: string
    -       required:
    -         - status
    -responses:
    -  '200':
    -    description: Pet updated.
    -    content: 
    -      'application/json': {}
    -      'application/xml': {}
    -  '405':
    -    description: Invalid input
    -    content: 
    -      'application/json': {}
    -      'application/xml': {}
    -security:
    -- petstore_auth:
    -  - write:pets
    -  - read:pets
    +
    
    +tags:
    +- pet
    +summary: Updates a pet in the store with form data
    +operationId: updatePetWithForm
    +parameters:
    +- name: petId
    +  in: path
    +  description: ID of pet that needs to be updated
    +  required: true
    +  schema:
    +    type: string
    +requestBody:
    +  content:
    +    'application/x-www-form-urlencoded':
    +      schema:
    +       properties:
    +          name: 
    +            description: Updated name of the pet
    +            type: string
    +          status:
    +            description: Updated status of the pet
    +            type: string
    +       required:
    +         - status
    +responses:
    +  '200':
    +    description: Pet updated.
    +    content: 
    +      'application/json': {}
    +      'application/xml': {}
    +  '405':
    +    description: Invalid input
    +    content: 
    +      'application/json': {}
    +      'application/xml': {}
    +security:
    +- petstore_auth:
    +  - write:pets
    +  - read:pets
     

    External Documentation Object

    Allows referencing an external resource for extended documentation.

    @@ -1178,15 +1178,15 @@

    This object MAY be extended with Specification Extensions.

    External Documentation Object Example

    -
    
    +
    
     {
    -  "description": "Find more info here",
    -  "url": "https://example.com"
    +  "description": "Find more info here",
    +  "url": "https://example.com"
     }
     
    -
    
    -description: Find more info here
    -url: https://example.com
    +
    
    +description: Find more info here
    +url: https://example.com
     

    Parameter Object

    Describes a single operation parameter.

    @@ -1196,7 +1196,7 @@
    • path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId.
    • query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id.
    • -
    • header - Custom headers that are expected as part of the request. Note that [[!rfc7230]]page-22) states header names are case insensitive.
    • +
    • header - Custom headers that are expected as part of the request. Note that [[!RFC7230]] states header names are case insensitive.
    • cookie - Used to pass a specific cookie value to the API.

    Fixed Fields

    @@ -1265,7 +1265,7 @@ allowReserved boolean -Determines whether the parameter value SHOULD allow reserved characters, as defined by [[!rfc3986]]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false. +Determines whether the parameter value SHOULD allow reserved characters, as defined by [[!RFC3986]] :/?#[]@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false. schema @@ -1319,25 +1319,25 @@ matrix primitive, array, object path -Path-style parameters defined by [[!rfc6570]]section-3.2.7) +Path-style parameters defined by [[!RFC6570]] label primitive, array, object path -Label style parameters defined by [[!rfc6570]]section-3.2.5) +Label style parameters defined by [[!RFC6570]] form primitive, array, object query, cookie -Form style parameters defined by [[!rfc6570]]section-3.2.8). This option replaces collectionFormat with a csv (when explode is false) or multi (when explode is true) value from OpenAPI 2.0. +Form style parameters defined by [[!RFC6570]]. This option replaces collectionFormat with a csv (when explode is false) or multi (when explode is true) value from OpenAPI 2.0. simple array path, header -Simple style parameters defined by [[!rfc6570]]section-3.2.2). This option replaces collectionFormat with a csv value from OpenAPI 2.0. +Simple style parameters defined by [[!RFC6570]]. This option replaces collectionFormat with a csv value from OpenAPI 2.0. spaceDelimited @@ -1361,7 +1361,7 @@

    Style Examples

    Assume a parameter named color has one of the following values:

    -
    
    +
    
        string -> "blue"
        array -> ["blue","black","brown"]
        object -> { "R": 100, "G": 200, "B": 150 }
    @@ -1472,125 +1472,125 @@
     

    This object MAY be extended with Specification Extensions.

    Parameter Object Examples

    A header parameter with an array of 64 bit integer numbers:

    -
    
    +
    
     {
    -  "name": "token",
    -  "in": "header",
    -  "description": "token to be passed as a header",
    -  "required": true,
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "type": "integer",
    -      "format": "int64"
    +  "name": "token",
    +  "in": "header",
    +  "description": "token to be passed as a header",
    +  "required": true,
    +  "schema": {
    +    "type": "array",
    +    "items": {
    +      "type": "integer",
    +      "format": "int64"
         }
       },
    -  "style": "simple"
    +  "style": "simple"
     }
     
    -
    
    -name: token
    -in: header
    -description: token to be passed as a header
    -required: true
    -schema:
    -  type: array
    -  items:
    -    type: integer
    -    format: int64
    -style: simple
    +
    
    +name: token
    +in: header
    +description: token to be passed as a header
    +required: true
    +schema:
    +  type: array
    +  items:
    +    type: integer
    +    format: int64
    +style: simple
     

    A path parameter of a string value:

    -
    
    +
    
     {
    -  "name": "username",
    -  "in": "path",
    -  "description": "username to fetch",
    -  "required": true,
    -  "schema": {
    -    "type": "string"
    +  "name": "username",
    +  "in": "path",
    +  "description": "username to fetch",
    +  "required": true,
    +  "schema": {
    +    "type": "string"
       }
     }
     
    -
    
    -name: username
    -in: path
    -description: username to fetch
    -required: true
    -schema:
    -  type: string
    +
    
    +name: username
    +in: path
    +description: username to fetch
    +required: true
    +schema:
    +  type: string
     

    An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

    -
    
    +
    
     {
    -  "name": "id",
    -  "in": "query",
    -  "description": "ID of the object to fetch",
    -  "required": false,
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    +  "name": "id",
    +  "in": "query",
    +  "description": "ID of the object to fetch",
    +  "required": false,
    +  "schema": {
    +    "type": "array",
    +    "items": {
    +      "type": "string"
         }
       },
    -  "style": "form",
    -  "explode": true
    +  "style": "form",
    +  "explode": true
     }
     
    -
    
    -name: id
    -in: query
    -description: ID of the object to fetch
    -required: false
    -schema:
    -  type: array
    -  items:
    -    type: string
    -style: form
    -explode: true
    +
    
    +name: id
    +in: query
    +description: ID of the object to fetch
    +required: false
    +schema:
    +  type: array
    +  items:
    +    type: string
    +style: form
    +explode: true
     

    A free-form query parameter, allowing undefined parameters of a specific type:

    -
    
    +
    
     {
    -  "in": "query",
    -  "name": "freeForm",
    -  "schema": {
    -    "type": "object",
    -    "additionalProperties": {
    -      "type": "integer"
    +  "in": "query",
    +  "name": "freeForm",
    +  "schema": {
    +    "type": "object",
    +    "additionalProperties": {
    +      "type": "integer"
         },
       },
    -  "style": "form"
    +  "style": "form"
     }
     
    -
    
    -in: query
    -name: freeForm
    -schema:
    -  type: object
    -  additionalProperties:
    -    type: integer
    -style: form
    +
    
    +in: query
    +name: freeForm
    +schema:
    +  type: object
    +  additionalProperties:
    +    type: integer
    +style: form
     

    A complex parameter using content to define serialization:

    -
    
    +
    
     {
    -  "in": "query",
    -  "name": "coordinates",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "type": "object",
    -        "required": [
    -          "lat",
    -          "long"
    +  "in": "query",
    +  "name": "coordinates",
    +  "content": {
    +    "application/json": {
    +      "schema": {
    +        "type": "object",
    +        "required": [
    +          "lat",
    +          "long"
             ],
    -        "properties": {
    -          "lat": {
    -            "type": "number"
    +        "properties": {
    +          "lat": {
    +            "type": "number"
               },
    -          "long": {
    -            "type": "number"
    +          "long": {
    +            "type": "number"
               }
             }
           }
    @@ -1598,21 +1598,21 @@
       }
     }
     
    -
    
    -in: query
    -name: coordinates
    -content:
    -  application/json:
    -    schema:
    -      type: object
    -      required:
    -        - lat
    -        - long
    -      properties:
    -        lat:
    -          type: number
    -        long:
    -          type: number
    +
    
    +in: query
    +name: coordinates
    +content:
    +  application/json:
    +    schema:
    +      type: object
    +      required:
    +        - lat
    +        - long
    +      properties:
    +        lat:
    +          type: number
    +        long:
    +          type: number
     

    Request Body Object

    Describes a single request body.

    @@ -1646,104 +1646,104 @@

    This object MAY be extended with Specification Extensions.

    Request Body Examples

    A request body with a referenced model definition.

    -
    
    +
    
     {
    -  "description": "user to add to the system",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "$ref": "#/components/schemas/User"
    +  "description": "user to add to the system",
    +  "content": {
    +    "application/json": {
    +      "schema": {
    +        "$ref": "#/components/schemas/User"
           },
    -      "examples": {
    -          "user" : {
    -            "summary": "User Example", 
    -            "externalValue": "http://foo.bar/examples/user-example.json"
    +      "examples": {
    +          "user" : {
    +            "summary": "User Example", 
    +            "externalValue": "http://foo.bar/examples/user-example.json"
               } 
             }
         },
    -    "application/xml": {
    -      "schema": {
    -        "$ref": "#/components/schemas/User"
    +    "application/xml": {
    +      "schema": {
    +        "$ref": "#/components/schemas/User"
           },
    -      "examples": {
    -          "user" : {
    -            "summary": "User example in XML",
    -            "externalValue": "http://foo.bar/examples/user-example.xml"
    +      "examples": {
    +          "user" : {
    +            "summary": "User example in XML",
    +            "externalValue": "http://foo.bar/examples/user-example.xml"
               }
             }
         },
    -    "text/plain": {
    -      "examples": {
    -        "user" : {
    -            "summary": "User example in Plain text",
    -            "externalValue": "http://foo.bar/examples/user-example.txt" 
    +    "text/plain": {
    +      "examples": {
    +        "user" : {
    +            "summary": "User example in Plain text",
    +            "externalValue": "http://foo.bar/examples/user-example.txt" 
             }
           } 
         },
    -    "*/*": {
    -      "examples": {
    -        "user" : {
    -            "summary": "User example in other format",
    -            "externalValue": "http://foo.bar/examples/user-example.whatever"
    +    "*/*": {
    +      "examples": {
    +        "user" : {
    +            "summary": "User example in other format",
    +            "externalValue": "http://foo.bar/examples/user-example.whatever"
             }
           }
         }
       }
     }
     
    -
    
    -description: user to add to the system
    -content: 
    -  'application/json':
    -    schema:
    -      $ref: '#/components/schemas/User'
    -    examples:
    -      user:
    -        summary: User Example
    -        externalValue: 'http://foo.bar/examples/user-example.json'
    -  'application/xml':
    -    schema:
    -      $ref: '#/components/schemas/User'
    -    examples:
    -      user:
    -        summary: User Example in XML
    -        externalValue: 'http://foo.bar/examples/user-example.xml'
    -  'text/plain':
    -    examples:
    -      user:
    -        summary: User example in text plain format
    -        externalValue: 'http://foo.bar/examples/user-example.txt'
    -  '*/*':
    -    examples:
    -      user: 
    -        summary: User example in other format
    -        externalValue: 'http://foo.bar/examples/user-example.whatever'
    +
    
    +description: user to add to the system
    +content: 
    +  'application/json':
    +    schema:
    +      $ref: '#/components/schemas/User'
    +    examples:
    +      user:
    +        summary: User Example
    +        externalValue: 'http://foo.bar/examples/user-example.json'
    +  'application/xml':
    +    schema:
    +      $ref: '#/components/schemas/User'
    +    examples:
    +      user:
    +        summary: User Example in XML
    +        externalValue: 'http://foo.bar/examples/user-example.xml'
    +  'text/plain':
    +    examples:
    +      user:
    +        summary: User example in text plain format
    +        externalValue: 'http://foo.bar/examples/user-example.txt'
    +  '*/*':
    +    examples:
    +      user: 
    +        summary: User example in other format
    +        externalValue: 'http://foo.bar/examples/user-example.whatever'
     

    A body parameter that is an array of string values:

    -
    
    +
    
     {
    -  "description": "user to add to the system",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "type": "string"
    +  "description": "user to add to the system",
    +  "content": {
    +    "text/plain": {
    +      "schema": {
    +        "type": "array",
    +        "items": {
    +          "type": "string"
             }
           }
         }
       }
     }
     
    -
    
    -description: user to add to the system
    -required: true
    -content:
    -  text/plain:
    -    schema:
    -      type: array
    -      items:
    -        type: string
    +
    
    +description: user to add to the system
    +required: true
    +content:
    +  text/plain:
    +    schema:
    +      type: array
    +      items:
    +        type: string
     

    Media Type Object

    Each Media Type Object provides schema and examples for the media type identified by its key.

    @@ -1781,140 +1781,140 @@

    This object MAY be extended with Specification Extensions.

    Media Type Examples

    -
    
    +
    
     {
    -  "application/json": {
    -    "schema": {
    -         "$ref": "#/components/schemas/Pet"
    +  "application/json": {
    +    "schema": {
    +         "$ref": "#/components/schemas/Pet"
         },
    -    "examples": {
    -      "cat" : {
    -        "summary": "An example of a cat",
    -        "value": 
    +    "examples": {
    +      "cat" : {
    +        "summary": "An example of a cat",
    +        "value": 
               {
    -            "name": "Fluffy",
    -            "petType": "Cat",
    -            "color": "White",
    -            "gender": "male",
    -            "breed": "Persian"
    +            "name": "Fluffy",
    +            "petType": "Cat",
    +            "color": "White",
    +            "gender": "male",
    +            "breed": "Persian"
               }
           },
    -      "dog": {
    -        "summary": "An example of a dog with a cat's name",
    -        "value" :  { 
    -          "name": "Puma",
    -          "petType": "Dog",
    -          "color": "Black",
    -          "gender": "Female",
    -          "breed": "Mixed"
    +      "dog": {
    +        "summary": "An example of a dog with a cat's name",
    +        "value" :  { 
    +          "name": "Puma",
    +          "petType": "Dog",
    +          "color": "Black",
    +          "gender": "Female",
    +          "breed": "Mixed"
             },
    -      "frog": {
    -          "$ref": "#/components/examples/frog-example"
    +      "frog": {
    +          "$ref": "#/components/examples/frog-example"
             }
           }
         }
       }
     }
     
    -
    
    -application/json: 
    -  schema:
    -    $ref: "#/components/schemas/Pet"
    -  examples:
    -    cat:
    -      summary: An example of a cat
    -      value:
    -        name: Fluffy
    -        petType: Cat
    -        color: White
    -        gender: male
    -        breed: Persian
    -    dog:
    -      summary: An example of a dog with a cat's name
    -      value:
    -        name: Puma
    -        petType: Dog
    -        color: Black
    -        gender: Female
    -        breed: Mixed
    -    frog:
    -      $ref: "#/components/examples/frog-example"
    +
    
    +application/json: 
    +  schema:
    +    $ref: "#/components/schemas/Pet"
    +  examples:
    +    cat:
    +      summary: An example of a cat
    +      value:
    +        name: Fluffy
    +        petType: Cat
    +        color: White
    +        gender: male
    +        breed: Persian
    +    dog:
    +      summary: An example of a dog with a cat's name
    +      value:
    +        name: Puma
    +        petType: Dog
    +        color: Black
    +        gender: Female
    +        breed: Mixed
    +    frog:
    +      $ref: "#/components/examples/frog-example"
     

    Considerations for File Uploads

    In contrast with the 2.0 specification, file input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically:

    -
    
    -# content transferred with base64 encoding
    -schema:
    -  type: string
    -  format: base64
    -
    -
    
    -# content transferred in binary (octet-stream):
    -schema:
    -  type: string
    -  format: binary
    +
    
    +# content transferred with base64 encoding
    +schema:
    +  type: string
    +  format: base64
    +
    +
    
    +# content transferred in binary (octet-stream):
    +schema:
    +  type: string
    +  format: binary
     

    These examples apply to either input payloads of file uploads or response payloads.

    A requestBody for submitting a file in a POST operation may look like the following example:

    -
    
    -requestBody:
    -  content:
    -    application/octet-stream:
    -      # any media type is accepted, functionally equivalent to `*/*`
    -      schema:
    -        # a binary file of any type
    -        type: string
    -        format: binary
    +
    
    +requestBody:
    +  content:
    +    application/octet-stream:
    +      # any media type is accepted, functionally equivalent to `*/*`
    +      schema:
    +        # a binary file of any type
    +        type: string
    +        format: binary
     

    In addition, specific media types MAY be specified:

    -
    
    -# multiple, specific media types may be specified:
    -requestBody:
    -  content:
    -      # a binary file of type png or jpeg
    -    'image/jpeg':
    -      schema:
    -        type: string
    -        format: binary
    -    'image/png':
    -      schema:
    -        type: string
    -        format: binary        
    +
    
    +# multiple, specific media types may be specified:
    +requestBody:
    +  content:
    +      # a binary file of type png or jpeg
    +    'image/jpeg':
    +      schema:
    +        type: string
    +        format: binary
    +    'image/png':
    +      schema:
    +        type: string
    +        format: binary        
     

    To upload multiple files, a multipart media type MUST be used:

    -
    
    -requestBody:
    -  content:
    -    multipart/form-data:
    -      schema:
    -        properties:
    -          # The property name 'file' will be used for all files.
    -          file:
    -            type: array
    -            items:
    -              type: string
    -              format: binary
    +
    
    +requestBody:
    +  content:
    +    multipart/form-data:
    +      schema:
    +        properties:
    +          # The property name 'file' will be used for all files.
    +          file:
    +            type: array
    +            items:
    +              type: string
    +              format: binary
     
     

    Support for x-www-form-urlencoded Request Bodies

    -

    To submit content using form url encoding via [[!rfc1866]], the following +

    To submit content using form url encoding via [[!RFC1866]], the following definition may be used:

    -
    
    -requestBody:
    -  content:
    -    application/x-www-form-urlencoded:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            type: string
    -            format: uuid
    -          address:
    -            # complex types are stringified to support RFC 1866
    -            type: object
    -            properties: {}
    -
    -

    In this example, the contents in the requestBody MUST be stringified per [[!rfc1866]]) when passed to the server. In addition, the address field complex object will be stringified.

    +
    
    +requestBody:
    +  content:
    +    application/x-www-form-urlencoded:
    +      schema:
    +        type: object
    +        properties:
    +          id:
    +            type: string
    +            format: uuid
    +          address:
    +            # complex types are stringified to support RFC 1866
    +            type: object
    +            properties: {}
    +
    +

    In this example, the contents in the requestBody MUST be stringified per [[!RFC1866]] when passed to the server. In addition, the address field complex object will be stringified.

    When passing complex objects in the application/x-www-form-urlencoded content type, the default serialization strategy of such properties is described in the Encoding Object's style property as form.

    Special Considerations for multipart Content

    It is common to use multipart/form-data as a Content-Type when transferring request bodies to operations. In contrast to 2.0, a schema is REQUIRED to define the input parameters to the operation when using multipart content. This supports complex structures as well as supporting mechanisms for multiple file uploads.

    @@ -1925,34 +1925,34 @@
  • If the property is a type: string with format: binary or format: base64 (aka a file object), the default Content-Type is application/octet-stream
  • Examples:

    -
    
    -requestBody:
    -  content:
    -    multipart/form-data:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            type: string
    -            format: uuid
    -          address:
    -            # default Content-Type for objects is `application/json`
    -            type: object
    -            properties: {}
    -          profileImage:
    -            # default Content-Type for string/binary is `application/octet-stream`
    -            type: string
    -            format: binary
    -          children:
    -            # default Content-Type for arrays is based on the `inner` type (text/plain here)
    -            type: array
    -            items:
    -              type: string
    -          addresses:
    -            # default Content-Type for arrays is based on the `inner` type (object shown, so `application/json` in this example)
    -            type: array
    -            items:
    -              type: '#/components/schemas/Address'
    +
    
    +requestBody:
    +  content:
    +    multipart/form-data:
    +      schema:
    +        type: object
    +        properties:
    +          id:
    +            type: string
    +            format: uuid
    +          address:
    +            # default Content-Type for objects is `application/json`
    +            type: object
    +            properties: {}
    +          profileImage:
    +            # default Content-Type for string/binary is `application/octet-stream`
    +            type: string
    +            format: binary
    +          children:
    +            # default Content-Type for arrays is based on the `inner` type (text/plain here)
    +            type: array
    +            items:
    +              type: string
    +          addresses:
    +            # default Content-Type for arrays is based on the `inner` type (object shown, so `application/json` in this example)
    +            type: array
    +            items:
    +              type: '#/components/schemas/Address'
     

    An encoding attribute is introduced to give you control over the serialization of parts of multipart request bodies. This attribute is only applicable to multipart and application/x-www-form-urlencoded request bodies.

    Encoding Object

    @@ -1990,48 +1990,48 @@ allowReserved boolean -Determines whether the parameter value SHOULD allow reserved characters, as defined by [[!rfc3986]]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded. +Determines whether the parameter value SHOULD allow reserved characters, as defined by [[!RFC3986]] :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.

    This object MAY be extended with Specification Extensions.

    Encoding Object Example

    -
    
    -requestBody:
    -  content:
    -    multipart/mixed:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            # default is text/plain
    -            type: string
    -            format: uuid
    -          address:
    -            # default is application/json
    -            type: object
    -            properties: {}
    -          historyMetadata:
    -            # need to declare XML format!
    -            description: metadata in XML format
    -            type: object
    -            properties: {}
    -          profileImage:
    -            # default is application/octet-stream, need to declare an image type only!
    -            type: string
    -            format: binary
    -      encoding:
    -        historyMetadata:
    -          # require XML Content-Type in utf-8 encoding
    -          contentType: application/xml; charset=utf-8
    -        profileImage:
    -          # only accept png/jpeg
    -          contentType: image/png, image/jpeg
    -          headers:
    -            X-Rate-Limit-Limit:
    -              description: The number of allowed requests in the current period
    -              schema:
    -                type: integer
    +
    
    +requestBody:
    +  content:
    +    multipart/mixed:
    +      schema:
    +        type: object
    +        properties:
    +          id:
    +            # default is text/plain
    +            type: string
    +            format: uuid
    +          address:
    +            # default is application/json
    +            type: object
    +            properties: {}
    +          historyMetadata:
    +            # need to declare XML format!
    +            description: metadata in XML format
    +            type: object
    +            properties: {}
    +          profileImage:
    +            # default is application/octet-stream, need to declare an image type only!
    +            type: string
    +            format: binary
    +      encoding:
    +        historyMetadata:
    +          # require XML Content-Type in utf-8 encoding
    +          contentType: application/xml; charset=utf-8
    +        profileImage:
    +          # only accept png/jpeg
    +          contentType: image/png, image/jpeg
    +          headers:
    +            X-Rate-Limit-Limit:
    +              description: The number of allowed requests in the current period
    +              schema:
    +                type: integer
     

    Responses Object

    A container for the expected responses of an operation. @@ -2079,43 +2079,43 @@

    This object MAY be extended with Specification Extensions.

    Responses Object Example

    A 200 response for a successful operation and a default response for others (implying an error):

    -
    
    +
    
     {
    -  "200": {
    -    "description": "a pet to be returned",
    -    "content": {
    -      "application/json": {
    -        "schema": {
    -          "$ref": "#/components/schemas/Pet"
    +  "200": {
    +    "description": "a pet to be returned",
    +    "content": {
    +      "application/json": {
    +        "schema": {
    +          "$ref": "#/components/schemas/Pet"
             }
           }
         }
       },
    -  "default": {
    -    "description": "Unexpected error",
    -    "content": {
    -      "application/json": {
    -        "schema": {
    -          "$ref": "#/components/schemas/ErrorModel"
    +  "default": {
    +    "description": "Unexpected error",
    +    "content": {
    +      "application/json": {
    +        "schema": {
    +          "$ref": "#/components/schemas/ErrorModel"
             }
           }
         }
       }
     }
     
    -
    
    -'200':
    -  description: a pet to be returned
    -  content: 
    -    application/json:
    -      schema:
    -        $ref: '#/components/schemas/Pet'
    -default:
    -  description: Unexpected error
    -  content:
    -    application/json:
    -      schema:
    -        $ref: '#/components/schemas/ErrorModel'
    +
    
    +'200':
    +  description: a pet to be returned
    +  content: 
    +    application/json:
    +      schema:
    +        $ref: '#/components/schemas/Pet'
    +default:
    +  description: Unexpected error
    +  content:
    +    application/json:
    +      schema:
    +        $ref: '#/components/schemas/ErrorModel'
     

    Response Object

    Describes a single response from an API Operation, including design-time, static @@ -2138,7 +2138,7 @@ headers Map[string, Header Object ¦ Reference Object] -Maps a header name to its definition. [[!rfc7230]]page-22) states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored. +Maps a header name to its definition. [[!RFC7230]] states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored. content @@ -2155,113 +2155,113 @@

    This object MAY be extended with Specification Extensions.

    Response Object Examples

    Response of an array of a complex type:

    -
    
    +
    
     {
    -  "description": "A complex object array response",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "$ref": "#/components/schemas/VeryComplexType"
    +  "description": "A complex object array response",
    +  "content": {
    +    "application/json": {
    +      "schema": {
    +        "type": "array",
    +        "items": {
    +          "$ref": "#/components/schemas/VeryComplexType"
             }
           }
         }
       }
     }
     
    -
    
    -description: A complex object array response
    -content: 
    -  application/json:
    -    schema: 
    -      type: array
    -      items:
    -        $ref: '#/components/schemas/VeryComplexType'
    +
    
    +description: A complex object array response
    +content: 
    +  application/json:
    +    schema: 
    +      type: array
    +      items:
    +        $ref: '#/components/schemas/VeryComplexType'
     

    Response with a string type:

    -
    
    +
    
     {
    -  "description": "A simple string response",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "string"
    +  "description": "A simple string response",
    +  "content": {
    +    "text/plain": {
    +      "schema": {
    +        "type": "string"
           }
         }
       }
     
     }
     
    -
    
    -description: A simple string response
    -content:
    -  text/plain:
    -    schema:
    -      type: string
    +
    
    +description: A simple string response
    +content:
    +  text/plain:
    +    schema:
    +      type: string
     

    Plain text response with headers:

    -
    
    +
    
     {
    -  "description": "A simple string response",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "string"
    +  "description": "A simple string response",
    +  "content": {
    +    "text/plain": {
    +      "schema": {
    +        "type": "string"
           }
         }
       },
    -  "headers": {
    -    "X-Rate-Limit-Limit": {
    -      "description": "The number of allowed requests in the current period",
    -      "schema": {
    -        "type": "integer"
    +  "headers": {
    +    "X-Rate-Limit-Limit": {
    +      "description": "The number of allowed requests in the current period",
    +      "schema": {
    +        "type": "integer"
           }
         },
    -    "X-Rate-Limit-Remaining": {
    -      "description": "The number of remaining requests in the current period",
    -      "schema": {
    -        "type": "integer"
    +    "X-Rate-Limit-Remaining": {
    +      "description": "The number of remaining requests in the current period",
    +      "schema": {
    +        "type": "integer"
           }
         },
    -    "X-Rate-Limit-Reset": {
    -      "description": "The number of seconds left in the current period",
    -      "schema": {
    -        "type": "integer"
    +    "X-Rate-Limit-Reset": {
    +      "description": "The number of seconds left in the current period",
    +      "schema": {
    +        "type": "integer"
           }
         }
       }
     }
     
    -
    
    -description: A simple string response
    -content:
    -  text/plain:
    -    schema:
    -      type: string
    -    example: 'whoa!'
    -headers:
    -  X-Rate-Limit-Limit:
    -    description: The number of allowed requests in the current period
    -    schema:
    -      type: integer
    -  X-Rate-Limit-Remaining:
    -    description: The number of remaining requests in the current period
    -    schema:
    -      type: integer
    -  X-Rate-Limit-Reset:
    -    description: The number of seconds left in the current period
    -    schema:
    -      type: integer
    +
    
    +description: A simple string response
    +content:
    +  text/plain:
    +    schema:
    +      type: string
    +    example: 'whoa!'
    +headers:
    +  X-Rate-Limit-Limit:
    +    description: The number of allowed requests in the current period
    +    schema:
    +      type: integer
    +  X-Rate-Limit-Remaining:
    +    description: The number of remaining requests in the current period
    +    schema:
    +      type: integer
    +  X-Rate-Limit-Reset:
    +    description: The number of seconds left in the current period
    +    schema:
    +      type: integer
     

    Response with no return value:

    -
    
    +
    
     {
    -  "description": "object created"
    +  "description": "object created"
     }
     
    -
    
    -description: object created
    +
    
    +description: object created
     

    Callback Object

    A map of possible out-of band callbacks related to the parent operation. @@ -2289,26 +2289,26 @@

    The key that identifies the Path Item Object is a runtime expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. A simple example might be $request.body#/url. However, using a runtime expression the complete HTTP message can be accessed. -This includes accessing any part of a body that a JSON Pointer [[!rfc6901]] can reference.

    +This includes accessing any part of a body that a JSON Pointer [[!RFC6901]] can reference.

    For example, given the following HTTP request:

    -
    
    -POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1
    -Host: example.org
    -Content-Type: application/json
    -Content-Length: 187
    +
    
    +POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1
    +Host: example.org
    +Content-Type: application/json
    +Content-Length: 187
     
    -{
    -  "failedUrl" : "http://clientdomain.com/failed",
    -  "successUrls" : [
    -    "http://clientdomain.com/fast",
    -    "http://clientdomain.com/medium",
    -    "http://clientdomain.com/slow"
    +{
    +  "failedUrl" : "http://clientdomain.com/failed",
    +  "successUrls" : [
    +    "http://clientdomain.com/fast",
    +    "http://clientdomain.com/medium",
    +    "http://clientdomain.com/slow"
       ] 
     }
     
    -201 Created
    -Location: http://example.org/subscription/1
    -
    +201 Created +Location: http://example.org/subscription/1 +

    The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named eventType and a query parameter named queryUrl.

    @@ -2354,19 +2354,19 @@

    Callback Object Example

    The following example shows a callback to the URL specified by the id and email property in the request body.

    -
    
    -myWebhook:
    -  'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
    -    post:
    -      requestBody:
    -        description: Callback payload
    -        content: 
    -          'application/json':
    -            schema:
    -              $ref: '#/components/schemas/SomePayload'
    -      responses:
    -        '200':
    -          description: webhook successfully processed and no retries will be performed
    +
    
    +myWebhook:
    +  'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
    +    post:
    +      requestBody:
    +        description: Callback payload
    +        content: 
    +          'application/json':
    +            schema:
    +              $ref: '#/components/schemas/SomePayload'
    +      responses:
    +        '200':
    +          description: webhook successfully processed and no retries will be performed
     

    Example Object

    Fixed Fields

    @@ -2406,63 +2406,63 @@ of its associated value. Tooling implementations MAY choose to validate compatibility automatically, and reject the example value(s) if incompatible.

    Example Object Example

    -
    
    -# in a model
    -schemas:
    -  properties:
    -    name:
    -      type: string
    -      examples:
    -        name:
    -          $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example
    +
    
    +# in a model
    +schemas:
    +  properties:
    +    name:
    +      type: string
    +      examples:
    +        name:
    +          $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example
     
    -# in a request body:
    -  requestBody:
    -    content:
    -      'application/json':
    -        schema:
    -          $ref: '#/components/schemas/Address'
    -        examples: 
    -          foo:
    -            summary: A foo example
    -            value: {"foo": "bar"}
    -          bar:
    -            summary: A bar example
    -            value: {"bar": "baz"}
    -      'application/xml':
    -        examples: 
    -          xmlExample:
    -            summary: This is an example in XML
    -            externalValue: 'http://example.org/examples/address-example.xml'
    -      'text/plain':
    -        examples:
    -          textExample: 
    -            summary: This is a text example
    -            externalValue: 'http://foo.bar/examples/address-example.txt' 
    +# in a request body:
    +  requestBody:
    +    content:
    +      'application/json':
    +        schema:
    +          $ref: '#/components/schemas/Address'
    +        examples: 
    +          foo:
    +            summary: A foo example
    +            value: {"foo": "bar"}
    +          bar:
    +            summary: A bar example
    +            value: {"bar": "baz"}
    +      'application/xml':
    +        examples: 
    +          xmlExample:
    +            summary: This is an example in XML
    +            externalValue: 'http://example.org/examples/address-example.xml'
    +      'text/plain':
    +        examples:
    +          textExample: 
    +            summary: This is a text example
    +            externalValue: 'http://foo.bar/examples/address-example.txt' 
     
     
    -# in a parameter
    -  parameters:
    -    - name: 'zipCode'
    -      in: 'query'
    -      schema:
    -        type: 'string'
    -        format: 'zip-code'
    -        examples:
    -          zip-example: 
    -            $ref: '#/components/examples/zip-example'
    +# in a parameter
    +  parameters:
    +    - name: 'zipCode'
    +      in: 'query'
    +      schema:
    +        type: 'string'
    +        format: 'zip-code'
    +        examples:
    +          zip-example: 
    +            $ref: '#/components/examples/zip-example'
     
    -# in a response
    -  responses:
    -    '200':
    -      description: your car appointment has been booked
    -      content: 
    -        application/json:
    -          schema:
    -            $ref: '#/components/schemas/SuccessResponse'
    -          examples:
    -            confirmation-success:
    -              $ref: '#/components/examples/confirmation-success'
    +# in a response
    +  responses:
    +    '200':
    +      description: your car appointment has been booked
    +      content: 
    +        application/json:
    +          schema:
    +            $ref: '#/components/schemas/SuccessResponse'
    +          examples:
    +            confirmation-success:
    +              $ref: '#/components/examples/confirmation-success'
     

    Link Object

    The Link object represents a possible design-time link for a response. @@ -2518,60 +2518,60 @@ for specifications with external references.

    Examples

    Computing a link from a request operation where the $request.path.id is used to pass a request parameter to the linked operation.

    -
    
    -paths:
    -  /users/{id}:
    -    parameters:
    -    - name: id
    -      in: path
    -      required: true
    -      description: the user identifier, as userId 
    -      schema:
    -        type: string
    -    get:
    -      responses:
    -        '200':
    -          description: the user being returned
    -          content:
    -            application/json:
    -              schema:
    -                type: object
    -                properties:
    -                  uuid: # the unique user id
    -                    type: string
    -                    format: uuid
    -          links:
    -            address:
    -              # the target link operationId
    -              operationId: getUserAddress
    -              parameters:
    -                # get the `id` field from the request path parameter named `id`
    -                userId: $request.path.id
    -  # the path item of the linked operation
    -  /users/{userid}/address:
    -    parameters:
    -    - name: userid
    -      in: path
    -      required: true
    -      description: the user identifier, as userId 
    -      schema:
    -        type: string
    -    # linked operation
    -    get:
    -      operationId: getUserAddress
    -      responses:
    -        '200':
    -          description: the user's address
    +
    
    +paths:
    +  /users/{id}:
    +    parameters:
    +    - name: id
    +      in: path
    +      required: true
    +      description: the user identifier, as userId 
    +      schema:
    +        type: string
    +    get:
    +      responses:
    +        '200':
    +          description: the user being returned
    +          content:
    +            application/json:
    +              schema:
    +                type: object
    +                properties:
    +                  uuid: # the unique user id
    +                    type: string
    +                    format: uuid
    +          links:
    +            address:
    +              # the target link operationId
    +              operationId: getUserAddress
    +              parameters:
    +                # get the `id` field from the request path parameter named `id`
    +                userId: $request.path.id
    +  # the path item of the linked operation
    +  /users/{userid}/address:
    +    parameters:
    +    - name: userid
    +      in: path
    +      required: true
    +      description: the user identifier, as userId 
    +      schema:
    +        type: string
    +    # linked operation
    +    get:
    +      operationId: getUserAddress
    +      responses:
    +        '200':
    +          description: the user's address
     

    When a runtime expression fails to evaluate, no parameter value is passed to the target operation.

    Values from the response body can be used to drive a linked operation.

    -
    
    -links:
    -  address:
    -    operationId: getUserAddressByUUID
    -    parameters:
    -      # get the `uuid` field from the `uuid` field in the response body
    -      userUuid: $response.body#/uuid
    +
    
    +links:
    +  address:
    +    operationId: getUserAddressByUUID
    +    parameters:
    +      # get the `uuid` field from the `uuid` field in the response body
    +      userUuid: $response.body#/uuid
     

    Clients follow all links at their discretion. Neither permissions, nor the capability to make a successful call to that link, is guaranteed @@ -2579,22 +2579,22 @@

    OperationRef Examples

    As references to operationId MAY NOT be possible (the operationId is an optional value), references MAY also be made through a relative operationRef:

    -
    
    -links:
    -  UserRepositories:
    -    # returns array of '#/components/schemas/repository'
    -    operationRef: '#/paths/~12.0~1repositories~1{username}/get'
    -    parameters:
    -      username: $response.body#/username
    +
    
    +links:
    +  UserRepositories:
    +    # returns array of '#/components/schemas/repository'
    +    operationRef: '#/paths/~12.0~1repositories~1{username}/get'
    +    parameters:
    +      username: $response.body#/username
     

    or an absolute operationRef:

    -
    
    -links:
    -  UserRepositories:
    -    # returns array of '#/components/schemas/repository'
    -    operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get'
    -    parameters:
    -      username: $response.body#/username
    +
    
    +links:
    +  UserRepositories:
    +    # returns array of '#/components/schemas/repository'
    +    operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get'
    +    parameters:
    +      username: $response.body#/username
     

    Note that in the use of operationRef, the escaped forward-slash is necessary when using JSON references.

    @@ -2602,17 +2602,17 @@

    Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. This mechanism is used by Link Objects and Callback Objects.

    The runtime expression is defined by the following [Augmented Backus-Naur Form] syntax

    -
    
    +
    
           expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source )
           source = ( header-reference | query-reference | path-reference | body-reference )  
           header-reference = "header." token
           query-reference = "query." name  
           path-reference = "path." name
           body-reference = "body" ["#" fragment]
    -      fragment = a JSON Pointer [[!rfc6901]]  
    +      fragment = a JSON Pointer [RFC 6901](https://tools.ietf.org/html/rfc6901)  
           name = *( char )
    -      char = as per RFC [7159]section-7)
    -      token = as per RFC [7230]section-3.2.6)
    +      char = as per RFC [7159](https://tools.ietf.org/html/rfc7159#section-7)
    +      token = as per RFC [7230](https://tools.ietf.org/html/rfc7230#section-3.2.6)
     

    The name identifier is case-sensitive, whereas token is not.

    The table below provides examples of runtime expressions and examples of their use in a value:

    @@ -2674,18 +2674,18 @@

    Header Object Example

    A simple header of type integer:

    -
    
    +
    
     {
    -  "description": "The number of allowed requests in the current period",
    -  "schema": {
    -    "type": "integer"
    +  "description": "The number of allowed requests in the current period",
    +  "schema": {
    +    "type": "integer"
       }
     }
     
    -
    
    -description: The number of allowed requests in the current period
    -schema:
    -  type: integer
    +
    
    +description: The number of allowed requests in the current period
    +schema:
    +  type: integer
     

    Tag Object

    Adds metadata to a single tag that is used by the Operation Object. @@ -2719,15 +2719,15 @@

    This object MAY be extended with Specification Extensions.

    Tag Object Example

    -
    
    +
    
     {
    -	"name": "pet",
    -	"description": "Pets operations"
    +	"name": "pet",
    +	"description": "Pets operations"
     }
     
    -
    
    -name: pet
    -description: Pets operations
    +
    
    +name: pet
    +description: Pets operations
     

    Reference Object

    A simple object to allow referencing other components in the specification, internally and externally.

    @@ -2752,31 +2752,31 @@

    This object cannot be extended with additional properties and any properties added SHALL be ignored.

    Reference Object Example

    -
    
    +
    
     {
    -	"$ref": "#/components/schemas/Pet"
    +	"$ref": "#/components/schemas/Pet"
     }
     
    -
    
    -$ref: '#/components/schemas/Pet'
    +
    
    +$ref: '#/components/schemas/Pet'
     

    Relative Schema Document Example

    -
    
    +
    
     {
    -  "$ref": "Pet.json"
    +  "$ref": "Pet.json"
     }
     
    -
    
    -$ref: Pet.yaml
    +
    
    +$ref: Pet.yaml
     

    Relative Documents With Embedded Schema Example

    -
    
    +
    
     {
    -  "$ref": "definitions.json#/Pet"
    +  "$ref": "definitions.json#/Pet"
     }
     
    -
    
    -$ref: definitions.yaml#/Pet
    +
    
    +$ref: definitions.yaml#/Pet
     

    Schema Object

    The Schema Object allows the definition of input and output data types. @@ -2892,152 +2892,152 @@ The XML Object contains additional information about the available options.

    Schema Object Examples

    Primitive Sample
    -
    
    +
    
     {
    -  "type": "string",
    -  "format": "email"
    +  "type": "string",
    +  "format": "email"
     }
     
    -
    
    -type: string
    -format: email
    +
    
    +type: string
    +format: email
     
    Simple Model
    -
    
    +
    
     {
    -  "type": "object",
    -  "required": [
    -    "name"
    +  "type": "object",
    +  "required": [
    +    "name"
       ],
    -  "properties": {
    -    "name": {
    -      "type": "string"
    +  "properties": {
    +    "name": {
    +      "type": "string"
         },
    -    "address": {
    -      "$ref": "#/components/schemas/Address"
    +    "address": {
    +      "$ref": "#/components/schemas/Address"
         },
    -    "age": {
    -      "type": "integer",
    -      "format": "int32",
    -      "minimum": 0
    +    "age": {
    +      "type": "integer",
    +      "format": "int32",
    +      "minimum": 0
         }
       }
     }
     
    -
    
    -type: object
    -required:
    -- name
    -properties:
    -  name:
    -    type: string
    -  address:
    -    $ref: '#/components/schemas/Address'
    -  age:
    -    type: integer
    -    format: int32
    -    minimum: 0
    +
    
    +type: object
    +required:
    +- name
    +properties:
    +  name:
    +    type: string
    +  address:
    +    $ref: '#/components/schemas/Address'
    +  age:
    +    type: integer
    +    format: int32
    +    minimum: 0
     
    Model with Map/Dictionary Properties

    For a simple string to string mapping:

    -
    
    +
    
     {
    -  "type": "object",
    -  "additionalProperties": {
    -    "type": "string"
    +  "type": "object",
    +  "additionalProperties": {
    +    "type": "string"
       }
     }
     
    -
    
    -type: object
    -additionalProperties:
    -  type: string
    +
    
    +type: object
    +additionalProperties:
    +  type: string
     

    For a string to model mapping:

    -
    
    +
    
     {
    -  "type": "object",
    -  "additionalProperties": {
    -    "$ref": "#/components/schemas/ComplexModel"
    +  "type": "object",
    +  "additionalProperties": {
    +    "$ref": "#/components/schemas/ComplexModel"
       }
     }
     
    -
    
    -type: object
    -additionalProperties:
    -  $ref: '#/components/schemas/ComplexModel'
    +
    
    +type: object
    +additionalProperties:
    +  $ref: '#/components/schemas/ComplexModel'
     
    Model with Example
    -
    
    +
    
     {
    -  "type": "object",
    -  "properties": {
    -    "id": {
    -      "type": "integer",
    -      "format": "int64"
    +  "type": "object",
    +  "properties": {
    +    "id": {
    +      "type": "integer",
    +      "format": "int64"
         },
    -    "name": {
    -      "type": "string"
    +    "name": {
    +      "type": "string"
         }
       },
    -  "required": [
    -    "name"
    +  "required": [
    +    "name"
       ],
    -  "example": {
    -    "name": "Puma",
    -    "id": 1
    +  "example": {
    +    "name": "Puma",
    +    "id": 1
       }
     }
     
    -
    
    -type: object
    -properties:
    -  id:
    -    type: integer
    -    format: int64
    -  name:
    -    type: string
    -required:
    -- name
    -example:
    -  name: Puma
    -  id: 1
    +
    
    +type: object
    +properties:
    +  id:
    +    type: integer
    +    format: int64
    +  name:
    +    type: string
    +required:
    +- name
    +example:
    +  name: Puma
    +  id: 1
     
    Models with Composition
    -
    
    +
    
     {
    -  "components": {
    -    "schemas": {
    -      "ErrorModel": {
    -        "type": "object",
    -        "required": [
    -          "message",
    -          "code"
    +  "components": {
    +    "schemas": {
    +      "ErrorModel": {
    +        "type": "object",
    +        "required": [
    +          "message",
    +          "code"
             ],
    -        "properties": {
    -          "message": {
    -            "type": "string"
    +        "properties": {
    +          "message": {
    +            "type": "string"
               },
    -          "code": {
    -            "type": "integer",
    -            "minimum": 100,
    -            "maximum": 600
    +          "code": {
    +            "type": "integer",
    +            "minimum": 100,
    +            "maximum": 600
               }
             }
           },
    -      "ExtendedErrorModel": {
    -        "allOf": [
    +      "ExtendedErrorModel": {
    +        "allOf": [
               {
    -            "$ref": "#/components/schemas/ErrorModel"
    +            "$ref": "#/components/schemas/ErrorModel"
               },
               {
    -            "type": "object",
    -            "required": [
    -              "rootCause"
    +            "type": "object",
    +            "required": [
    +              "rootCause"
                 ],
    -            "properties": {
    -              "rootCause": {
    -                "type": "string"
    +            "properties": {
    +              "rootCause": {
    +                "type": "string"
                   }
                 }
               }
    @@ -3047,100 +3047,100 @@
       }
     }
     
    -
    
    -components:
    -  schemas:
    -    ErrorModel:
    -      type: object
    -      required:
    -      - message
    -      - code
    -      properties:
    -        message:
    -          type: string
    -        code:
    -          type: integer
    -          minimum: 100
    -          maximum: 600
    -    ExtendedErrorModel:
    -      allOf:
    -      - $ref: '#/components/schemas/ErrorModel'
    -      - type: object
    -        required:
    -        - rootCause
    -        properties:
    -          rootCause:
    -            type: string
    +
    
    +components:
    +  schemas:
    +    ErrorModel:
    +      type: object
    +      required:
    +      - message
    +      - code
    +      properties:
    +        message:
    +          type: string
    +        code:
    +          type: integer
    +          minimum: 100
    +          maximum: 600
    +    ExtendedErrorModel:
    +      allOf:
    +      - $ref: '#/components/schemas/ErrorModel'
    +      - type: object
    +        required:
    +        - rootCause
    +        properties:
    +          rootCause:
    +            type: string
     
    Models with Polymorphism Support
    -
    
    +
    
     {
    -  "components": {
    -    "schemas": {
    -      "Pet": {
    -        "type": "object",
    -        "discriminator": {
    -          "propertyName": "petType"
    +  "components": {
    +    "schemas": {
    +      "Pet": {
    +        "type": "object",
    +        "discriminator": {
    +          "propertyName": "petType"
             },
    -        "properties": {
    -          "name": {
    -            "type": "string"
    +        "properties": {
    +          "name": {
    +            "type": "string"
               },
    -          "petType": {
    -            "type": "string"
    +          "petType": {
    +            "type": "string"
               }
             },
    -        "required": [
    -          "name",
    -          "petType"
    +        "required": [
    +          "name",
    +          "petType"
             ]
           },
    -      "Cat": {
    -        "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.",
    -        "allOf": [
    +      "Cat": {
    +        "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.",
    +        "allOf": [
               {
    -            "$ref": "#/components/schemas/Pet"
    +            "$ref": "#/components/schemas/Pet"
               },
               {
    -            "type": "object",
    -            "properties": {
    -              "huntingSkill": {
    -                "type": "string",
    -                "description": "The measured skill for hunting",
    -                "default": "lazy",
    -                "enum": [
    -                  "clueless",
    -                  "lazy",
    -                  "adventurous",
    -                  "aggressive"
    +            "type": "object",
    +            "properties": {
    +              "huntingSkill": {
    +                "type": "string",
    +                "description": "The measured skill for hunting",
    +                "default": "lazy",
    +                "enum": [
    +                  "clueless",
    +                  "lazy",
    +                  "adventurous",
    +                  "aggressive"
                     ]
                   }
                 },
    -            "required": [
    -              "huntingSkill"
    +            "required": [
    +              "huntingSkill"
                 ]
               }
             ]
           },
    -      "Dog": {
    -        "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.",
    -        "allOf": [
    +      "Dog": {
    +        "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.",
    +        "allOf": [
               {
    -            "$ref": "#/components/schemas/Pet"
    +            "$ref": "#/components/schemas/Pet"
               },
               {
    -            "type": "object",
    -            "properties": {
    -              "packSize": {
    -                "type": "integer",
    -                "format": "int32",
    -                "description": "the size of the pack the dog is from",
    -                "default": 0,
    -                "minimum": 0
    +            "type": "object",
    +            "properties": {
    +              "packSize": {
    +                "type": "integer",
    +                "format": "int32",
    +                "description": "the size of the pack the dog is from",
    +                "default": 0,
    +                "minimum": 0
                   }
                 },
    -            "required": [
    -              "packSize"
    +            "required": [
    +              "packSize"
                 ]
               }
             ]
    @@ -3149,51 +3149,51 @@
       }
     }
     
    -
    
    -components:
    -  schemas:
    -    Pet:
    -      type: object
    -      discriminator:
    -        propertyName: petType
    -      properties:
    -        name:
    -          type: string
    -        petType:
    -          type: string
    -      required:
    -      - name
    -      - petType
    -    Cat:  ## "Cat" will be used as the discriminator value
    -      description: A representation of a cat
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        properties:
    -          huntingSkill:
    -            type: string
    -            description: The measured skill for hunting
    -            enum:
    -            - clueless
    -            - lazy
    -            - adventurous
    -            - aggressive
    -        required:
    -        - huntingSkill
    -    Dog:  ## "Dog" will be used as the discriminator value
    -      description: A representation of a dog
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        properties:
    -          packSize:
    -            type: integer
    -            format: int32
    -            description: the size of the pack the dog is from
    -            default: 0
    -            minimum: 0
    -        required:
    -        - packSize
    +
    
    +components:
    +  schemas:
    +    Pet:
    +      type: object
    +      discriminator:
    +        propertyName: petType
    +      properties:
    +        name:
    +          type: string
    +        petType:
    +          type: string
    +      required:
    +      - name
    +      - petType
    +    Cat:  ## "Cat" will be used as the discriminator value
    +      description: A representation of a cat
    +      allOf:
    +      - $ref: '#/components/schemas/Pet'
    +      - type: object
    +        properties:
    +          huntingSkill:
    +            type: string
    +            description: The measured skill for hunting
    +            enum:
    +            - clueless
    +            - lazy
    +            - adventurous
    +            - aggressive
    +        required:
    +        - huntingSkill
    +    Dog:  ## "Dog" will be used as the discriminator value
    +      description: A representation of a dog
    +      allOf:
    +      - $ref: '#/components/schemas/Pet'
    +      - type: object
    +        properties:
    +          packSize:
    +            type: integer
    +            format: int32
    +            description: the size of the pack the dog is from
    +            default: 0
    +            minimum: 0
    +        required:
    +        - packSize
     

    Discriminator Object

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    @@ -3222,7 +3222,7 @@

    The discriminator attribute is legal only when using one of the composite keywords oneOf, anyOf, allOf.

    In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:

    -
    
    +
    
     MyResponseType:
       oneOf:
       - $ref: '#/components/schemas/Cat'
    @@ -3230,7 +3230,7 @@
       - $ref: '#/components/schemas/Lizard'
     

    which means the payload MUST, by validation, match exactly one of the schemas described by Cat, Dog, or Lizard. In this case, a discriminator MAY act as a “hint” to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use:

    -
    
    +
    
     MyResponseType:
       oneOf:
       - $ref: '#/components/schemas/Cat'
    @@ -3240,7 +3240,7 @@
         propertyName: pet_type
     

    The expectation now is that a property with name pet_type MUST be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload:

    -
    
    +
    
     {
       "id": 12345,
       "pet_type": "Cat"
    @@ -3248,7 +3248,7 @@
     

    Will indicate that the Cat schema be used in conjunction with this payload.

    In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional mapping definition MAY be used:

    -
    
    +
    
     MyResponseType:
       oneOf:
       - $ref: '#/components/schemas/Cat'
    @@ -3265,7 +3265,7 @@
     

    When used in conjunction with the anyOf construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload.

    In both the oneOf and anyOf use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an allOf construct may be used as an alternate schema.

    For example:

    -
    
    +
    
     components:
       schemas:
         Pet:
    @@ -3305,14 +3305,14 @@
                 type: boolean
     

    a payload like this:

    -
    
    +
    
     {
       "pet_type": "Cat",
       "name": "misty"
     }
     

    will indicate that the Cat schema be used. Likewise this schema:

    -
    
    +
    
     {
       "pet_type": "cachorro",
       "bark": "soft"
    @@ -3365,294 +3365,294 @@
     

    The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

    No XML Element

    Basic string property:

    -
    
    +
    
     {
    -    "animals": {
    -        "type": "string"
    +    "animals": {
    +        "type": "string"
         }
     }
     
    -
    
    -animals:
    -  type: string
    +
    
    +animals:
    +  type: string
     
    -
    
    -<animals>...</animals>
    +
    
    +<animals>...</animals>
     

    Basic string array property (wrapped is false by default):

    -
    
    +
    
     {
    -    "animals": {
    -        "type": "array",
    -        "items": {
    -            "type": "string"
    +    "animals": {
    +        "type": "array",
    +        "items": {
    +            "type": "string"
             }
         }
     }
     
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    +
    
    +animals:
    +  type: array
    +  items:
    +    type: string
     
    -
    
    -<animals>...</animals>
    -<animals>...</animals>
    -<animals>...</animals>
    +
    
    +<animals>...</animals>
    +<animals>...</animals>
    +<animals>...</animals>
     
    XML Name Replacement
    -
    
    +
    
     {
    -  "animals": {
    -    "type": "string",
    -    "xml": {
    -      "name": "animal"
    +  "animals": {
    +    "type": "string",
    +    "xml": {
    +      "name": "animal"
         }
       }
     }
     
    -
    
    -animals:
    -  type: string
    -  xml:
    -    name: animal
    +
    
    +animals:
    +  type: string
    +  xml:
    +    name: animal
     
    -
    
    -<animal>...</animal>
    +
    
    +<animal>...</animal>
     
    XML Attribute, Prefix and Namespace

    In this example, a full model definition is shown.

    -
    
    +
    
     {
    -  "Person": {
    -    "type": "object",
    -    "properties": {
    -      "id": {
    -        "type": "integer",
    -        "format": "int32",
    -        "xml": {
    -          "attribute": true
    +  "Person": {
    +    "type": "object",
    +    "properties": {
    +      "id": {
    +        "type": "integer",
    +        "format": "int32",
    +        "xml": {
    +          "attribute": true
             }
           },
    -      "name": {
    -        "type": "string",
    -        "xml": {
    -          "namespace": "http://example.com/schema/sample",
    -          "prefix": "sample"
    +      "name": {
    +        "type": "string",
    +        "xml": {
    +          "namespace": "http://example.com/schema/sample",
    +          "prefix": "sample"
             }
           }
         }
       }
     }
     
    -
    
    -Person:
    -  type: object
    -  properties:
    -    id:
    -      type: integer
    -      format: int32
    -      xml:
    -        attribute: true
    -    name:
    -      type: string
    -      xml:
    -        namespace: http://example.com/schema/sample
    -        prefix: sample
    -
    -
    
    -<Person id="123">
    -    <sample:name xmlns:sample="http://example.com/schema/sample">example</sample:name>
    -</Person>
    +
    
    +Person:
    +  type: object
    +  properties:
    +    id:
    +      type: integer
    +      format: int32
    +      xml:
    +        attribute: true
    +    name:
    +      type: string
    +      xml:
    +        namespace: http://example.com/schema/sample
    +        prefix: sample
    +
    +
    
    +<Person id="123">
    +    <sample:name xmlns:sample="http://example.com/schema/sample">example</sample:name>
    +</Person>
     
    XML Arrays

    Changing the element names:

    -
    
    +
    
     {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string",
    +      "xml": {
    +        "name": "animal"
           }
         }
       }
     }
     
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    +
    
    +animals:
    +  type: array
    +  items:
    +    type: string
    +    xml:
    +      name: animal
     
    -
    
    -<animal>value</animal>
    -<animal>value</animal>
    +
    
    +<animal>value</animal>
    +<animal>value</animal>
     

    The external name property has no effect on the XML:

    -
    
    +
    
     {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string",
    +      "xml": {
    +        "name": "animal"
           }
         },
    -    "xml": {
    -      "name": "aliens"
    +    "xml": {
    +      "name": "aliens"
         }
       }
     }
     
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    +
    
    +animals:
    +  type: array
    +  items:
    +    type: string
    +    xml:
    +      name: animal
    +  xml:
    +    name: aliens
     
    -
    
    -<animal>value</animal>
    -<animal>value</animal>
    +
    
    +<animal>value</animal>
    +<animal>value</animal>
     

    Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally:

    -
    
    +
    
     {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string"
         },
    -    "xml": {
    -      "wrapped": true
    +    "xml": {
    +      "wrapped": true
         }
       }
     }
     
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    wrapped: true
    +
    
    +animals:
    +  type: array
    +  items:
    +    type: string
    +  xml:
    +    wrapped: true
     
    -
    
    -<animals>
    -  <animals>value</animals>
    -  <animals>value</animals>
    -</animals>
    +
    
    +<animals>
    +  <animals>value</animals>
    +  <animals>value</animals>
    +</animals>
     

    To overcome the naming problem in the example above, the following definition can be used:

    -
    
    +
    
     {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string",
    +      "xml": {
    +        "name": "animal"
           }
         },
    -    "xml": {
    -      "wrapped": true
    +    "xml": {
    +      "wrapped": true
         }
       }
     }
     
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    wrapped: true
    -
    -
    
    -<animals>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</animals>
    +
    
    +animals:
    +  type: array
    +  items:
    +    type: string
    +    xml:
    +      name: animal
    +  xml:
    +    wrapped: true
    +
    +
    
    +<animals>
    +  <animal>value</animal>
    +  <animal>value</animal>
    +</animals>
     

    Affecting both internal and external names:

    -
    
    +
    
     {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string",
    +      "xml": {
    +        "name": "animal"
           }
         },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    +    "xml": {
    +      "name": "aliens",
    +      "wrapped": true
         }
       }
     }
     
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    
    -<aliens>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</aliens>
    +
    
    +animals:
    +  type: array
    +  items:
    +    type: string
    +    xml:
    +      name: animal
    +  xml:
    +    name: aliens
    +    wrapped: true
    +
    +
    
    +<aliens>
    +  <animal>value</animal>
    +  <animal>value</animal>
    +</aliens>
     

    If we change the external element but not the internal ones:

    -
    
    +
    
     {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    +  "animals": {
    +    "type": "array",
    +    "items": {
    +      "type": "string"
         },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    +    "xml": {
    +      "name": "aliens",
    +      "wrapped": true
         }
       }
     }
     
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    
    -<aliens>
    -  <aliens>value</aliens>
    -  <aliens>value</aliens>
    -</aliens>
    +
    
    +animals:
    +  type: array
    +  items:
    +    type: string
    +  xml:
    +    name: aliens
    +    wrapped: true
    +
    +
    
    +<aliens>
    +  <aliens>value</aliens>
    +  <aliens>value</aliens>
    +</aliens>
     

    Security Scheme Object

    Defines a security scheme that can be used by the operations. -Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [[!rfc6749]], and OpenID Connect Discovery.

    +Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [[!RFC6749]], and OpenID Connect Discovery.

    Fixed Fields

    @@ -3692,7 +3692,7 @@ - + @@ -3717,65 +3717,65 @@

    This object MAY be extended with Specification Extensions.

    Security Scheme Object Example

    Basic Authentication Sample
    -
    
    +
    
     {
    -  "type": "http",
    -  "scheme": "basic"
    +  "type": "http",
    +  "scheme": "basic"
     }
     
    -
    
    -type: http
    -scheme: basic
    +
    
    +type: http
    +scheme: basic
     
    API Key Sample
    -
    
    +
    
     {
    -  "type": "apiKey",
    -  "name": "api_key",
    -  "in": "header"
    +  "type": "apiKey",
    +  "name": "api_key",
    +  "in": "header"
     }
     
    -
    
    -type: apiKey
    -name: api_key
    -in: header
    +
    
    +type: apiKey
    +name: api_key
    +in: header
     
    JWT Bearer Sample
    -
    
    +
    
     {
    -  "type": "http",
    -  "scheme": "bearer",
    -  "bearerFormat": "JWT",
    +  "type": "http",
    +  "scheme": "bearer",
    +  "bearerFormat": "JWT",
     }
     
    -
    
    -type: http
    -scheme: bearer
    -bearerFormat: JWT
    +
    
    +type: http
    +scheme: bearer
    +bearerFormat: JWT
     
    Implicit OAuth2 Sample
    -
    
    +
    
     {
    -  "type": "oauth2",
    -  "flows": {
    -    "implicit": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    +  "type": "oauth2",
    +  "flows": {
    +    "implicit": {
    +      "authorizationUrl": "https://example.com/api/oauth/dialog",
    +      "scopes": {
    +        "write:pets": "modify pets in your account",
    +        "read:pets": "read your pets"
           }
         }
       }
     }
     
    -
    
    -type: oauth2
    -flows: 
    -  implicit:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets
    +
    
    +type: oauth2
    +flows: 
    +  implicit:
    +    authorizationUrl: https://example.com/api/oauth/dialog
    +    scopes:
    +      write:pets: modify pets in your account
    +      read:pets: read your pets
     

    OAuth Flows Object

    Allows configuration of the supported OAuth Flows.

    @@ -3853,42 +3853,42 @@
    scheme string httpREQUIRED. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235]section-5.1).REQUIRED. The name of the HTTP Authorization scheme to be used in the Authorization header as defined in [[!RFC7235]].
    bearerFormat

    This object MAY be extended with Specification Extensions.

    OAuth Flow Object Examples

    -
    
    +
    
     {
    -  "type": "oauth2",
    -  "flows": {
    -    "implicit": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    +  "type": "oauth2",
    +  "flows": {
    +    "implicit": {
    +      "authorizationUrl": "https://example.com/api/oauth/dialog",
    +      "scopes": {
    +        "write:pets": "modify pets in your account",
    +        "read:pets": "read your pets"
           }
         },
    -    "authorizationCode": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "tokenUrl": "https://example.com/api/oauth/token",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    +    "authorizationCode": {
    +      "authorizationUrl": "https://example.com/api/oauth/dialog",
    +      "tokenUrl": "https://example.com/api/oauth/token",
    +      "scopes": {
    +        "write:pets": "modify pets in your account",
    +        "read:pets": "read your pets"
           }
         }
       }
     }
     
    -
    
    -type: oauth2
    -flows: 
    -  implicit:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets
    -  authorizationCode:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    tokenUrl: https://example.com/api/oauth/token
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets 
    +
    
    +type: oauth2
    +flows: 
    +  implicit:
    +    authorizationUrl: https://example.com/api/oauth/dialog
    +    scopes:
    +      write:pets: modify pets in your account
    +      read:pets: read your pets
    +  authorizationCode:
    +    authorizationUrl: https://example.com/api/oauth/dialog
    +    tokenUrl: https://example.com/api/oauth/token
    +    scopes:
    +      write:pets: modify pets in your account
    +      read:pets: read your pets 
     

    Security Requirement Object

    Lists the required security schemes to execute this operation. @@ -3915,27 +3915,27 @@

    Security Requirement Object Examples

    Non-OAuth2 Security Requirement
    -
    
    +
    
     {
    -  "api_key": []
    +  "api_key": []
     }
     
    -
    
    -api_key: []
    +
    
    +api_key: []
     
    OAuth2 Security Requirement
    -
    
    +
    
     {
    -  "petstore_auth": [
    -    "write:pets",
    -    "read:pets"
    +  "petstore_auth": [
    +    "write:pets",
    +    "read:pets"
       ]
     }
     
    -
    
    -petstore_auth:
    -- write:pets
    -- read:pets
    +
    
    +petstore_auth:
    +- write:pets
    +- read:pets
     

    Specification Extensions

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    From 615c4e8dc7dcbc54d4eed26f27ada2b4f45ac93f Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Wed, 13 Jun 2018 00:41:42 +0100 Subject: [PATCH 20/34] Github gist syntax highlighting css --- md2html/gist.css | 71 +++++++++++++++++++++++++++++++++++++++++++++ md2html/md2html.js | 3 +- md2html/respec.html | 2 +- 3 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 md2html/gist.css diff --git a/md2html/gist.css b/md2html/gist.css new file mode 100644 index 0000000000..155f0b9160 --- /dev/null +++ b/md2html/gist.css @@ -0,0 +1,71 @@ +/** + * GitHub Gist Theme + * Author : Louis Barranqueiro - https://github.com/LouisBarranqueiro + */ + +.hljs { + display: block; + background: white; + padding: 0.5em; + color: #333333; + overflow-x: auto; +} + +.hljs-comment, +.hljs-meta { + color: #969896; +} + +.hljs-string, +.hljs-variable, +.hljs-template-variable, +.hljs-strong, +.hljs-emphasis, +.hljs-quote { + color: #df5000; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-type { + color: #a71d5d; +} + +.hljs-literal, +.hljs-symbol, +.hljs-bullet, +.hljs-attribute { + color: #0086b3; +} + +.hljs-section, +.hljs-name { + color: #63a35c; +} + +.hljs-tag { + color: #333333; +} + +.hljs-title, +.hljs-attr, +.hljs-selector-id, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #795da3; +} + +.hljs-addition { + color: #55a532; + background-color: #eaffea; +} + +.hljs-deletion { + color: #bd2c00; + background-color: #ffecec; +} + +.hljs-link { + text-decoration: underline; +} diff --git a/md2html/md2html.js b/md2html/md2html.js index e89e6d95bd..a831df156a 100644 --- a/md2html/md2html.js +++ b/md2html/md2html.js @@ -81,6 +81,7 @@ function preface(title,options) { preface += 'table tr { background-color: #fff; border-top: 1px solid #c6cbd1; }'; preface += 'table tr:nth-child(2n) { background-color: #f6f8fa; }'; preface += 'pre { background-color: #f6f8fa !important; }'; + preface += fs.readFileSync('./gist.css','utf8').split('\n').join(' '); preface += ''; preface += '
    '; preface += 'The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.'; @@ -283,7 +284,7 @@ for (let l in lines) { } -fs.writeFileSync('./md2html.tmp',lines.join('\n'),'utf8'); +//fs.writeFileSync('./md2html.tmp',lines.join('\n'),'utf8'); s = preface('OpenAPI Specification',argv)+'\n\n'+lines.join('\n'); let out = md.render(s); diff --git a/md2html/respec.html b/md2html/respec.html index 9e5daf5bb3..e54bf46820 100644 --- a/md2html/respec.html +++ b/md2html/respec.html @@ -1,4 +1,4 @@ -OpenAPI Specification
    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    Status of This Document

    The source-of-truth for the specification is the GitHub markdown file referenced above.
    +OpenAPI Specification
    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    Status of This Document

    The source-of-truth for the specification is the GitHub markdown file referenced above.

    OpenAPI Specification

    Version 3.0.1

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [[!RFC2119]] [[!RFC8174]] when, and only when, they appear in all capitals, as shown here.

    From 1194d434c5c2c1fdbaf287fd22ccfc8dfbf41b22 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Sat, 15 Feb 2020 13:31:15 +0000 Subject: [PATCH 21/34] md2html: move to scripts dir --- {md2html => scripts/md2html}/.gitignore | 0 {md2html => scripts/md2html}/build.sh | 0 {md2html => scripts/md2html}/gist.css | 0 {md2html => scripts/md2html}/md2html.js | 0 {md2html => scripts/md2html}/respec.html | 0 {md2html => scripts/md2html}/respec.sh | 0 {md2html => scripts/md2html}/style-finish.html | 0 {md2html => scripts/md2html}/style-start.html | 0 {md2html => scripts/md2html}/syntax-github.css | 0 {md2html => scripts/md2html}/v2/2.0.bs | 0 {md2html => scripts/md2html}/v2/heading.bs | 0 {md2html => scripts/md2html}/v2/oas_2.0.html | 0 {md2html => scripts/md2html}/v3/3.0.0.bs | 0 {md2html => scripts/md2html}/v3/3.0.1.bs | 0 {md2html => scripts/md2html}/v3/h3.0.0.bs | 0 {md2html => scripts/md2html}/v3/h3.0.1.bs | 0 {md2html => scripts/md2html}/v3/oas_3.0.0.html | 0 {md2html => scripts/md2html}/v3/oas_3.0.1.html | 0 18 files changed, 0 insertions(+), 0 deletions(-) rename {md2html => scripts/md2html}/.gitignore (100%) rename {md2html => scripts/md2html}/build.sh (100%) rename {md2html => scripts/md2html}/gist.css (100%) rename {md2html => scripts/md2html}/md2html.js (100%) rename {md2html => scripts/md2html}/respec.html (100%) rename {md2html => scripts/md2html}/respec.sh (100%) rename {md2html => scripts/md2html}/style-finish.html (100%) rename {md2html => scripts/md2html}/style-start.html (100%) rename {md2html => scripts/md2html}/syntax-github.css (100%) rename {md2html => scripts/md2html}/v2/2.0.bs (100%) rename {md2html => scripts/md2html}/v2/heading.bs (100%) rename {md2html => scripts/md2html}/v2/oas_2.0.html (100%) rename {md2html => scripts/md2html}/v3/3.0.0.bs (100%) rename {md2html => scripts/md2html}/v3/3.0.1.bs (100%) rename {md2html => scripts/md2html}/v3/h3.0.0.bs (100%) rename {md2html => scripts/md2html}/v3/h3.0.1.bs (100%) rename {md2html => scripts/md2html}/v3/oas_3.0.0.html (100%) rename {md2html => scripts/md2html}/v3/oas_3.0.1.html (100%) diff --git a/md2html/.gitignore b/scripts/md2html/.gitignore similarity index 100% rename from md2html/.gitignore rename to scripts/md2html/.gitignore diff --git a/md2html/build.sh b/scripts/md2html/build.sh similarity index 100% rename from md2html/build.sh rename to scripts/md2html/build.sh diff --git a/md2html/gist.css b/scripts/md2html/gist.css similarity index 100% rename from md2html/gist.css rename to scripts/md2html/gist.css diff --git a/md2html/md2html.js b/scripts/md2html/md2html.js similarity index 100% rename from md2html/md2html.js rename to scripts/md2html/md2html.js diff --git a/md2html/respec.html b/scripts/md2html/respec.html similarity index 100% rename from md2html/respec.html rename to scripts/md2html/respec.html diff --git a/md2html/respec.sh b/scripts/md2html/respec.sh similarity index 100% rename from md2html/respec.sh rename to scripts/md2html/respec.sh diff --git a/md2html/style-finish.html b/scripts/md2html/style-finish.html similarity index 100% rename from md2html/style-finish.html rename to scripts/md2html/style-finish.html diff --git a/md2html/style-start.html b/scripts/md2html/style-start.html similarity index 100% rename from md2html/style-start.html rename to scripts/md2html/style-start.html diff --git a/md2html/syntax-github.css b/scripts/md2html/syntax-github.css similarity index 100% rename from md2html/syntax-github.css rename to scripts/md2html/syntax-github.css diff --git a/md2html/v2/2.0.bs b/scripts/md2html/v2/2.0.bs similarity index 100% rename from md2html/v2/2.0.bs rename to scripts/md2html/v2/2.0.bs diff --git a/md2html/v2/heading.bs b/scripts/md2html/v2/heading.bs similarity index 100% rename from md2html/v2/heading.bs rename to scripts/md2html/v2/heading.bs diff --git a/md2html/v2/oas_2.0.html b/scripts/md2html/v2/oas_2.0.html similarity index 100% rename from md2html/v2/oas_2.0.html rename to scripts/md2html/v2/oas_2.0.html diff --git a/md2html/v3/3.0.0.bs b/scripts/md2html/v3/3.0.0.bs similarity index 100% rename from md2html/v3/3.0.0.bs rename to scripts/md2html/v3/3.0.0.bs diff --git a/md2html/v3/3.0.1.bs b/scripts/md2html/v3/3.0.1.bs similarity index 100% rename from md2html/v3/3.0.1.bs rename to scripts/md2html/v3/3.0.1.bs diff --git a/md2html/v3/h3.0.0.bs b/scripts/md2html/v3/h3.0.0.bs similarity index 100% rename from md2html/v3/h3.0.0.bs rename to scripts/md2html/v3/h3.0.0.bs diff --git a/md2html/v3/h3.0.1.bs b/scripts/md2html/v3/h3.0.1.bs similarity index 100% rename from md2html/v3/h3.0.1.bs rename to scripts/md2html/v3/h3.0.1.bs diff --git a/md2html/v3/oas_3.0.0.html b/scripts/md2html/v3/oas_3.0.0.html similarity index 100% rename from md2html/v3/oas_3.0.0.html rename to scripts/md2html/v3/oas_3.0.0.html diff --git a/md2html/v3/oas_3.0.1.html b/scripts/md2html/v3/oas_3.0.1.html similarity index 100% rename from md2html/v3/oas_3.0.1.html rename to scripts/md2html/v3/oas_3.0.1.html From 0bdc26f99642a80b17de456b478a2cb34f1b8dba Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Sat, 15 Feb 2020 14:22:12 +0000 Subject: [PATCH 22/34] md2html: resolve relative links for examples --- package.json | 5 +- scripts/md2html/md2html.js | 31 +- scripts/md2html/respec.html | 1196 +++++++++++++++++------------------ scripts/md2html/respec.sh | 2 +- 4 files changed, 624 insertions(+), 610 deletions(-) diff --git a/package.json b/package.json index 7ca80b3efd..7d553b94c6 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,9 @@ ], "dependencies": { "cheerio": "^1.0.0-rc.2", - "highlightjs": "^9.10.0", - "markdown-it": "^8.4.0" + "highlight.js": "^9.18.1", + "markdown-it": "^8.4.0", + "yargs": "^12.0.5" }, "devDependencies": { "mdv": "^1.0.7", diff --git a/scripts/md2html/md2html.js b/scripts/md2html/md2html.js index a831df156a..e2b22b8456 100644 --- a/scripts/md2html/md2html.js +++ b/scripts/md2html/md2html.js @@ -11,15 +11,20 @@ highlight.js does a better job than bikeshed's Pygments) */ **/ const fs = require('fs'); +const url = require('url'); const util = require('util'); -const hljs = require('highlightjs/highlight.pack.js'); +const hljs = require('highlight.js'); const cheerio = require('cheerio'); let argv = require('yargs') + .boolean('bikeshed') + .alias('b','bikeshed') + .describe('bikeshed','Output in bikeshed format') .boolean('respec') .alias('r','respec') - .describe('respec','Output in respec format, default bikeshed') + .describe('respec','Output in respec format') + .default('respec',true) .string('maintainers') .alias('m','maintainers') .describe('maintainers','path to MAINTAINERS.md') @@ -67,7 +72,7 @@ function preface(title,options) { let preface = `${md.utils.escapeHtml(title)}`; if (options.respec) { - preface += ''; + preface += ''; preface += ``; preface += ''; preface += '
    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    Status of This Document

    The source-of-truth for the specification is the GitHub markdown file referenced above.
    +OpenAPI Specification
    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    Status of This Document

    The source-of-truth for the specification is the GitHub markdown file referenced above.

    OpenAPI Specification

    Version 3.0.1

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [[!RFC2119]] [[!RFC8174]] when, and only when, they appear in all capitals, as shown here.

    @@ -277,14 +277,14 @@
    
     title: Sample Pet Store App
     description: This is a sample server for a pet store.
    -termsOfService: http://example.com/terms/
    +termsOfService: http://example.com/terms/
     contact:
    -  name: API Support
    -  url: http://www.example.com/support
    -  email: support@example.com
    +  name: API Support
    +  url: http://www.example.com/support
    +  email: support@example.com
     license:
    -  name: Apache 2.0
    -  url: https://www.apache.org/licenses/LICENSE-2.0.html
    +  name: Apache 2.0
    +  url: https://www.apache.org/licenses/LICENSE-2.0.html
     version: 1.0.1
     

    Contact Object

    @@ -327,7 +327,7 @@
    
     name: API Support
    -url: http://www.example.com/support
    +url: http://www.example.com/support
     email: support@example.com
     

    License Object

    @@ -364,7 +364,7 @@
    
     name: Apache 2.0
    -url: https://www.apache.org/licenses/LICENSE-2.0.html
    +url: https://www.apache.org/licenses/LICENSE-2.0.html
     

    Server Object

    An object representing a Server.

    @@ -405,7 +405,7 @@ }
    
    -url: https://development.gigantic-server.com/v1
    +url: https://development.gigantic-server.com/v1
     description: Development server
     

    The following shows how multiple servers can be described, for example, at the OpenAPI Object’s servers:

    @@ -429,12 +429,12 @@
    
     servers:
    -- url: https://development.gigantic-server.com/v1
    -  description: Development server
    -- url: https://staging.gigantic-server.com/v1
    -  description: Staging server
    -- url: https://api.gigantic-server.com/v1
    -  description: Production server
    +- url: https://development.gigantic-server.com/v1
    +  description: Development server
    +- url: https://staging.gigantic-server.com/v1
    +  description: Staging server
    +- url: https://api.gigantic-server.com/v1
    +  description: Production server
     

    The following shows how variables can be used for a server configuration:

    
    @@ -465,21 +465,21 @@
     
    
     servers:
    -- url: https://{username}.gigantic-server.com:{port}/{basePath}
    -  description: The production API server
    -  variables:
    -    username:
    +- url: https://{username}.gigantic-server.com:{port}/{basePath}
    +  description: The production API server
    +  variables:
    +    username:
           # note! no enum here means it is an open value
    -      default: demo
    -      description: this value is assigned by the service provider, in this example `gigantic-server.com`
    -    port:
    -      enum:
    -        - '8443'
    -        - '443'
    -      default: '8443'
    -    basePath:
    +      default: demo
    +      description: this value is assigned by the service provider, in this example `gigantic-server.com`
    +    port:
    +      enum:
    +        - '8443'
    +        - '443'
    +      default: '8443'
    +    basePath:
           # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2`
    -      default: v2
    +      default: v2
     

    Server Variable Object

    An object representing a Server Variable for server URL template substitution.

    @@ -673,64 +673,64 @@
    
     components:
    -  schemas:
    -    Category:
    -      type: object
    -      properties:
    -        id:
    -          type: integer
    -          format: int64
    -        name:
    -          type: string
    -    Tag:
    -      type: object
    -      properties:
    -        id:
    -          type: integer
    -          format: int64
    -        name:
    -          type: string
    -  parameters:
    -    skipParam:
    -      name: skip
    -      in: query
    -      description: number of items to skip
    -      required: true
    -      schema:
    -        type: integer
    -        format: int32
    -    limitParam:
    -      name: limit
    -      in: query
    -      description: max records to return
    -      required: true
    -      schema:
    -        type: integer
    -        format: int32
    -  responses:
    -    NotFound:
    -      description: Entity not found.
    -    IllegalInput:
    -      description: Illegal input for operation.
    -    GeneralError:
    -      description: General Error
    -      content:
    -        application/json:
    -          schema:
    +  schemas:
    +    Category:
    +      type: object
    +      properties:
    +        id:
    +          type: integer
    +          format: int64
    +        name:
    +          type: string
    +    Tag:
    +      type: object
    +      properties:
    +        id:
    +          type: integer
    +          format: int64
    +        name:
    +          type: string
    +  parameters:
    +    skipParam:
    +      name: skip
    +      in: query
    +      description: number of items to skip
    +      required: true
    +      schema:
    +        type: integer
    +        format: int32
    +    limitParam:
    +      name: limit
    +      in: query
    +      description: max records to return
    +      required: true
    +      schema:
    +        type: integer
    +        format: int32
    +  responses:
    +    NotFound:
    +      description: Entity not found.
    +    IllegalInput:
    +      description: Illegal input for operation.
    +    GeneralError:
    +      description: General Error
    +      content:
    +        application/json:
    +          schema:
                 $ref: '#/components/schemas/GeneralError'
    -  securitySchemes:
    -    api_key:
    -      type: apiKey
    -      name: api_key
    -      in: header
    -    petstore_auth:
    -      type: oauth2
    -      flows: 
    -        implicit:
    -          authorizationUrl: http://example.org/api/oauth/dialog
    -          scopes:
    -            write:pets: modify pets in your account
    -            read:pets: read your pets
    +  securitySchemes:
    +    api_key:
    +      type: apiKey
    +      name: api_key
    +      in: header
    +    petstore_auth:
    +      type: oauth2
    +      flows: 
    +        implicit:
    +          authorizationUrl: http://example.org/api/oauth/dialog
    +          scopes:
    +            write:pets: modify pets in your account
    +            read:pets: read your pets
     

    Paths Object

    Holds the relative paths to the individual endpoints and their operations. @@ -796,16 +796,16 @@

    
     /pets:
    -  get:
    -    description: Returns all pets from the system that the user has access to
    -    responses:
    -      '200':
    -        description: A list of pets.
    -        content:
    -          application/json:
    -            schema:
    -              type: array
    -              items:
    +  get:
    +    description: Returns all pets from the system that the user has access to
    +    responses:
    +      '200':
    +        description: A list of pets.
    +        content:
    +          application/json:
    +            schema:
    +              type: array
    +              items:
                     $ref: '#/components/schemas/pet'
     

    Path Item Object

    @@ -942,34 +942,34 @@
    
     get:
    -  description: Returns pets based on ID
    -  summary: Find pets by ID
    -  operationId: getPetsById
    -  responses:
    -    '200':
    -      description: pet response
    -      content:
    +  description: Returns pets based on ID
    +  summary: Find pets by ID
    +  operationId: getPetsById
    +  responses:
    +    '200':
    +      description: pet response
    +      content:
             '*/*' :
    -          schema:
    -            type: array
    -            items:
    +          schema:
    +            type: array
    +            items:
                   $ref: '#/components/schemas/Pet'
    -    default:
    -      description: error payload
    -      content:
    -        'text/html':
    -          schema:
    +    default:
    +      description: error payload
    +      content:
    +        'text/html':
    +          schema:
                 $ref: '#/components/schemas/ErrorModel'
     parameters:
    -- name: id
    -  in: path
    -  description: ID of pet to use
    -  required: true
    -  schema:
    -    type: array
    -    style: simple
    -    items:
    -      type: string  
    +- name: id
    +  in: path
    +  description: ID of pet to use
    +  required: true
    +  schema:
    +    type: array
    +    style: simple
    +    items:
    +      type: string  
     

    Operation Object

    Describes a single API operation on a path.

    @@ -1117,40 +1117,40 @@ summary: Updates a pet in the store with form data operationId: updatePetWithForm parameters: -- name: petId - in: path - description: ID of pet that needs to be updated - required: true - schema: - type: string +- name: petId + in: path + description: ID of pet that needs to be updated + required: true + schema: + type: string requestBody: - content: - 'application/x-www-form-urlencoded': - schema: - properties: - name: - description: Updated name of the pet - type: string - status: - description: Updated status of the pet - type: string - required: - - status + content: + 'application/x-www-form-urlencoded': + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + required: + - status responses: - '200': - description: Pet updated. - content: - 'application/json': {} - 'application/xml': {} - '405': - description: Invalid input - content: - 'application/json': {} - 'application/xml': {} + '200': + description: Pet updated. + content: + 'application/json': {} + 'application/xml': {} + '405': + description: Invalid input + content: + 'application/json': {} + 'application/xml': {} security: -- petstore_auth: - - write:pets - - read:pets +- petstore_auth: + - write:pets + - read:pets

    External Documentation Object

    Allows referencing an external resource for extended documentation.

    @@ -1186,7 +1186,7 @@
    
     description: Find more info here
    -url: https://example.com
    +url: https://example.com
     

    Parameter Object

    Describes a single operation parameter.

    @@ -1494,10 +1494,10 @@ description: token to be passed as a header required: true schema: - type: array - items: - type: integer - format: int64 + type: array + items: + type: integer + format: int64 style: simple

    A path parameter of a string value:

    @@ -1518,7 +1518,7 @@ description: username to fetch required: true schema: - type: string + type: string

    An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

    
    @@ -1543,9 +1543,9 @@
     description: ID of the object to fetch
     required: false
     schema:
    -  type: array
    -  items:
    -    type: string
    +  type: array
    +  items:
    +    type: string
     style: form
     explode: true
     
    @@ -1567,9 +1567,9 @@ in: query name: freeForm schema: - type: object - additionalProperties: - type: integer + type: object + additionalProperties: + type: integer style: form

    A complex parameter using content to define serialization:

    @@ -1602,17 +1602,17 @@ in: query name: coordinates content: - application/json: - schema: - type: object - required: - - lat - - long - properties: - lat: - type: number - long: - type: number + application/json: + schema: + type: object + required: + - lat + - long + properties: + lat: + type: number + long: + type: number

    Request Body Object

    Describes a single request body.

    @@ -1694,30 +1694,30 @@
    
     description: user to add to the system
     content: 
    -  'application/json':
    -    schema:
    +  'application/json':
    +    schema:
           $ref: '#/components/schemas/User'
    -    examples:
    -      user:
    -        summary: User Example
    -        externalValue: 'http://foo.bar/examples/user-example.json'
    -  'application/xml':
    -    schema:
    +    examples:
    +      user:
    +        summary: User Example
    +        externalValue: 'http://foo.bar/examples/user-example.json'
    +  'application/xml':
    +    schema:
           $ref: '#/components/schemas/User'
    -    examples:
    -      user:
    -        summary: User Example in XML
    -        externalValue: 'http://foo.bar/examples/user-example.xml'
    -  'text/plain':
    -    examples:
    -      user:
    -        summary: User example in text plain format
    -        externalValue: 'http://foo.bar/examples/user-example.txt'
    +    examples:
    +      user:
    +        summary: User Example in XML
    +        externalValue: 'http://foo.bar/examples/user-example.xml'
    +  'text/plain':
    +    examples:
    +      user:
    +        summary: User example in text plain format
    +        externalValue: 'http://foo.bar/examples/user-example.txt'
       '*/*':
    -    examples:
    -      user: 
    -        summary: User example in other format
    -        externalValue: 'http://foo.bar/examples/user-example.whatever'
    +    examples:
    +      user: 
    +        summary: User example in other format
    +        externalValue: 'http://foo.bar/examples/user-example.whatever'
     

    A body parameter that is an array of string values:

    
    @@ -1739,11 +1739,11 @@
     description: user to add to the system
     required: true
     content:
    -  text/plain:
    -    schema:
    -      type: array
    -      items:
    -        type: string
    +  text/plain:
    +    schema:
    +      type: array
    +      items:
    +        type: string
     

    Media Type Object

    Each Media Type Object provides schema and examples for the media type identified by its key.

    @@ -1817,27 +1817,27 @@ }
    
    -application/json: 
    -  schema:
    +application/json: 
    +  schema:
         $ref: "#/components/schemas/Pet"
    -  examples:
    -    cat:
    -      summary: An example of a cat
    -      value:
    -        name: Fluffy
    -        petType: Cat
    -        color: White
    -        gender: male
    -        breed: Persian
    -    dog:
    -      summary: An example of a dog with a cat's name
    -      value:
    -        name: Puma
    -        petType: Dog
    -        color: Black
    -        gender: Female
    -        breed: Mixed
    -    frog:
    +  examples:
    +    cat:
    +      summary: An example of a cat
    +      value:
    +        name: Fluffy
    +        petType: Cat
    +        color: White
    +        gender: male
    +        breed: Persian
    +    dog:
    +      summary: An example of a dog with a cat's name
    +      value:
    +        name: Puma
    +        petType: Dog
    +        color: Black
    +        gender: Female
    +        breed: Mixed
    +    frog:
           $ref: "#/components/examples/frog-example"
     

    Considerations for File Uploads

    @@ -1845,55 +1845,55 @@
    
     # content transferred with base64 encoding
     schema:
    -  type: string
    -  format: base64
    +  type: string
    +  format: base64
     
    
     # content transferred in binary (octet-stream):
     schema:
    -  type: string
    -  format: binary
    +  type: string
    +  format: binary
     

    These examples apply to either input payloads of file uploads or response payloads.

    A requestBody for submitting a file in a POST operation may look like the following example:

    
     requestBody:
    -  content:
    -    application/octet-stream:
    +  content:
    +    application/octet-stream:
           # any media type is accepted, functionally equivalent to `*/*`
    -      schema:
    +      schema:
             # a binary file of any type
    -        type: string
    -        format: binary
    +        type: string
    +        format: binary
     

    In addition, specific media types MAY be specified:

    
     # multiple, specific media types may be specified:
     requestBody:
    -  content:
    +  content:
           # a binary file of type png or jpeg
    -    'image/jpeg':
    -      schema:
    -        type: string
    -        format: binary
    -    'image/png':
    -      schema:
    -        type: string
    -        format: binary        
    +    'image/jpeg':
    +      schema:
    +        type: string
    +        format: binary
    +    'image/png':
    +      schema:
    +        type: string
    +        format: binary        
     

    To upload multiple files, a multipart media type MUST be used:

    
     requestBody:
    -  content:
    -    multipart/form-data:
    -      schema:
    -        properties:
    +  content:
    +    multipart/form-data:
    +      schema:
    +        properties:
               # The property name 'file' will be used for all files.
    -          file:
    -            type: array
    -            items:
    -              type: string
    -              format: binary
    +          file:
    +            type: array
    +            items:
    +              type: string
    +              format: binary
     
     

    Support for x-www-form-urlencoded Request Bodies

    @@ -1901,18 +1901,18 @@ definition may be used:

    
     requestBody:
    -  content:
    -    application/x-www-form-urlencoded:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            type: string
    -            format: uuid
    -          address:
    +  content:
    +    application/x-www-form-urlencoded:
    +      schema:
    +        type: object
    +        properties:
    +          id:
    +            type: string
    +            format: uuid
    +          address:
                 # complex types are stringified to support RFC 1866
    -            type: object
    -            properties: {}
    +            type: object
    +            properties: {}
     

    In this example, the contents in the requestBody MUST be stringified per [[!RFC1866]] when passed to the server. In addition, the address field complex object will be stringified.

    When passing complex objects in the application/x-www-form-urlencoded content type, the default serialization strategy of such properties is described in the Encoding Object's style property as form.

    @@ -1927,32 +1927,32 @@

    Examples:

    
     requestBody:
    -  content:
    -    multipart/form-data:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            type: string
    -            format: uuid
    -          address:
    +  content:
    +    multipart/form-data:
    +      schema:
    +        type: object
    +        properties:
    +          id:
    +            type: string
    +            format: uuid
    +          address:
                 # default Content-Type for objects is `application/json`
    -            type: object
    -            properties: {}
    -          profileImage:
    +            type: object
    +            properties: {}
    +          profileImage:
                 # default Content-Type for string/binary is `application/octet-stream`
    -            type: string
    -            format: binary
    -          children:
    +            type: string
    +            format: binary
    +          children:
                 # default Content-Type for arrays is based on the `inner` type (text/plain here)
    -            type: array
    -            items:
    -              type: string
    -          addresses:
    +            type: array
    +            items:
    +              type: string
    +          addresses:
                 # default Content-Type for arrays is based on the `inner` type (object shown, so `application/json` in this example)
    -            type: array
    -            items:
    -              type: '#/components/schemas/Address'
    +            type: array
    +            items:
    +              type: '#/components/schemas/Address'
     

    An encoding attribute is introduced to give you control over the serialization of parts of multipart request bodies. This attribute is only applicable to multipart and application/x-www-form-urlencoded request bodies.

    Encoding Object

    @@ -1998,40 +1998,40 @@

    Encoding Object Example

    
     requestBody:
    -  content:
    -    multipart/mixed:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    +  content:
    +    multipart/mixed:
    +      schema:
    +        type: object
    +        properties:
    +          id:
                 # default is text/plain
    -            type: string
    -            format: uuid
    -          address:
    +            type: string
    +            format: uuid
    +          address:
                 # default is application/json
    -            type: object
    -            properties: {}
    -          historyMetadata:
    +            type: object
    +            properties: {}
    +          historyMetadata:
                 # need to declare XML format!
    -            description: metadata in XML format
    -            type: object
    -            properties: {}
    -          profileImage:
    +            description: metadata in XML format
    +            type: object
    +            properties: {}
    +          profileImage:
                 # default is application/octet-stream, need to declare an image type only!
    -            type: string
    -            format: binary
    -      encoding:
    -        historyMetadata:
    +            type: string
    +            format: binary
    +      encoding:
    +        historyMetadata:
               # require XML Content-Type in utf-8 encoding
    -          contentType: application/xml; charset=utf-8
    -        profileImage:
    +          contentType: application/xml; charset=utf-8
    +        profileImage:
               # only accept png/jpeg
    -          contentType: image/png, image/jpeg
    -          headers:
    -            X-Rate-Limit-Limit:
    -              description: The number of allowed requests in the current period
    -              schema:
    -                type: integer
    +          contentType: image/png, image/jpeg
    +          headers:
    +            X-Rate-Limit-Limit:
    +              description: The number of allowed requests in the current period
    +              schema:
    +                type: integer
     

    Responses Object

    A container for the expected responses of an operation. @@ -2104,17 +2104,17 @@ }

    
    -'200':
    -  description: a pet to be returned
    -  content: 
    -    application/json:
    -      schema:
    +'200':
    +  description: a pet to be returned
    +  content: 
    +    application/json:
    +      schema:
             $ref: '#/components/schemas/Pet'
     default:
    -  description: Unexpected error
    -  content:
    -    application/json:
    -      schema:
    +  description: Unexpected error
    +  content:
    +    application/json:
    +      schema:
             $ref: '#/components/schemas/ErrorModel'
     

    Response Object

    @@ -2173,10 +2173,10 @@
    
     description: A complex object array response
     content: 
    -  application/json:
    -    schema: 
    -      type: array
    -      items:
    +  application/json:
    +    schema: 
    +      type: array
    +      items:
             $ref: '#/components/schemas/VeryComplexType'
     

    Response with a string type:

    @@ -2196,9 +2196,9 @@
    
     description: A simple string response
     content:
    -  text/plain:
    -    schema:
    -      type: string
    +  text/plain:
    +    schema:
    +      type: string
     

    Plain text response with headers:

    
    @@ -2236,23 +2236,23 @@
     
    
     description: A simple string response
     content:
    -  text/plain:
    -    schema:
    -      type: string
    -    example: 'whoa!'
    +  text/plain:
    +    schema:
    +      type: string
    +    example: 'whoa!'
     headers:
    -  X-Rate-Limit-Limit:
    -    description: The number of allowed requests in the current period
    -    schema:
    -      type: integer
    -  X-Rate-Limit-Remaining:
    -    description: The number of remaining requests in the current period
    -    schema:
    -      type: integer
    -  X-Rate-Limit-Reset:
    -    description: The number of seconds left in the current period
    -    schema:
    -      type: integer
    +  X-Rate-Limit-Limit:
    +    description: The number of allowed requests in the current period
    +    schema:
    +      type: integer
    +  X-Rate-Limit-Remaining:
    +    description: The number of remaining requests in the current period
    +    schema:
    +      type: integer
    +  X-Rate-Limit-Reset:
    +    description: The number of seconds left in the current period
    +    schema:
    +      type: integer
     

    Response with no return value:

    
    @@ -2280,7 +2280,7 @@
     
      {expression}
     Path Item Object
    -A Path Item Object used to define a callback request and expected responses.  A complete example is available.
    +A Path Item Object used to define a callback request and expected responses.  A complete example is available.
     
     
     
    @@ -2357,16 +2357,16 @@
     
    
     myWebhook:
       'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
    -    post:
    -      requestBody:
    -        description: Callback payload
    -        content: 
    -          'application/json':
    -            schema:
    +    post:
    +      requestBody:
    +        description: Callback payload
    +        content: 
    +          'application/json':
    +            schema:
                   $ref: '#/components/schemas/SomePayload'
    -      responses:
    -        '200':
    -          description: webhook successfully processed and no retries will be performed
    +      responses:
    +        '200':
    +          description: webhook successfully processed and no retries will be performed
     

    Example Object

    Fixed Fields

    @@ -2409,59 +2409,59 @@
    
     # in a model
     schemas:
    -  properties:
    -    name:
    -      type: string
    -      examples:
    -        name:
    -          $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example
    +  properties:
    +    name:
    +      type: string
    +      examples:
    +        name:
    +          $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example
     
     # in a request body:
    -  requestBody:
    -    content:
    -      'application/json':
    -        schema:
    +  requestBody:
    +    content:
    +      'application/json':
    +        schema:
               $ref: '#/components/schemas/Address'
    -        examples: 
    -          foo:
    -            summary: A foo example
    -            value: {"foo": "bar"}
    -          bar:
    -            summary: A bar example
    -            value: {"bar": "baz"}
    -      'application/xml':
    -        examples: 
    -          xmlExample:
    -            summary: This is an example in XML
    -            externalValue: 'http://example.org/examples/address-example.xml'
    -      'text/plain':
    -        examples:
    -          textExample: 
    -            summary: This is a text example
    -            externalValue: 'http://foo.bar/examples/address-example.txt' 
    +        examples: 
    +          foo:
    +            summary: A foo example
    +            value: {"foo": "bar"}
    +          bar:
    +            summary: A bar example
    +            value: {"bar": "baz"}
    +      'application/xml':
    +        examples: 
    +          xmlExample:
    +            summary: This is an example in XML
    +            externalValue: 'http://example.org/examples/address-example.xml'
    +      'text/plain':
    +        examples:
    +          textExample: 
    +            summary: This is a text example
    +            externalValue: 'http://foo.bar/examples/address-example.txt' 
     
     
     # in a parameter
    -  parameters:
    -    - name: 'zipCode'
    -      in: 'query'
    -      schema:
    -        type: 'string'
    -        format: 'zip-code'
    -        examples:
    -          zip-example: 
    +  parameters:
    +    - name: 'zipCode'
    +      in: 'query'
    +      schema:
    +        type: 'string'
    +        format: 'zip-code'
    +        examples:
    +          zip-example: 
                 $ref: '#/components/examples/zip-example'
     
     # in a response
    -  responses:
    -    '200':
    -      description: your car appointment has been booked
    -      content: 
    -        application/json:
    -          schema:
    +  responses:
    +    '200':
    +      description: your car appointment has been booked
    +      content: 
    +        application/json:
    +          schema:
                 $ref: '#/components/schemas/SuccessResponse'
    -          examples:
    -            confirmation-success:
    +          examples:
    +            confirmation-success:
                   $ref: '#/components/examples/confirmation-success'
     

    Link Object

    @@ -2521,57 +2521,57 @@
    
     paths:
       /users/{id}:
    -    parameters:
    -    - name: id
    -      in: path
    -      required: true
    -      description: the user identifier, as userId 
    -      schema:
    -        type: string
    -    get:
    -      responses:
    -        '200':
    -          description: the user being returned
    -          content:
    -            application/json:
    -              schema:
    -                type: object
    -                properties:
    -                  uuid: # the unique user id
    -                    type: string
    -                    format: uuid
    -          links:
    -            address:
    +    parameters:
    +    - name: id
    +      in: path
    +      required: true
    +      description: the user identifier, as userId 
    +      schema:
    +        type: string
    +    get:
    +      responses:
    +        '200':
    +          description: the user being returned
    +          content:
    +            application/json:
    +              schema:
    +                type: object
    +                properties:
    +                  uuid: # the unique user id
    +                    type: string
    +                    format: uuid
    +          links:
    +            address:
                   # the target link operationId
    -              operationId: getUserAddress
    -              parameters:
    +              operationId: getUserAddress
    +              parameters:
                     # get the `id` field from the request path parameter named `id`
    -                userId: $request.path.id
    +                userId: $request.path.id
       # the path item of the linked operation
       /users/{userid}/address:
    -    parameters:
    -    - name: userid
    -      in: path
    -      required: true
    -      description: the user identifier, as userId 
    -      schema:
    -        type: string
    +    parameters:
    +    - name: userid
    +      in: path
    +      required: true
    +      description: the user identifier, as userId 
    +      schema:
    +        type: string
         # linked operation
    -    get:
    -      operationId: getUserAddress
    -      responses:
    -        '200':
    -          description: the user's address
    +    get:
    +      operationId: getUserAddress
    +      responses:
    +        '200':
    +          description: the user's address
     

    When a runtime expression fails to evaluate, no parameter value is passed to the target operation.

    Values from the response body can be used to drive a linked operation.

    
     links:
    -  address:
    -    operationId: getUserAddressByUUID
    -    parameters:
    +  address:
    +    operationId: getUserAddressByUUID
    +    parameters:
           # get the `uuid` field from the `uuid` field in the response body
    -      userUuid: $response.body#/uuid
    +      userUuid: $response.body#/uuid
     

    Clients follow all links at their discretion. Neither permissions, nor the capability to make a successful call to that link, is guaranteed @@ -2581,27 +2581,27 @@ value), references MAY also be made through a relative operationRef:

    
     links:
    -  UserRepositories:
    +  UserRepositories:
         # returns array of '#/components/schemas/repository'
    -    operationRef: '#/paths/~12.0~1repositories~1{username}/get'
    -    parameters:
    -      username: $response.body#/username
    +    operationRef: '#/paths/~12.0~1repositories~1{username}/get'
    +    parameters:
    +      username: $response.body#/username
     

    or an absolute operationRef:

    
     links:
    -  UserRepositories:
    +  UserRepositories:
         # returns array of '#/components/schemas/repository'
    -    operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get'
    -    parameters:
    -      username: $response.body#/username
    +    operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get'
    +    parameters:
    +      username: $response.body#/username
     

    Note that in the use of operationRef, the escaped forward-slash is necessary when using JSON references.

    Runtime Expressions

    Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. This mechanism is used by Link Objects and Callback Objects.

    -

    The runtime expression is defined by the following [Augmented Backus-Naur Form] syntax

    +

    The runtime expression is defined by the following [ABNF] syntax

    
           expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source )
           source = ( header-reference | query-reference | path-reference | body-reference )  
    @@ -2685,7 +2685,7 @@
     
    
     description: The number of allowed requests in the current period
     schema:
    -  type: integer
    +  type: integer
     

    Tag Object

    Adds metadata to a single tag that is used by the Operation Object. @@ -2929,14 +2929,14 @@ required: - name properties: - name: - type: string - address: + name: + type: string + address: $ref: '#/components/schemas/Address' - age: - type: integer - format: int32 - minimum: 0 + age: + type: integer + format: int32 + minimum: 0

    Model with Map/Dictionary Properties

    For a simple string to string mapping:

    @@ -2951,7 +2951,7 @@
    
     type: object
     additionalProperties:
    -  type: string
    +  type: string
     

    For a string to model mapping:

    
    @@ -2992,16 +2992,16 @@
     
    
     type: object
     properties:
    -  id:
    -    type: integer
    -    format: int64
    -  name:
    -    type: string
    +  id:
    +    type: integer
    +    format: int64
    +  name:
    +    type: string
     required:
     - name
     example:
    -  name: Puma
    -  id: 1
    +  name: Puma
    +  id: 1
     
    Models with Composition
    
    @@ -3049,28 +3049,28 @@
     
    
     components:
    -  schemas:
    -    ErrorModel:
    -      type: object
    -      required:
    -      - message
    -      - code
    -      properties:
    -        message:
    -          type: string
    -        code:
    -          type: integer
    -          minimum: 100
    -          maximum: 600
    -    ExtendedErrorModel:
    -      allOf:
    -      - $ref: '#/components/schemas/ErrorModel'
    -      - type: object
    -        required:
    -        - rootCause
    -        properties:
    -          rootCause:
    -            type: string
    +  schemas:
    +    ErrorModel:
    +      type: object
    +      required:
    +      - message
    +      - code
    +      properties:
    +        message:
    +          type: string
    +        code:
    +          type: integer
    +          minimum: 100
    +          maximum: 600
    +    ExtendedErrorModel:
    +      allOf:
    +      - $ref: '#/components/schemas/ErrorModel'
    +      - type: object
    +        required:
    +        - rootCause
    +        properties:
    +          rootCause:
    +            type: string
     
    Models with Polymorphism Support
    
    @@ -3151,49 +3151,49 @@
     
    
     components:
    -  schemas:
    -    Pet:
    -      type: object
    -      discriminator:
    -        propertyName: petType
    -      properties:
    -        name:
    -          type: string
    -        petType:
    -          type: string
    -      required:
    -      - name
    -      - petType
    -    Cat:  ## "Cat" will be used as the discriminator value
    -      description: A representation of a cat
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        properties:
    -          huntingSkill:
    -            type: string
    -            description: The measured skill for hunting
    -            enum:
    -            - clueless
    -            - lazy
    -            - adventurous
    -            - aggressive
    -        required:
    -        - huntingSkill
    -    Dog:  ## "Dog" will be used as the discriminator value
    -      description: A representation of a dog
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        properties:
    -          packSize:
    -            type: integer
    -            format: int32
    -            description: the size of the pack the dog is from
    -            default: 0
    -            minimum: 0
    -        required:
    -        - packSize
    +  schemas:
    +    Pet:
    +      type: object
    +      discriminator:
    +        propertyName: petType
    +      properties:
    +        name:
    +          type: string
    +        petType:
    +          type: string
    +      required:
    +      - name
    +      - petType
    +    Cat:  ## "Cat" will be used as the discriminator value
    +      description: A representation of a cat
    +      allOf:
    +      - $ref: '#/components/schemas/Pet'
    +      - type: object
    +        properties:
    +          huntingSkill:
    +            type: string
    +            description: The measured skill for hunting
    +            enum:
    +            - clueless
    +            - lazy
    +            - adventurous
    +            - aggressive
    +        required:
    +        - huntingSkill
    +    Dog:  ## "Dog" will be used as the discriminator value
    +      description: A representation of a dog
    +      allOf:
    +      - $ref: '#/components/schemas/Pet'
    +      - type: object
    +        properties:
    +          packSize:
    +            type: integer
    +            format: int32
    +            description: the size of the pack the dog is from
    +            default: 0
    +            minimum: 0
    +        required:
    +        - packSize
     

    Discriminator Object

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    @@ -3374,7 +3374,7 @@
    
     animals:
    -  type: string
    +  type: string
     
    
     <animals>...</animals>
    @@ -3392,9 +3392,9 @@
     
    
     animals:
    -  type: array
    -  items:
    -    type: string
    +  type: array
    +  items:
    +    type: string
     
    
     <animals>...</animals>
    @@ -3414,9 +3414,9 @@
     
    
     animals:
    -  type: string
    -  xml:
    -    name: animal
    +  type: string
    +  xml:
    +    name: animal
     
    
     <animal>...</animal>
    @@ -3448,18 +3448,18 @@
     
    
     Person:
    -  type: object
    -  properties:
    -    id:
    -      type: integer
    -      format: int32
    -      xml:
    -        attribute: true
    -    name:
    -      type: string
    -      xml:
    -        namespace: http://example.com/schema/sample
    -        prefix: sample
    +  type: object
    +  properties:
    +    id:
    +      type: integer
    +      format: int32
    +      xml:
    +        attribute: true
    +    name:
    +      type: string
    +      xml:
    +        namespace: http://example.com/schema/sample
    +        prefix: sample
     
    
     <Person id="123">
    @@ -3483,11 +3483,11 @@
     
    
     animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    +  type: array
    +  items:
    +    type: string
    +    xml:
    +      name: animal
     
    
     <animal>value</animal>
    @@ -3512,13 +3512,13 @@
     
    
     animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    +  type: array
    +  items:
    +    type: string
    +    xml:
    +      name: animal
    +  xml:
    +    name: aliens
     
    
     <animal>value</animal>
    @@ -3540,11 +3540,11 @@
     
    
     animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    wrapped: true
    +  type: array
    +  items:
    +    type: string
    +  xml:
    +    wrapped: true
     
    
     <animals>
    @@ -3571,13 +3571,13 @@
     
    
     animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    wrapped: true
    +  type: array
    +  items:
    +    type: string
    +    xml:
    +      name: animal
    +  xml:
    +    wrapped: true
     
    
     <animals>
    @@ -3605,14 +3605,14 @@
     
    
     animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -    wrapped: true
    +  type: array
    +  items:
    +    type: string
    +    xml:
    +      name: animal
    +  xml:
    +    name: aliens
    +    wrapped: true
     
    
     <aliens>
    @@ -3637,12 +3637,12 @@
     
    
     animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    name: aliens
    -    wrapped: true
    +  type: array
    +  items:
    +    type: string
    +  xml:
    +    name: aliens
    +    wrapped: true
     
    
     <aliens>
    @@ -3771,11 +3771,11 @@
     
    
     type: oauth2
     flows: 
    -  implicit:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets
    +  implicit:
    +    authorizationUrl: https://example.com/api/oauth/dialog
    +    scopes:
    +      write:pets: modify pets in your account
    +      read:pets: read your pets
     

    OAuth Flows Object

    Allows configuration of the supported OAuth Flows.

    @@ -3878,17 +3878,17 @@
    
     type: oauth2
     flows: 
    -  implicit:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets
    -  authorizationCode:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    tokenUrl: https://example.com/api/oauth/token
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets 
    +  implicit:
    +    authorizationUrl: https://example.com/api/oauth/dialog
    +    scopes:
    +      write:pets: modify pets in your account
    +      read:pets: read your pets
    +  authorizationCode:
    +    authorizationUrl: https://example.com/api/oauth/dialog
    +    tokenUrl: https://example.com/api/oauth/token
    +    scopes:
    +      write:pets: modify pets in your account
    +      read:pets: read your pets 
     

    Security Requirement Object

    Lists the required security schemes to execute this operation. @@ -3934,8 +3934,8 @@

    
     petstore_auth:
    -- write:pets
    -- read:pets
    +- write:pets
    +- read:pets
     

    Specification Extensions

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    diff --git a/scripts/md2html/respec.sh b/scripts/md2html/respec.sh index 916dbab8cd..414f11b590 100755 --- a/scripts/md2html/respec.sh +++ b/scripts/md2html/respec.sh @@ -1,2 +1,2 @@ #!/bin/sh -node md2html.js --respec --maintainers ../MAINTAINERS.md ../versions/3.0.1.md > respec.html +node md2html.js --maintainers ../../MAINTAINERS.md ../../versions/3.0.1.md > respec.html From 3d3f530dc5cea1cac22175d594e75366127c5aec Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Sat, 15 Feb 2020 14:30:26 +0000 Subject: [PATCH 23/34] md2html: use respec js from spec.openapis.org site --- scripts/md2html/md2html.js | 2 +- scripts/md2html/respec.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/md2html/md2html.js b/scripts/md2html/md2html.js index e2b22b8456..dd91f8fec0 100644 --- a/scripts/md2html/md2html.js +++ b/scripts/md2html/md2html.js @@ -72,7 +72,7 @@ function preface(title,options) { let preface = `${md.utils.escapeHtml(title)}`; if (options.respec) { - preface += ''; + preface += ''; preface += ``; preface += ''; preface += '
    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    Status of This Document

    The source-of-truth for the specification is the GitHub markdown file referenced above.
    +OpenAPI Specification
    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    Status of This Document

    The source-of-truth for the specification is the GitHub markdown file referenced above.

    OpenAPI Specification

    Version 3.0.1

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [[!RFC2119]] [[!RFC8174]] when, and only when, they appear in all capitals, as shown here.

    From fe073a3338b6609ca9f7806968a1a939366f6efc Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Sun, 16 Feb 2020 14:32:57 +0000 Subject: [PATCH 24/34] md2html: find gist.css regardless of run dir --- scripts/md2html/md2html.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/md2html/md2html.js b/scripts/md2html/md2html.js index dd91f8fec0..73cf868415 100644 --- a/scripts/md2html/md2html.js +++ b/scripts/md2html/md2html.js @@ -11,6 +11,7 @@ highlight.js does a better job than bikeshed's Pygments) */ **/ const fs = require('fs'); +const path = require('path'); const url = require('url'); const util = require('util'); @@ -58,9 +59,9 @@ function preface(title,options) { publishDate: options.publishDate, subtitle: 'Version '+options.subtitle, processVersion: 2017, - edDraftURI: "http://github.com/OAI/openapi-specification/", + edDraftURI: "http://github.com/OAI/OpenAPI-Specification/", github: { - repoURL: "https://github.com/OAI/openapi-specification/", + repoURL: "https://github.com/OAI/OpenAPI-Specification/", branch: "master" }, shortName: "OAS", @@ -78,7 +79,7 @@ function preface(title,options) { preface += ''; preface += '
    '; preface += 'The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.'; From c37ef5985dc216b0467371b67c360ace5c43df3d Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Sat, 22 Feb 2020 10:21:22 +0000 Subject: [PATCH 25/34] md2html: don't mix https and http content (toc) --- scripts/md2html/md2html.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/md2html/md2html.js b/scripts/md2html/md2html.js index 73cf868415..69ec068faa 100644 --- a/scripts/md2html/md2html.js +++ b/scripts/md2html/md2html.js @@ -59,7 +59,7 @@ function preface(title,options) { publishDate: options.publishDate, subtitle: 'Version '+options.subtitle, processVersion: 2017, - edDraftURI: "http://github.com/OAI/OpenAPI-Specification/", + edDraftURI: "https://github.com/OAI/OpenAPI-Specification/", github: { repoURL: "https://github.com/OAI/OpenAPI-Specification/", branch: "master" @@ -73,7 +73,7 @@ function preface(title,options) { let preface = `${md.utils.escapeHtml(title)}`; if (options.respec) { - preface += ''; + preface += ''; preface += ``; preface += ''; preface += '
    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    Status of This Document

    The source-of-truth for the specification is the GitHub markdown file referenced above.
    -

    OpenAPI Specification

    -

    Version 3.0.1

    -

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [[!RFC2119]] [[!RFC8174]] when, and only when, they appear in all capitals, as shown here.

    -

    This document is licensed under The Apache License, Version 2.0.

    -

    Introduction

    -

    The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.

    -

    An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.

    - -

    Definitions

    -

    OpenAPI Document

    -

    A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification.

    -

    Path Templating

    -

    Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters.

    -

    Media Types

    -

    Media type definitions are spread across several resources. -The media type definitions SHOULD be in compliance with [[!RFC6838]].

    -

    Some examples of possible media type definitions:

    -
    
    -  text/plain; charset=utf-8
    -  application/json
    -  application/vnd.github+json
    -  application/vnd.github.v3+json
    -  application/vnd.github.v3.raw+json
    -  application/vnd.github.v3.text+json
    -  application/vnd.github.v3.html+json
    -  application/vnd.github.v3.full+json
    -  application/vnd.github.v3.diff
    -  application/vnd.github.v3.patch
    -
    -

    HTTP Status Codes

    -

    The HTTP Status Codes are used to indicate the status of the executed operation. -The available status codes are defined by [[!RFC7231]] and registered status codes are listed in the IANA Status Code Registry.

    -

    Specification

    -

    Versions

    -

    The OpenAPI Specification is versioned using Semantic Versioning 2.0.0 (semver) and follows the semver specification.

    -

    The major.minor portion of the semver (for example 3.0) SHALL designate the OAS feature set. Typically, .patch versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between 3.0.0 and 3.0.1 for example.

    -

    Subsequent minor version releases of the OpenAPI Specification (incrementing the minor version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical 3.1.0 specification SHOULD be usable with tooling designed for 3.0.0.

    -

    An OpenAPI document compatible with OAS 3.*.* contains a required openapi field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named swagger and value "2.0".)

    -

    Format

    -

    An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format.

    -

    For example, if a field has an array value, the JSON array representation will be used:

    -
    
    -{
    -   "field": [ 1, 2, 3 ]
    -}
    -
    -

    All field names in the specification are case sensitive.

    -

    The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name.

    -

    Patterned fields MUST have unique names within the containing object.

    -

    In order to preserve the ability to round-trip between YAML and JSON formats, YAML version 1.2 is RECOMMENDED along with some additional constraints:

    - -

    Note: While APIs may be defined by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML.

    -

    Document Structure

    -

    An OpenAPI document MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the user. In the latter case, $ref fields MUST be used in the specification to reference those parts as follows from the JSON Schema definitions.

    -

    It is RECOMMENDED that the root OpenAPI document be named: openapi.json or openapi.yaml.

    -

    Data Types

    -

    Primitive data types in the OAS are based on the types supported by the JSON Schema Specification Wright Draft 00. -Note that integer as a type is also supported and is defined as a JSON number without a fraction or exponent part. -null is not supported as a type (see nullable for an alternative solution). -Models are defined using the Schema Object, which is an extended subset of JSON Schema Specification Wright Draft 00.

    -

    Primitives have an optional modifier property: format. -OAS uses several known formats to define in fine detail the data type being used. -However, to support documentation needs, the format property is an open string-valued property, and can have any value. -Formats such as "email", "uuid", and so on, MAY be used even though undefined by this specification. -Types that are not accompanied by a format property follow the type definition in the JSON Schema. Tools that do not recognize a specific format MAY default back to the type alone, as if the format is not specified.

    -

    The formats defined by the OAS are:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Common NametypeformatComments
    integerintegerint32signed 32 bits
    longintegerint64signed 64 bits
    floatnumberfloat
    doublenumberdouble
    stringstring
    bytestringbytebase64 encoded characters
    binarystringbinaryany sequence of octets
    booleanboolean
    datestringdateAs defined by full-date - [[!RFC3339]]
    dateTimestringdate-timeAs defined by date-time - [[!RFC3339]]
    passwordstringpasswordA hint to UIs to obscure input.
    -

    Rich Text Formatting

    -

    Throughout the specification description fields are noted as supporting CommonMark markdown formatting. -Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by CommonMark 0.27. Tooling MAY choose to ignore some CommonMark features to address security concerns.

    -

    Relative References in URLs

    -

    Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [[!RFC3986]]. -Relative references are resolved using the URLs defined in the Server Object as a Base URI.

    -

    Relative references used in $ref are processed as per JSON Reference, using the URL of the current document as the base URI. See also the Reference Object.

    -

    Schema

    -

    In the following description, if a field is not explicitly REQUIRED or described with a MUST or SHALL, it can be considered OPTIONAL.

    -

    OpenAPI Object

    -

    This is the root document object of the OpenAPI document.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    openapistringREQUIRED. This string MUST be the semantic version number of the OpenAPI Specification version that the OpenAPI document uses. The openapi field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is not related to the API info.version string.
    infoInfo ObjectREQUIRED. Provides metadata about the API. The metadata MAY be used by tooling as required.
    servers[Server Object]An array of Server Objects, which provide connectivity information to a target server. If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url value of /.
    pathsPaths ObjectREQUIRED. The available paths and operations for the API.
    componentsComponents ObjectAn element to hold various schemas for the specification.
    security[Security Requirement Object]A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition.
    tags[Tag Object]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.
    externalDocsExternal Documentation ObjectAdditional external documentation.
    -

    This object MAY be extended with Specification Extensions.

    -

    Info Object

    -

    The object provides metadata about the API. -The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    titlestringREQUIRED. The title of the application.
    descriptionstringA short description of the application. CommonMark syntax MAY be used for rich text representation.
    termsOfServicestringA URL to the Terms of Service for the API. MUST be in the format of a URL.
    contactContact ObjectThe contact information for the exposed API.
    licenseLicense ObjectThe license information for the exposed API.
    versionstringREQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version).
    -

    This object MAY be extended with Specification Extensions.

    -

    Info Object Example:

    -
    
    -{
    -  "title": "Sample Pet Store App",
    -  "description": "This is a sample server for a pet store.",
    -  "termsOfService": "http://example.com/terms/",
    -  "contact": {
    -    "name": "API Support",
    -    "url": "http://www.example.com/support",
    -    "email": "support@example.com"
    -  },
    -  "license": {
    -    "name": "Apache 2.0",
    -    "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    -  },
    -  "version": "1.0.1"
    -}
    -
    -
    
    -title: Sample Pet Store App
    -description: This is a sample server for a pet store.
    -termsOfService: http://example.com/terms/
    -contact:
    -  name: API Support
    -  url: http://www.example.com/support
    -  email: support@example.com
    -license:
    -  name: Apache 2.0
    -  url: https://www.apache.org/licenses/LICENSE-2.0.html
    -version: 1.0.1
    -
    -

    Contact Object

    -

    Contact information for the exposed API.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringThe identifying name of the contact person/organization.
    urlstringThe URL pointing to the contact information. MUST be in the format of a URL.
    emailstringThe email address of the contact person/organization. MUST be in the format of an email address.
    -

    This object MAY be extended with Specification Extensions.

    -

    Contact Object Example:

    -
    
    -{
    -  "name": "API Support",
    -  "url": "http://www.example.com/support",
    -  "email": "support@example.com"
    -}
    -
    -
    
    -name: API Support
    -url: http://www.example.com/support
    -email: support@example.com
    -
    -

    License Object

    -

    License information for the exposed API.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringREQUIRED. The license name used for the API.
    urlstringA URL to the license used for the API. MUST be in the format of a URL.
    -

    This object MAY be extended with Specification Extensions.

    -

    License Object Example:

    -
    
    -{
    -  "name": "Apache 2.0",
    -  "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    -}
    -
    -
    
    -name: Apache 2.0
    -url: https://www.apache.org/licenses/LICENSE-2.0.html
    -
    -

    Server Object

    -

    An object representing a Server.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    urlstringREQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in {brackets}.
    descriptionstringAn optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation.
    variablesMap[string, Server Variable Object]A map between a variable name and its value. The value is used for substitution in the server’s URL template.
    -

    This object MAY be extended with Specification Extensions.

    -

    Server Object Example

    -

    A single server would be described as:

    -
    
    -{
    -  "url": "https://development.gigantic-server.com/v1",
    -  "description": "Development server"
    -}
    -
    -
    
    -url: https://development.gigantic-server.com/v1
    -description: Development server
    -
    -

    The following shows how multiple servers can be described, for example, at the OpenAPI Object’s servers:

    -
    
    -{
    -  "servers": [
    -    {
    -      "url": "https://development.gigantic-server.com/v1",
    -      "description": "Development server"
    -    },
    -    {
    -      "url": "https://staging.gigantic-server.com/v1",
    -      "description": "Staging server"
    -    },
    -    {
    -      "url": "https://api.gigantic-server.com/v1",
    -      "description": "Production server"
    -    }
    -  ]
    -}
    -
    -
    
    -servers:
    -- url: https://development.gigantic-server.com/v1
    -  description: Development server
    -- url: https://staging.gigantic-server.com/v1
    -  description: Staging server
    -- url: https://api.gigantic-server.com/v1
    -  description: Production server
    -
    -

    The following shows how variables can be used for a server configuration:

    -
    
    -{
    -  "servers": [
    -    {
    -      "url": "https://{username}.gigantic-server.com:{port}/{basePath}",
    -      "description": "The production API server",
    -      "variables": {
    -        "username": {
    -          "default": "demo",
    -          "description": "this value is assigned by the service provider, in this example `gigantic-server.com`"
    -        },
    -        "port": {
    -          "enum": [
    -            "8443",
    -            "443"
    -          ],
    -          "default": "8443"
    -        },
    -        "basePath": {
    -          "default": "v2"
    -        }
    -      }
    -    }
    -  ]
    -}
    -
    -
    
    -servers:
    -- url: https://{username}.gigantic-server.com:{port}/{basePath}
    -  description: The production API server
    -  variables:
    -    username:
    -      # note! no enum here means it is an open value
    -      default: demo
    -      description: this value is assigned by the service provider, in this example `gigantic-server.com`
    -    port:
    -      enum:
    -        - '8443'
    -        - '443'
    -      default: '8443'
    -    basePath:
    -      # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2`
    -      default: v2
    -
    -

    Server Variable Object

    -

    An object representing a Server Variable for server URL template substitution.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    enum[string]An enumeration of string values to be used if the substitution options are from a limited set.
    defaultstringREQUIRED. The default value to use for substitution, and to send, if an alternate value is not supplied. Unlike the Schema Object’s default, this value MUST be provided by the consumer.
    descriptionstringAn optional description for the server variable. CommonMark syntax MAY be used for rich text representation.
    -

    This object MAY be extended with Specification Extensions.

    -

    Components Object

    -

    Holds a set of reusable objects for different aspects of the OAS. -All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    schemasMap[string, Schema Object ¦ Reference Object]An object to hold reusable Schema Objects.
    responsesMap[string, Response Object ¦ Reference Object]An object to hold reusable Response Objects.
    parametersMap[string, Parameter Object ¦ Reference Object]An object to hold reusable Parameter Objects.
    examplesMap[string, Example Object ¦ Reference Object]An object to hold reusable Example Objects.
    requestBodiesMap[string, Request Body Object ¦ Reference Object]An object to hold reusable Request Body Objects.
    headersMap[string, Header Object ¦ Reference Object]An object to hold reusable Header Objects.
    securitySchemesMap[string, Security Scheme Object ¦ Reference Object]An object to hold reusable Security Scheme Objects.
    linksMap[string, Link Object ¦ Reference Object]An object to hold reusable Link Objects.
    callbacksMap[string, Callback Object ¦ Reference Object]An object to hold reusable Callback Objects.
    -

    This object MAY be extended with Specification Extensions.

    -

    All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9\.\-_]+$.

    -

    Field Name Examples:

    -
    
    -User
    -User_1
    -User_Name
    -user-name
    -my.org.User
    -
    -

    Components Object Example

    -
    
    -"components": {
    -  "schemas": {
    -    "Category": {
    -      "type": "object",
    -      "properties": {
    -        "id": {
    -          "type": "integer",
    -          "format": "int64"
    -        },
    -        "name": {
    -          "type": "string"
    -        }
    -      }
    -    },
    -    "Tag": {
    -      "type": "object",
    -      "properties": {
    -        "id": {
    -          "type": "integer",
    -          "format": "int64"
    -        },
    -        "name": {
    -          "type": "string"
    -        }
    -      }
    -    }
    -  },
    -  "parameters": {
    -    "skipParam": {
    -      "name": "skip",
    -      "in": "query",
    -      "description": "number of items to skip",
    -      "required": true,
    -      "schema": {
    -        "type": "integer",
    -        "format": "int32"
    -      }
    -    },
    -    "limitParam": {
    -      "name": "limit",
    -      "in": "query",
    -      "description": "max records to return",
    -      "required": true,
    -      "schema" : {
    -        "type": "integer",
    -        "format": "int32"
    -      }
    -    }
    -  },
    -  "responses": {
    -    "NotFound": {
    -      "description": "Entity not found."
    -    },
    -    "IllegalInput": {
    -      "description": "Illegal input for operation."
    -    },
    -    "GeneralError": {
    -      "description": "General Error",
    -      "content": {
    -        "application/json": {
    -          "schema": {
    -            "$ref": "#/components/schemas/GeneralError"
    -          }
    -        }
    -      }
    -    }
    -  },
    -  "securitySchemes": {
    -    "api_key": {
    -      "type": "apiKey",
    -      "name": "api_key",
    -      "in": "header"
    -    },
    -    "petstore_auth": {
    -      "type": "oauth2",
    -      "flows": {
    -        "implicit": {
    -          "authorizationUrl": "http://example.org/api/oauth/dialog",
    -          "scopes": {
    -            "write:pets": "modify pets in your account",
    -            "read:pets": "read your pets"
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -components:
    -  schemas:
    -    Category:
    -      type: object
    -      properties:
    -        id:
    -          type: integer
    -          format: int64
    -        name:
    -          type: string
    -    Tag:
    -      type: object
    -      properties:
    -        id:
    -          type: integer
    -          format: int64
    -        name:
    -          type: string
    -  parameters:
    -    skipParam:
    -      name: skip
    -      in: query
    -      description: number of items to skip
    -      required: true
    -      schema:
    -        type: integer
    -        format: int32
    -    limitParam:
    -      name: limit
    -      in: query
    -      description: max records to return
    -      required: true
    -      schema:
    -        type: integer
    -        format: int32
    -  responses:
    -    NotFound:
    -      description: Entity not found.
    -    IllegalInput:
    -      description: Illegal input for operation.
    -    GeneralError:
    -      description: General Error
    -      content:
    -        application/json:
    -          schema:
    -            $ref: '#/components/schemas/GeneralError'
    -  securitySchemes:
    -    api_key:
    -      type: apiKey
    -      name: api_key
    -      in: header
    -    petstore_auth:
    -      type: oauth2
    -      flows: 
    -        implicit:
    -          authorizationUrl: http://example.org/api/oauth/dialog
    -          scopes:
    -            write:pets: modify pets in your account
    -            read:pets: read your pets
    -
    -

    Paths Object

    -

    Holds the relative paths to the individual endpoints and their operations. -The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.

    -

    Patterned Fields

    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    /{path}Path Item ObjectA relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended (no relative URL resolution) to the expanded URL from the Server Object's url field in order to construct the full URL. Path templating is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it’s up to the tooling to decide which one to use.
    -

    This object MAY be extended with Specification Extensions.

    -

    Path Templating Matching

    -

    Assuming the following paths, the concrete definition, /pets/mine, will be matched first if used:

    -
    
    -  /pets/{petId}
    -  /pets/mine
    -
    -

    The following paths are considered identical and invalid:

    -
    
    -  /pets/{petId}
    -  /pets/{name}
    -
    -

    The following may lead to ambiguous resolution:

    -
    
    -  /{entity}/me
    -  /books/{id}
    -
    -

    Paths Object Example

    -
    
    -{
    -  "/pets": {
    -    "get": {
    -      "description": "Returns all pets from the system that the user has access to",
    -      "responses": {
    -        "200": {          
    -          "description": "A list of pets.",
    -          "content": {
    -            "application/json": {
    -              "schema": {
    -                "type": "array",
    -                "items": {
    -                  "$ref": "#/components/schemas/pet"
    -                }
    -              }
    -            }
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -/pets:
    -  get:
    -    description: Returns all pets from the system that the user has access to
    -    responses:
    -      '200':
    -        description: A list of pets.
    -        content:
    -          application/json:
    -            schema:
    -              type: array
    -              items:
    -                $ref: '#/components/schemas/pet'
    -
    -

    Path Item Object

    -

    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.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    $refstringAllows 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.
    summarystringAn optional, string summary, intended to apply to all operations in this path.
    descriptionstringAn optional, string description, intended to apply to all operations in this path. CommonMark syntax MAY be used for rich text representation.
    getOperation ObjectA definition of a GET operation on this path.
    putOperation ObjectA definition of a PUT operation on this path.
    postOperation ObjectA definition of a POST operation on this path.
    deleteOperation ObjectA definition of a DELETE operation on this path.
    optionsOperation ObjectA definition of a OPTIONS operation on this path.
    headOperation ObjectA definition of a HEAD operation on this path.
    patchOperation ObjectA definition of a PATCH operation on this path.
    traceOperation ObjectA definition of a TRACE operation on this path.
    servers[Server Object]An alternative server array to service all operations in this path.
    parameters[Parameter Object ¦ Reference Object]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 OpenAPI Object’s components/parameters.
    -

    This object MAY be extended with Specification Extensions.

    -

    Path Item Object Example

    -
    
    -{
    -  "get": {
    -    "description": "Returns pets based on ID",
    -    "summary": "Find pets by ID",
    -    "operationId": "getPetsById",
    -    "responses": {
    -      "200": {
    -        "description": "pet response",
    -        "content": {
    -          "*/*": {
    -            "schema": {
    -              "type": "array",
    -              "items": {
    -                "$ref": "#/components/schemas/Pet"
    -              }
    -            }
    -          }
    -        }
    -      },
    -      "default": {
    -        "description": "error payload",
    -        "content": {
    -          "text/html": {
    -            "schema": {
    -              "$ref": "#/components/schemas/ErrorModel"
    -            }
    -          }
    -        }
    -      }
    -    }
    -  },
    -  "parameters": [
    -    {
    -      "name": "id",
    -      "in": "path",
    -      "description": "ID of pet to use",
    -      "required": true,
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "type": "string"
    -        }
    -      },
    -      "style": "simple"
    -    }
    -  ]
    -}
    -
    -
    
    -get:
    -  description: Returns pets based on ID
    -  summary: Find pets by ID
    -  operationId: getPetsById
    -  responses:
    -    '200':
    -      description: pet response
    -      content:
    -        '*/*' :
    -          schema:
    -            type: array
    -            items:
    -              $ref: '#/components/schemas/Pet'
    -    default:
    -      description: error payload
    -      content:
    -        'text/html':
    -          schema:
    -            $ref: '#/components/schemas/ErrorModel'
    -parameters:
    -- name: id
    -  in: path
    -  description: ID of pet to use
    -  required: true
    -  schema:
    -    type: array
    -    style: simple
    -    items:
    -      type: string  
    -
    -

    Operation Object

    -

    Describes a single API operation on a path.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    tags[string]A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
    summarystringA short summary of what the operation does.
    descriptionstringA verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation.
    externalDocsExternal Documentation ObjectAdditional external documentation for this operation.
    operationIdstringUnique 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[Parameter Object ¦ Reference Object]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 OpenAPI Object’s components/parameters.
    requestBodyRequest Body Object ¦ Reference ObjectThe request body applicable for this operation. The requestBody is only supported in HTTP methods where the HTTP 1.1 specification [[!RFC7231]] has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers.
    responsesResponses ObjectREQUIRED. The list of possible responses as they are returned from executing this operation.
    callbacksMap[string, Callback Object ¦ Reference Object]A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
    deprecatedbooleanDeclares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is false.
    security[Security Requirement Object]A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used.
    servers[Server Object]An alternative server array to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value.
    -

    This object MAY be extended with Specification Extensions.

    -

    Operation Object Example

    -
    
    -{
    -  "tags": [
    -    "pet"
    -  ],
    -  "summary": "Updates a pet in the store with form data",
    -  "operationId": "updatePetWithForm",
    -  "parameters": [
    -    {
    -      "name": "petId",
    -      "in": "path",
    -      "description": "ID of pet that needs to be updated",
    -      "required": true,
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  ],
    -  "requestBody": {
    -    "content": {
    -      "application/x-www-form-urlencoded": {
    -        "schema": {
    -          "type": "object",
    -           "properties": {
    -              "name": { 
    -                "description": "Updated name of the pet",
    -                "type": "string"
    -              },
    -              "status": {
    -                "description": "Updated status of the pet",
    -                "type": "string"
    -             }
    -           },
    -        "required": ["status"] 
    -        }
    -      }
    -    }
    -  },
    -  "responses": {
    -    "200": {
    -      "description": "Pet updated.",
    -      "content": {
    -        "application/json": {},
    -        "application/xml": {}
    -      }
    -    },
    -    "405": {
    -      "description": "Invalid input",
    -      "content": {
    -        "application/json": {},
    -        "application/xml": {}
    -      }
    -    }
    -  },
    -  "security": [
    -    {
    -      "petstore_auth": [
    -        "write:pets",
    -        "read:pets"
    -      ]
    -    }
    -  ]
    -}
    -
    -
    
    -tags:
    -- pet
    -summary: Updates a pet in the store with form data
    -operationId: updatePetWithForm
    -parameters:
    -- name: petId
    -  in: path
    -  description: ID of pet that needs to be updated
    -  required: true
    -  schema:
    -    type: string
    -requestBody:
    -  content:
    -    'application/x-www-form-urlencoded':
    -      schema:
    -       properties:
    -          name: 
    -            description: Updated name of the pet
    -            type: string
    -          status:
    -            description: Updated status of the pet
    -            type: string
    -       required:
    -         - status
    -responses:
    -  '200':
    -    description: Pet updated.
    -    content: 
    -      'application/json': {}
    -      'application/xml': {}
    -  '405':
    -    description: Invalid input
    -    content: 
    -      'application/json': {}
    -      'application/xml': {}
    -security:
    -- petstore_auth:
    -  - write:pets
    -  - read:pets
    -
    -

    External Documentation Object

    -

    Allows referencing an external resource for extended documentation.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringA short description of the target documentation. CommonMark syntax MAY be used for rich text representation.
    urlstringREQUIRED. The URL for the target documentation. Value MUST be in the format of a URL.
    -

    This object MAY be extended with Specification Extensions.

    -

    External Documentation Object Example

    -
    
    -{
    -  "description": "Find more info here",
    -  "url": "https://example.com"
    -}
    -
    -
    
    -description: Find more info here
    -url: https://example.com
    -
    -

    Parameter Object

    -

    Describes a single operation parameter.

    -

    A unique parameter is defined by a combination of a name and location.

    -

    Parameter Locations

    -

    There are four possible parameter locations specified by the in field:

    -
      -
    • path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId.
    • -
    • query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id.
    • -
    • header - Custom headers that are expected as part of the request. Note that [[!RFC7230]] states header names are case insensitive.
    • -
    • cookie - Used to pass a specific cookie value to the API.
    • -
    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringREQUIRED. 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.
    • If in is "header" and the name field is "Accept", "Content-Type" or "Authorization", the parameter definition SHALL be ignored.
    • For all other cases, the name corresponds to the parameter name used by the in property.
    instringREQUIRED. The location of the parameter. Possible values are “query”, “header”, “path” or “cookie”.
    descriptionstringA brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
    requiredbooleanDetermines whether this parameter is mandatory. If the parameter location is “path”, this property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and its default value is false.
    deprecatedbooleanSpecifies that a parameter is deprecated and SHOULD be transitioned out of usage.
    allowEmptyValuebooleanSets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored.
    -

    The rules for serialization of the parameter are specified in one of two ways. -For simpler scenarios, a schema and style can describe the structure and syntax of the parameter.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    stylestringDescribes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form.
    explodebooleanWhen this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false.
    allowReservedbooleanDetermines whether the parameter value SHOULD allow reserved characters, as defined by [[!RFC3986]] :/?#[]@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false.
    schemaSchema Object ¦ Reference ObjectThe schema defining the type used for the parameter.
    exampleAnyExample of the media type. The example SHOULD match the specified schema and encoding properties if present. The example field is mutually exclusive of the examples field. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.
    examplesMap[ string, Example Object ¦ Reference Object]Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The examples field is mutually exclusive of the example field. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema.
    -

    For more complex scenarios, the content property can define the media type and schema of the parameter. -A parameter MUST contain either a schema property, or a content property, but not both. -When example or examples are provided in conjunction with the schema object, the example MUST follow the prescribed serialization strategy for the parameter.

    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    contentMap[string, Media Type Object]A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.
    -

    Style Values

    -

    In order to support common ways of serializing simple parameters, a set of style values are defined.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    styletypeinComments
    matrixprimitive, array, objectpathPath-style parameters defined by [[!RFC6570]]
    labelprimitive, array, objectpathLabel style parameters defined by [[!RFC6570]]
    formprimitive, array, objectquery, cookieForm style parameters defined by [[!RFC6570]]. This option replaces collectionFormat with a csv (when explode is false) or multi (when explode is true) value from OpenAPI 2.0.
    simplearraypath, headerSimple style parameters defined by [[!RFC6570]]. This option replaces collectionFormat with a csv value from OpenAPI 2.0.
    spaceDelimitedarrayquerySpace separated array values. This option replaces collectionFormat equal to ssv from OpenAPI 2.0.
    pipeDelimitedarrayqueryPipe separated array values. This option replaces collectionFormat equal to pipes from OpenAPI 2.0.
    deepObjectobjectqueryProvides a simple way of rendering nested objects using form parameters.
    -

    Style Examples

    -

    Assume a parameter named color has one of the following values:

    -
    
    -   string -> "blue"
    -   array -> ["blue","black","brown"]
    -   object -> { "R": 100, "G": 200, "B": 150 }
    -
    -

    The following table shows examples of rendering differences for each value.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    styleexplodeemptystringarrayobject
    matrixfalse;color;color=blue;color=blue,black,brown;color=R,100,G,200,B,150
    matrixtrue;color;color=blue;color=blue;color=black;color=brown;R=100;G=200;B=150
    labelfalse..blue.blue.black.brown.R.100.G.200.B.150
    labeltrue..blue.blue.black.brown.R=100.G=200.B=150
    formfalsecolor=color=bluecolor=blue,black,browncolor=R,100,G,200,B,150
    formtruecolor=color=bluecolor=blue&color=black&color=brownR=100&G=200&B=150
    simplefalsen/ablueblue,black,brownR,100,G,200,B,150
    simpletruen/ablueblue,black,brownR=100,G=200,B=150
    spaceDelimitedfalsen/an/ablue%20black%20brownR%20100%20G%20200%20B%20150
    pipeDelimitedfalsen/an/ablue¦black¦brownR¦100¦G¦200
    deepObjecttruen/an/an/acolor\R=100&color\G=200&color\B=150
    -

    This object MAY be extended with Specification Extensions.

    -

    Parameter Object Examples

    -

    A header parameter with an array of 64 bit integer numbers:

    -
    
    -{
    -  "name": "token",
    -  "in": "header",
    -  "description": "token to be passed as a header",
    -  "required": true,
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "type": "integer",
    -      "format": "int64"
    -    }
    -  },
    -  "style": "simple"
    -}
    -
    -
    
    -name: token
    -in: header
    -description: token to be passed as a header
    -required: true
    -schema:
    -  type: array
    -  items:
    -    type: integer
    -    format: int64
    -style: simple
    -
    -

    A path parameter of a string value:

    -
    
    -{
    -  "name": "username",
    -  "in": "path",
    -  "description": "username to fetch",
    -  "required": true,
    -  "schema": {
    -    "type": "string"
    -  }
    -}
    -
    -
    
    -name: username
    -in: path
    -description: username to fetch
    -required: true
    -schema:
    -  type: string
    -
    -

    An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

    -
    
    -{
    -  "name": "id",
    -  "in": "query",
    -  "description": "ID of the object to fetch",
    -  "required": false,
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    }
    -  },
    -  "style": "form",
    -  "explode": true
    -}
    -
    -
    
    -name: id
    -in: query
    -description: ID of the object to fetch
    -required: false
    -schema:
    -  type: array
    -  items:
    -    type: string
    -style: form
    -explode: true
    -
    -

    A free-form query parameter, allowing undefined parameters of a specific type:

    -
    
    -{
    -  "in": "query",
    -  "name": "freeForm",
    -  "schema": {
    -    "type": "object",
    -    "additionalProperties": {
    -      "type": "integer"
    -    },
    -  },
    -  "style": "form"
    -}
    -
    -
    
    -in: query
    -name: freeForm
    -schema:
    -  type: object
    -  additionalProperties:
    -    type: integer
    -style: form
    -
    -

    A complex parameter using content to define serialization:

    -
    
    -{
    -  "in": "query",
    -  "name": "coordinates",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "type": "object",
    -        "required": [
    -          "lat",
    -          "long"
    -        ],
    -        "properties": {
    -          "lat": {
    -            "type": "number"
    -          },
    -          "long": {
    -            "type": "number"
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -in: query
    -name: coordinates
    -content:
    -  application/json:
    -    schema:
    -      type: object
    -      required:
    -        - lat
    -        - long
    -      properties:
    -        lat:
    -          type: number
    -        long:
    -          type: number
    -
    -

    Request Body Object

    -

    Describes a single request body.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringA brief description of the request body. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
    contentMap[string, Media Type Object]REQUIRED. The content of the request body. The key is a media type or [media type range]appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
    requiredbooleanDetermines if the request body is required in the request. Defaults to false.
    -

    This object MAY be extended with Specification Extensions.

    -

    Request Body Examples

    -

    A request body with a referenced model definition.

    -
    
    -{
    -  "description": "user to add to the system",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "$ref": "#/components/schemas/User"
    -      },
    -      "examples": {
    -          "user" : {
    -            "summary": "User Example", 
    -            "externalValue": "http://foo.bar/examples/user-example.json"
    -          } 
    -        }
    -    },
    -    "application/xml": {
    -      "schema": {
    -        "$ref": "#/components/schemas/User"
    -      },
    -      "examples": {
    -          "user" : {
    -            "summary": "User example in XML",
    -            "externalValue": "http://foo.bar/examples/user-example.xml"
    -          }
    -        }
    -    },
    -    "text/plain": {
    -      "examples": {
    -        "user" : {
    -            "summary": "User example in Plain text",
    -            "externalValue": "http://foo.bar/examples/user-example.txt" 
    -        }
    -      } 
    -    },
    -    "*/*": {
    -      "examples": {
    -        "user" : {
    -            "summary": "User example in other format",
    -            "externalValue": "http://foo.bar/examples/user-example.whatever"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -description: user to add to the system
    -content: 
    -  'application/json':
    -    schema:
    -      $ref: '#/components/schemas/User'
    -    examples:
    -      user:
    -        summary: User Example
    -        externalValue: 'http://foo.bar/examples/user-example.json'
    -  'application/xml':
    -    schema:
    -      $ref: '#/components/schemas/User'
    -    examples:
    -      user:
    -        summary: User Example in XML
    -        externalValue: 'http://foo.bar/examples/user-example.xml'
    -  'text/plain':
    -    examples:
    -      user:
    -        summary: User example in text plain format
    -        externalValue: 'http://foo.bar/examples/user-example.txt'
    -  '*/*':
    -    examples:
    -      user: 
    -        summary: User example in other format
    -        externalValue: 'http://foo.bar/examples/user-example.whatever'
    -
    -

    A body parameter that is an array of string values:

    -
    
    -{
    -  "description": "user to add to the system",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "type": "string"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -description: user to add to the system
    -required: true
    -content:
    -  text/plain:
    -    schema:
    -      type: array
    -      items:
    -        type: string
    -
    -

    Media Type Object

    -

    Each Media Type Object provides schema and examples for the media type identified by its key.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    schemaSchema Object ¦ Reference ObjectThe schema defining the type used for the request body.
    exampleAnyExample of the media type. The example object SHOULD be in the correct format as specified by the media type. The example field is mutually exclusive of the examples field. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema.
    examplesMap[ string, Example Object ¦ Reference Object]Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The examples field is mutually exclusive of the example field. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema.
    encodingMap[string, Encoding Object]A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded.
    -

    This object MAY be extended with Specification Extensions.

    -

    Media Type Examples

    -
    
    -{
    -  "application/json": {
    -    "schema": {
    -         "$ref": "#/components/schemas/Pet"
    -    },
    -    "examples": {
    -      "cat" : {
    -        "summary": "An example of a cat",
    -        "value": 
    -          {
    -            "name": "Fluffy",
    -            "petType": "Cat",
    -            "color": "White",
    -            "gender": "male",
    -            "breed": "Persian"
    -          }
    -      },
    -      "dog": {
    -        "summary": "An example of a dog with a cat's name",
    -        "value" :  { 
    -          "name": "Puma",
    -          "petType": "Dog",
    -          "color": "Black",
    -          "gender": "Female",
    -          "breed": "Mixed"
    -        },
    -      "frog": {
    -          "$ref": "#/components/examples/frog-example"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -application/json: 
    -  schema:
    -    $ref: "#/components/schemas/Pet"
    -  examples:
    -    cat:
    -      summary: An example of a cat
    -      value:
    -        name: Fluffy
    -        petType: Cat
    -        color: White
    -        gender: male
    -        breed: Persian
    -    dog:
    -      summary: An example of a dog with a cat's name
    -      value:
    -        name: Puma
    -        petType: Dog
    -        color: Black
    -        gender: Female
    -        breed: Mixed
    -    frog:
    -      $ref: "#/components/examples/frog-example"
    -
    -

    Considerations for File Uploads

    -

    In contrast with the 2.0 specification, file input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically:

    -
    
    -# content transferred with base64 encoding
    -schema:
    -  type: string
    -  format: base64
    -
    -
    
    -# content transferred in binary (octet-stream):
    -schema:
    -  type: string
    -  format: binary
    -
    -

    These examples apply to either input payloads of file uploads or response payloads.

    -

    A requestBody for submitting a file in a POST operation may look like the following example:

    -
    
    -requestBody:
    -  content:
    -    application/octet-stream:
    -      # any media type is accepted, functionally equivalent to `*/*`
    -      schema:
    -        # a binary file of any type
    -        type: string
    -        format: binary
    -
    -

    In addition, specific media types MAY be specified:

    -
    
    -# multiple, specific media types may be specified:
    -requestBody:
    -  content:
    -      # a binary file of type png or jpeg
    -    'image/jpeg':
    -      schema:
    -        type: string
    -        format: binary
    -    'image/png':
    -      schema:
    -        type: string
    -        format: binary        
    -
    -

    To upload multiple files, a multipart media type MUST be used:

    -
    
    -requestBody:
    -  content:
    -    multipart/form-data:
    -      schema:
    -        properties:
    -          # The property name 'file' will be used for all files.
    -          file:
    -            type: array
    -            items:
    -              type: string
    -              format: binary
    -
    -
    -

    Support for x-www-form-urlencoded Request Bodies

    -

    To submit content using form url encoding via [[!RFC1866]], the following -definition may be used:

    -
    
    -requestBody:
    -  content:
    -    application/x-www-form-urlencoded:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            type: string
    -            format: uuid
    -          address:
    -            # complex types are stringified to support RFC 1866
    -            type: object
    -            properties: {}
    -
    -

    In this example, the contents in the requestBody MUST be stringified per [[!RFC1866]] when passed to the server. In addition, the address field complex object will be stringified.

    -

    When passing complex objects in the application/x-www-form-urlencoded content type, the default serialization strategy of such properties is described in the Encoding Object's style property as form.

    -

    Special Considerations for multipart Content

    -

    It is common to use multipart/form-data as a Content-Type when transferring request bodies to operations. In contrast to 2.0, a schema is REQUIRED to define the input parameters to the operation when using multipart content. This supports complex structures as well as supporting mechanisms for multiple file uploads.

    -

    When passing in multipart types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default Content-Types are defined for multipart:

    -
      -
    • If the property is a primitive, or an array of primitive values, the default Content-Type is text/plain
    • -
    • If the property is complex, or an array of complex values, the default Content-Type is application/json
    • -
    • If the property is a type: string with format: binary or format: base64 (aka a file object), the default Content-Type is application/octet-stream
    • -
    -

    Examples:

    -
    
    -requestBody:
    -  content:
    -    multipart/form-data:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            type: string
    -            format: uuid
    -          address:
    -            # default Content-Type for objects is `application/json`
    -            type: object
    -            properties: {}
    -          profileImage:
    -            # default Content-Type for string/binary is `application/octet-stream`
    -            type: string
    -            format: binary
    -          children:
    -            # default Content-Type for arrays is based on the `inner` type (text/plain here)
    -            type: array
    -            items:
    -              type: string
    -          addresses:
    -            # default Content-Type for arrays is based on the `inner` type (object shown, so `application/json` in this example)
    -            type: array
    -            items:
    -              type: '#/components/schemas/Address'
    -
    -

    An encoding attribute is introduced to give you control over the serialization of parts of multipart request bodies. This attribute is only applicable to multipart and application/x-www-form-urlencoded request bodies.

    -

    Encoding Object

    -

    A single encoding definition applied to a single schema property.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    contentTypestringThe Content-Type for encoding a specific property. Default value depends on the property type: for string with format being binaryapplication/octet-stream; for other primitive types – text/plain; for object - application/json; for array – the default is defined based on the inner type. The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types.
    headersMap[string, Header Object ¦ Reference Object]A map allowing additional information to be provided as headers, for example Content-Disposition. Content-Type is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a multipart.
    stylestringDescribes how a specific property value will be serialized depending on its type. See Parameter Object for details on the style property. The behavior follows the same values as query parameters, including default values. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
    explodebooleanWhen this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
    allowReservedbooleanDetermines whether the parameter value SHOULD allow reserved characters, as defined by [[!RFC3986]] :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
    -

    This object MAY be extended with Specification Extensions.

    -

    Encoding Object Example

    -
    
    -requestBody:
    -  content:
    -    multipart/mixed:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            # default is text/plain
    -            type: string
    -            format: uuid
    -          address:
    -            # default is application/json
    -            type: object
    -            properties: {}
    -          historyMetadata:
    -            # need to declare XML format!
    -            description: metadata in XML format
    -            type: object
    -            properties: {}
    -          profileImage:
    -            # default is application/octet-stream, need to declare an image type only!
    -            type: string
    -            format: binary
    -      encoding:
    -        historyMetadata:
    -          # require XML Content-Type in utf-8 encoding
    -          contentType: application/xml; charset=utf-8
    -        profileImage:
    -          # only accept png/jpeg
    -          contentType: image/png, image/jpeg
    -          headers:
    -            X-Rate-Limit-Limit:
    -              description: The number of allowed requests in the current period
    -              schema:
    -                type: integer
    -
    -

    Responses Object

    -

    A container for the expected responses of an operation. -The container maps a HTTP response code to the expected response.

    -

    The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. -However, documentation is expected to cover a successful operation response and any known errors.

    -

    The default MAY be used as a default response object for all HTTP codes -that are not covered individually by the specification.

    -

    The Responses Object MUST contain at least one response code, and it -SHOULD be the response for a successful operation call.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    defaultResponse Object ¦ Reference ObjectThe documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. A Reference Object can link to a response that the OpenAPI Object’s components/responses section defines.
    -

    Patterned Fields

    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    HTTP Status CodeResponse Object ¦ Reference ObjectAny HTTP status code can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A Reference Object can link to a response that is defined in the OpenAPI Object’s components/responses section. This field MUST be enclosed in quotation marks (for example, “200”) for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character X. For example, 2XX represents all response codes between [200-299]. The following range definitions are allowed: 1XX, 2XX, 3XX, 4XX, and 5XX. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code.
    -

    This object MAY be extended with Specification Extensions.

    -

    Responses Object Example

    -

    A 200 response for a successful operation and a default response for others (implying an error):

    -
    
    -{
    -  "200": {
    -    "description": "a pet to be returned",
    -    "content": {
    -      "application/json": {
    -        "schema": {
    -          "$ref": "#/components/schemas/Pet"
    -        }
    -      }
    -    }
    -  },
    -  "default": {
    -    "description": "Unexpected error",
    -    "content": {
    -      "application/json": {
    -        "schema": {
    -          "$ref": "#/components/schemas/ErrorModel"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -'200':
    -  description: a pet to be returned
    -  content: 
    -    application/json:
    -      schema:
    -        $ref: '#/components/schemas/Pet'
    -default:
    -  description: Unexpected error
    -  content:
    -    application/json:
    -      schema:
    -        $ref: '#/components/schemas/ErrorModel'
    -
    -

    Response Object

    -

    Describes a single response from an API Operation, including design-time, static -links to operations based on the response.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringREQUIRED. A short description of the response. CommonMark syntax MAY be used for rich text representation.
    headersMap[string, Header Object ¦ Reference Object]Maps a header name to its definition. [[!RFC7230]] states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored.
    contentMap[string, Media Type Object]A map containing descriptions of potential response payloads. The key is a media type or [media type range]appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
    linksMap[string, Link Object ¦ Reference Object]A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for Component Objects.
    -

    This object MAY be extended with Specification Extensions.

    -

    Response Object Examples

    -

    Response of an array of a complex type:

    -
    
    -{
    -  "description": "A complex object array response",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "$ref": "#/components/schemas/VeryComplexType"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -description: A complex object array response
    -content: 
    -  application/json:
    -    schema: 
    -      type: array
    -      items:
    -        $ref: '#/components/schemas/VeryComplexType'
    -
    -

    Response with a string type:

    -
    
    -{
    -  "description": "A simple string response",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  }
    -
    -}
    -
    -
    
    -description: A simple string response
    -content:
    -  text/plain:
    -    schema:
    -      type: string
    -
    -

    Plain text response with headers:

    -
    
    -{
    -  "description": "A simple string response",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  },
    -  "headers": {
    -    "X-Rate-Limit-Limit": {
    -      "description": "The number of allowed requests in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    },
    -    "X-Rate-Limit-Remaining": {
    -      "description": "The number of remaining requests in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    },
    -    "X-Rate-Limit-Reset": {
    -      "description": "The number of seconds left in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -description: A simple string response
    -content:
    -  text/plain:
    -    schema:
    -      type: string
    -    example: 'whoa!'
    -headers:
    -  X-Rate-Limit-Limit:
    -    description: The number of allowed requests in the current period
    -    schema:
    -      type: integer
    -  X-Rate-Limit-Remaining:
    -    description: The number of remaining requests in the current period
    -    schema:
    -      type: integer
    -  X-Rate-Limit-Reset:
    -    description: The number of seconds left in the current period
    -    schema:
    -      type: integer
    -
    -

    Response with no return value:

    -
    
    -{
    -  "description": "object created"
    -}
    -
    -
    
    -description: object created
    -
    -

    Callback Object

    -

    A map of possible out-of band callbacks related to the parent operation. -Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. -The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

    -

    Patterned Fields

    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {expression}Path Item ObjectA Path Item Object used to define a callback request and expected responses. A complete example is available.
    -

    This object MAY be extended with Specification Extensions.

    -

    Key Expression

    -

    The key that identifies the Path Item Object is a runtime expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. -A simple example might be $request.body#/url. -However, using a runtime expression the complete HTTP message can be accessed. -This includes accessing any part of a body that a JSON Pointer [[!RFC6901]] can reference.

    -

    For example, given the following HTTP request:

    -
    
    -POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1
    -Host: example.org
    -Content-Type: application/json
    -Content-Length: 187
    -
    -{
    -  "failedUrl" : "http://clientdomain.com/failed",
    -  "successUrls" : [
    -    "http://clientdomain.com/fast",
    -    "http://clientdomain.com/medium",
    -    "http://clientdomain.com/slow"
    -  ] 
    -}
    -
    -201 Created
    -Location: http://example.org/subscription/1
    -
    -

    The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named eventType and a query parameter named queryUrl.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ExpressionValue
    $urlhttp://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning
    $methodPOST
    $request.path.eventTypemyevent
    $request.query.queryUrlhttp://clientdomain.com/stillrunning
    $request.header.content-Typeapplication/json
    $request.body#/failedUrlhttp://clientdomain.com/stillrunning
    $request.body#/successUrls/2http://clientdomain.com/medium
    $response.header.Locationhttp://example.org/subscription/1
    -

    Callback Object Example

    -

    The following example shows a callback to the URL specified by the id and email property in the request body.

    -
    
    -myWebhook:
    -  'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
    -    post:
    -      requestBody:
    -        description: Callback payload
    -        content: 
    -          'application/json':
    -            schema:
    -              $ref: '#/components/schemas/SomePayload'
    -      responses:
    -        '200':
    -          description: webhook successfully processed and no retries will be performed
    -
    -

    Example Object

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    summarystringShort description for the example.
    descriptionstringLong description for the example. CommonMark syntax MAY be used for rich text representation.
    valueAnyEmbedded literal example. The value field and externalValue field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary.
    externalValuestringA URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The value field and externalValue field are mutually exclusive.
    -

    This object MAY be extended with Specification Extensions.

    -

    In all cases, the example value is expected to be compatible with the type schema -of its associated value. Tooling implementations MAY choose to -validate compatibility automatically, and reject the example value(s) if incompatible.

    -

    Example Object Example

    -
    
    -# in a model
    -schemas:
    -  properties:
    -    name:
    -      type: string
    -      examples:
    -        name:
    -          $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example
    -
    -# in a request body:
    -  requestBody:
    -    content:
    -      'application/json':
    -        schema:
    -          $ref: '#/components/schemas/Address'
    -        examples: 
    -          foo:
    -            summary: A foo example
    -            value: {"foo": "bar"}
    -          bar:
    -            summary: A bar example
    -            value: {"bar": "baz"}
    -      'application/xml':
    -        examples: 
    -          xmlExample:
    -            summary: This is an example in XML
    -            externalValue: 'http://example.org/examples/address-example.xml'
    -      'text/plain':
    -        examples:
    -          textExample: 
    -            summary: This is a text example
    -            externalValue: 'http://foo.bar/examples/address-example.txt' 
    -
    -
    -# in a parameter
    -  parameters:
    -    - name: 'zipCode'
    -      in: 'query'
    -      schema:
    -        type: 'string'
    -        format: 'zip-code'
    -        examples:
    -          zip-example: 
    -            $ref: '#/components/examples/zip-example'
    -
    -# in a response
    -  responses:
    -    '200':
    -      description: your car appointment has been booked
    -      content: 
    -        application/json:
    -          schema:
    -            $ref: '#/components/schemas/SuccessResponse'
    -          examples:
    -            confirmation-success:
    -              $ref: '#/components/examples/confirmation-success'
    -
    -

    Link Object

    -

    The Link object represents a possible design-time link for a response. -The presence of a link does not guarantee the caller’s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.

    -

    Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.

    -

    For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    operationRefstringA relative or absolute reference to an OAS operation. This field is mutually exclusive of the operationId field, and MUST point to an Operation Object. Relative operationRef values MAY be used to locate an existing Operation Object in the OpenAPI definition.
    operationIdstringThe name of an existing, resolvable OAS operation, as defined with a unique operationId. This field is mutually exclusive of the operationRef field.
    parametersMap[string, Any ¦ {expression}]A map representing parameters to pass to an operation as specified with operationId or identified via operationRef. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id).
    requestBodyAny ¦ {expression}A literal value or {expression} to use as a request body when calling the target operation.
    descriptionstringA description of the link. CommonMark syntax MAY be used for rich text representation.
    serverServer ObjectA server object to be used by the target operation.
    -

    This object MAY be extended with Specification Extensions.

    -

    A linked operation MUST be identified using either an operationRef or operationId. -In the case of an operationId, it MUST be unique and resolved in the scope of the OAS document. -Because of the potential for name clashes, the operationRef syntax is preferred -for specifications with external references.

    -

    Examples

    -

    Computing a link from a request operation where the $request.path.id is used to pass a request parameter to the linked operation.

    -
    
    -paths:
    -  /users/{id}:
    -    parameters:
    -    - name: id
    -      in: path
    -      required: true
    -      description: the user identifier, as userId 
    -      schema:
    -        type: string
    -    get:
    -      responses:
    -        '200':
    -          description: the user being returned
    -          content:
    -            application/json:
    -              schema:
    -                type: object
    -                properties:
    -                  uuid: # the unique user id
    -                    type: string
    -                    format: uuid
    -          links:
    -            address:
    -              # the target link operationId
    -              operationId: getUserAddress
    -              parameters:
    -                # get the `id` field from the request path parameter named `id`
    -                userId: $request.path.id
    -  # the path item of the linked operation
    -  /users/{userid}/address:
    -    parameters:
    -    - name: userid
    -      in: path
    -      required: true
    -      description: the user identifier, as userId 
    -      schema:
    -        type: string
    -    # linked operation
    -    get:
    -      operationId: getUserAddress
    -      responses:
    -        '200':
    -          description: the user's address
    -
    -

    When a runtime expression fails to evaluate, no parameter value is passed to the target operation.

    -

    Values from the response body can be used to drive a linked operation.

    -
    
    -links:
    -  address:
    -    operationId: getUserAddressByUUID
    -    parameters:
    -      # get the `uuid` field from the `uuid` field in the response body
    -      userUuid: $response.body#/uuid
    -
    -

    Clients follow all links at their discretion. -Neither permissions, nor the capability to make a successful call to that link, is guaranteed -solely by the existence of a relationship.

    -

    OperationRef Examples

    -

    As references to operationId MAY NOT be possible (the operationId is an optional -value), references MAY also be made through a relative operationRef:

    -
    
    -links:
    -  UserRepositories:
    -    # returns array of '#/components/schemas/repository'
    -    operationRef: '#/paths/~12.0~1repositories~1{username}/get'
    -    parameters:
    -      username: $response.body#/username
    -
    -

    or an absolute operationRef:

    -
    
    -links:
    -  UserRepositories:
    -    # returns array of '#/components/schemas/repository'
    -    operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get'
    -    parameters:
    -      username: $response.body#/username
    -
    -

    Note that in the use of operationRef, the escaped forward-slash is necessary when -using JSON references.

    -

    Runtime Expressions

    -

    Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. -This mechanism is used by Link Objects and Callback Objects.

    -

    The runtime expression is defined by the following [ABNF] syntax

    -
    
    -      expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source )
    -      source = ( header-reference | query-reference | path-reference | body-reference )  
    -      header-reference = "header." token
    -      query-reference = "query." name  
    -      path-reference = "path." name
    -      body-reference = "body" ["#" fragment]
    -      fragment = a JSON Pointer [RFC 6901](https://tools.ietf.org/html/rfc6901)  
    -      name = *( char )
    -      char = as per RFC [7159](https://tools.ietf.org/html/rfc7159#section-7)
    -      token = as per RFC [7230](https://tools.ietf.org/html/rfc7230#section-3.2.6)
    -
    -

    The name identifier is case-sensitive, whereas token is not.

    -

    The table below provides examples of runtime expressions and examples of their use in a value:

    -

    Examples

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Source Locationexample expressionnotes
    HTTP Method$methodThe allowable values for the $method will be those for the HTTP operation.
    Requested media type$request.header.accept
    Request parameter$request.path.idRequest parameters MUST be declared in the parameters section of the parent operation or they cannot be evaluated. This includes request headers.
    Request body property$request.body#/user/uuidIn operations which accept payloads, references may be made to portions of the requestBody or the entire body.
    Request URL$url
    Response value$response.body#/statusIn operations which return payloads, references may be made to portions of the response body or the entire body.
    Response header$response.header.ServerSingle header values only are available
    -

    Runtime expressions preserve the type of the referenced value. -Expressions can be embedded into string values by surrounding the expression with {} curly braces.

    -

    Header Object

    -

    The Header Object follows the structure of the Parameter Object with the following changes:

    -
      -
    1. name MUST NOT be specified, it is given in the corresponding headers map.
    2. -
    3. in MUST NOT be specified, it is implicitly in header.
    4. -
    5. All traits that are affected by the location MUST be applicable to a location of header (for example, style).
    6. -
    -

    Header Object Example

    -

    A simple header of type integer:

    -
    
    -{
    -  "description": "The number of allowed requests in the current period",
    -  "schema": {
    -    "type": "integer"
    -  }
    -}
    -
    -
    
    -description: The number of allowed requests in the current period
    -schema:
    -  type: integer
    -
    -

    Tag Object

    -

    Adds metadata to a single tag that is used by the Operation Object. -It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringREQUIRED. The name of the tag.
    descriptionstringA short description for the tag. CommonMark syntax MAY be used for rich text representation.
    externalDocsExternal Documentation ObjectAdditional external documentation for this tag.
    -

    This object MAY be extended with Specification Extensions.

    -

    Tag Object Example

    -
    
    -{
    -	"name": "pet",
    -	"description": "Pets operations"
    -}
    -
    -
    
    -name: pet
    -description: Pets operations
    -
    -

    Reference Object

    -

    A simple object to allow referencing other components in the specification, internally and externally.

    -

    The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.

    -

    For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    $refstringREQUIRED. The reference string.
    -

    This object cannot be extended with additional properties and any properties added SHALL be ignored.

    -

    Reference Object Example

    -
    
    -{
    -	"$ref": "#/components/schemas/Pet"
    -}
    -
    -
    
    -$ref: '#/components/schemas/Pet'
    -
    -

    Relative Schema Document Example

    -
    
    -{
    -  "$ref": "Pet.json"
    -}
    -
    -
    
    -$ref: Pet.yaml
    -
    -

    Relative Documents With Embedded Schema Example

    -
    
    -{
    -  "$ref": "definitions.json#/Pet"
    -}
    -
    -
    
    -$ref: definitions.yaml#/Pet
    -
    -

    Schema Object

    -

    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 an extended subset of the JSON Schema Specification Wright Draft 00.

    -

    For more information about the properties, see JSON Schema Core and JSON Schema Validation. -Unless stated otherwise, the property definitions follow the JSON Schema.

    -

    Properties

    -

    The following properties are taken directly from the JSON Schema definition and follow the same specifications:

    -
      -
    • title
    • -
    • multipleOf
    • -
    • maximum
    • -
    • exclusiveMaximum
    • -
    • minimum
    • -
    • exclusiveMinimum
    • -
    • maxLength
    • -
    • minLength
    • -
    • pattern (This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect)
    • -
    • maxItems
    • -
    • minItems
    • -
    • uniqueItems
    • -
    • maxProperties
    • -
    • minProperties
    • -
    • required
    • -
    • enum
    • -
    -

    The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification.

    -
      -
    • type - Value MUST be a string. Multiple types via an array are not supported.
    • -
    • allOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • oneOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • anyOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • not - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. items MUST be present if the type is array.
    • -
    • properties - Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced).
    • -
    • additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • description - CommonMark syntax MAY be used for rich text representation.
    • -
    • format - See Data Type Formats for further details. While relying on JSON Schema’s defined formats, the OAS offers a few additional predefined formats.
    • -
    • default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if type is string, then default can be "foo" but cannot be 1.
    • -
    -

    Alternatively, any time a Schema Object can be used, a Reference Object can be used in its place. This allows referencing definitions instead of defining them inline.

    -

    Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported.

    -

    Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation:

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    nullablebooleanAllows sending a null value for the defined schema. Default value is false.
    discriminatorDiscriminator ObjectAdds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See Composition and Inheritance for more details.
    readOnlybooleanRelevant only for Schema "properties" definitions. Declares the property as “read only”. This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.
    writeOnlybooleanRelevant only for Schema "properties" definitions. Declares the property as “write only”. Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as writeOnly being true and is in the required list, the required will take effect on the request only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.
    xmlXML ObjectThis MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property.
    externalDocsExternal Documentation ObjectAdditional external documentation for this schema.
    exampleAnyA free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary.
    deprecatedbooleanSpecifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false.
    -

    This object MAY be extended with Specification Extensions.

    -
    Composition and Inheritance (Polymorphism)
    -

    The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. -allOf takes an array of object definitions that are validated independently but together compose a single object.

    -

    While composition offers model extensibility, it does not imply a hierarchy between the models. -To support polymorphism, the OpenAPI Specification adds the discriminator field. -When used, the discriminator will be the name of the property that decides which schema definition validates the structure of the model. -As such, the discriminator field MUST be a required field. -There are two ways to define the value of a discriminator for an inheriting instance.

    -
      -
    • Use the schema name.
    • -
    • Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name. -As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism.
    • -
    -
    XML Modeling
    -

    The xml property allows extra definitions when translating the JSON definition to XML. -The XML Object contains additional information about the available options.

    -

    Schema Object Examples

    -
    Primitive Sample
    -
    
    -{
    -  "type": "string",
    -  "format": "email"
    -}
    -
    -
    
    -type: string
    -format: email
    -
    -
    Simple Model
    -
    
    -{
    -  "type": "object",
    -  "required": [
    -    "name"
    -  ],
    -  "properties": {
    -    "name": {
    -      "type": "string"
    -    },
    -    "address": {
    -      "$ref": "#/components/schemas/Address"
    -    },
    -    "age": {
    -      "type": "integer",
    -      "format": "int32",
    -      "minimum": 0
    -    }
    -  }
    -}
    -
    -
    
    -type: object
    -required:
    -- name
    -properties:
    -  name:
    -    type: string
    -  address:
    -    $ref: '#/components/schemas/Address'
    -  age:
    -    type: integer
    -    format: int32
    -    minimum: 0
    -
    -
    Model with Map/Dictionary Properties
    -

    For a simple string to string mapping:

    -
    
    -{
    -  "type": "object",
    -  "additionalProperties": {
    -    "type": "string"
    -  }
    -}
    -
    -
    
    -type: object
    -additionalProperties:
    -  type: string
    -
    -

    For a string to model mapping:

    -
    
    -{
    -  "type": "object",
    -  "additionalProperties": {
    -    "$ref": "#/components/schemas/ComplexModel"
    -  }
    -}
    -
    -
    
    -type: object
    -additionalProperties:
    -  $ref: '#/components/schemas/ComplexModel'
    -
    -
    Model with Example
    -
    
    -{
    -  "type": "object",
    -  "properties": {
    -    "id": {
    -      "type": "integer",
    -      "format": "int64"
    -    },
    -    "name": {
    -      "type": "string"
    -    }
    -  },
    -  "required": [
    -    "name"
    -  ],
    -  "example": {
    -    "name": "Puma",
    -    "id": 1
    -  }
    -}
    -
    -
    
    -type: object
    -properties:
    -  id:
    -    type: integer
    -    format: int64
    -  name:
    -    type: string
    -required:
    -- name
    -example:
    -  name: Puma
    -  id: 1
    -
    -
    Models with Composition
    -
    
    -{
    -  "components": {
    -    "schemas": {
    -      "ErrorModel": {
    -        "type": "object",
    -        "required": [
    -          "message",
    -          "code"
    -        ],
    -        "properties": {
    -          "message": {
    -            "type": "string"
    -          },
    -          "code": {
    -            "type": "integer",
    -            "minimum": 100,
    -            "maximum": 600
    -          }
    -        }
    -      },
    -      "ExtendedErrorModel": {
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/ErrorModel"
    -          },
    -          {
    -            "type": "object",
    -            "required": [
    -              "rootCause"
    -            ],
    -            "properties": {
    -              "rootCause": {
    -                "type": "string"
    -              }
    -            }
    -          }
    -        ]
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -components:
    -  schemas:
    -    ErrorModel:
    -      type: object
    -      required:
    -      - message
    -      - code
    -      properties:
    -        message:
    -          type: string
    -        code:
    -          type: integer
    -          minimum: 100
    -          maximum: 600
    -    ExtendedErrorModel:
    -      allOf:
    -      - $ref: '#/components/schemas/ErrorModel'
    -      - type: object
    -        required:
    -        - rootCause
    -        properties:
    -          rootCause:
    -            type: string
    -
    -
    Models with Polymorphism Support
    -
    
    -{
    -  "components": {
    -    "schemas": {
    -      "Pet": {
    -        "type": "object",
    -        "discriminator": {
    -          "propertyName": "petType"
    -        },
    -        "properties": {
    -          "name": {
    -            "type": "string"
    -          },
    -          "petType": {
    -            "type": "string"
    -          }
    -        },
    -        "required": [
    -          "name",
    -          "petType"
    -        ]
    -      },
    -      "Cat": {
    -        "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.",
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/Pet"
    -          },
    -          {
    -            "type": "object",
    -            "properties": {
    -              "huntingSkill": {
    -                "type": "string",
    -                "description": "The measured skill for hunting",
    -                "default": "lazy",
    -                "enum": [
    -                  "clueless",
    -                  "lazy",
    -                  "adventurous",
    -                  "aggressive"
    -                ]
    -              }
    -            },
    -            "required": [
    -              "huntingSkill"
    -            ]
    -          }
    -        ]
    -      },
    -      "Dog": {
    -        "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.",
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/Pet"
    -          },
    -          {
    -            "type": "object",
    -            "properties": {
    -              "packSize": {
    -                "type": "integer",
    -                "format": "int32",
    -                "description": "the size of the pack the dog is from",
    -                "default": 0,
    -                "minimum": 0
    -              }
    -            },
    -            "required": [
    -              "packSize"
    -            ]
    -          }
    -        ]
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -components:
    -  schemas:
    -    Pet:
    -      type: object
    -      discriminator:
    -        propertyName: petType
    -      properties:
    -        name:
    -          type: string
    -        petType:
    -          type: string
    -      required:
    -      - name
    -      - petType
    -    Cat:  ## "Cat" will be used as the discriminator value
    -      description: A representation of a cat
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        properties:
    -          huntingSkill:
    -            type: string
    -            description: The measured skill for hunting
    -            enum:
    -            - clueless
    -            - lazy
    -            - adventurous
    -            - aggressive
    -        required:
    -        - huntingSkill
    -    Dog:  ## "Dog" will be used as the discriminator value
    -      description: A representation of a dog
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        properties:
    -          packSize:
    -            type: integer
    -            format: int32
    -            description: the size of the pack the dog is from
    -            default: 0
    -            minimum: 0
    -        required:
    -        - packSize
    -
    -

    Discriminator Object

    -

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    -

    When using the discriminator, inline schemas will not be considered.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    propertyNamestringREQUIRED. The name of the property in the payload that will hold the discriminator value.
    mappingMap[string, string]An object to hold mappings between payload values and schema names or references.
    -

    The discriminator attribute is legal only when using one of the composite keywords oneOf, anyOf, allOf.

    -

    In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:

    -
    
    -MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -
    -

    which means the payload MUST, by validation, match exactly one of the schemas described by Cat, Dog, or Lizard. In this case, a discriminator MAY act as a “hint” to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use:

    -
    
    -MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -  discriminator:
    -    propertyName: pet_type
    -
    -

    The expectation now is that a property with name pet_type MUST be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload:

    -
    
    -{
    -  "id": 12345,
    -  "pet_type": "Cat"
    -}
    -
    -

    Will indicate that the Cat schema be used in conjunction with this payload.

    -

    In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional mapping definition MAY be used:

    -
    
    -MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -  - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json'
    -  discriminator:
    -    propertyName: pet_type
    -    mapping:
    -      dog: '#/components/schemas/Dog'
    -      monster: 'https://gigantic-server.com/schemas/Monster/schema.json'
    -
    -

    Here the discriminator value of dog will map to the schema #/components/schemas/Dog, rather than the default (implicit) value of Dog. If the discriminator value does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison.

    -

    When used in conjunction with the anyOf construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload.

    -

    In both the oneOf and anyOf use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an allOf construct may be used as an alternate schema.

    -

    For example:

    -
    
    -components:
    -  schemas:
    -    Pet:
    -      type: object
    -      required:
    -      - pet_type
    -      properties:
    -        pet_type:
    -          type: string
    -      discriminator:
    -        propertyName: pet_type
    -        mapping:
    -          cachorro: Dog
    -    Cat:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a `Cat`
    -        properties:
    -          name:
    -            type: string
    -    Dog:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a `Dog`
    -        properties:
    -          bark:
    -            type: string
    -    Lizard:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a `Lizard`
    -        properties:
    -          lovesRocks:
    -            type: boolean
    -
    -

    a payload like this:

    -
    
    -{
    -  "pet_type": "Cat",
    -  "name": "misty"
    -}
    -
    -

    will indicate that the Cat schema be used. Likewise this schema:

    -
    
    -{
    -  "pet_type": "cachorro",
    -  "bark": "soft"
    -}
    -
    -

    will map to Dog because of the definition in the mappings element.

    -

    XML Object

    -

    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.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringReplaces the name of the element/attribute used for the described schema property. When defined within 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.
    namespacestringThe URI of the namespace definition. Value MUST be in the form of an absolute URI.
    prefixstringThe prefix to be used for the name.
    attributebooleanDeclares whether the property definition translates to an attribute instead of an element. Default value is false.
    wrappedbooleanMAY 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).
    -

    This object MAY be extended with Specification Extensions.

    -

    XML Object Examples

    -

    The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

    -
    No XML Element
    -

    Basic string property:

    -
    
    -{
    -    "animals": {
    -        "type": "string"
    -    }
    -}
    -
    -
    
    -animals:
    -  type: string
    -
    -
    
    -<animals>...</animals>
    -
    -

    Basic string array property (wrapped is false by default):

    -
    
    -{
    -    "animals": {
    -        "type": "array",
    -        "items": {
    -            "type": "string"
    -        }
    -    }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -
    -
    
    -<animals>...</animals>
    -<animals>...</animals>
    -<animals>...</animals>
    -
    -
    XML Name Replacement
    -
    
    -{
    -  "animals": {
    -    "type": "string",
    -    "xml": {
    -      "name": "animal"
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: string
    -  xml:
    -    name: animal
    -
    -
    
    -<animal>...</animal>
    -
    -
    XML Attribute, Prefix and Namespace
    -

    In this example, a full model definition is shown.

    -
    
    -{
    -  "Person": {
    -    "type": "object",
    -    "properties": {
    -      "id": {
    -        "type": "integer",
    -        "format": "int32",
    -        "xml": {
    -          "attribute": true
    -        }
    -      },
    -      "name": {
    -        "type": "string",
    -        "xml": {
    -          "namespace": "http://example.com/schema/sample",
    -          "prefix": "sample"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -Person:
    -  type: object
    -  properties:
    -    id:
    -      type: integer
    -      format: int32
    -      xml:
    -        attribute: true
    -    name:
    -      type: string
    -      xml:
    -        namespace: http://example.com/schema/sample
    -        prefix: sample
    -
    -
    
    -<Person id="123">
    -    <sample:name xmlns:sample="http://example.com/schema/sample">example</sample:name>
    -</Person>
    -
    -
    XML Arrays
    -

    Changing the element names:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -
    -
    
    -<animal>value</animal>
    -<animal>value</animal>
    -
    -

    The external name property has no effect on the XML:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens"
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -
    -
    
    -<animal>value</animal>
    -<animal>value</animal>
    -
    -

    Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    wrapped: true
    -
    -
    
    -<animals>
    -  <animals>value</animals>
    -  <animals>value</animals>
    -</animals>
    -
    -

    To overcome the naming problem in the example above, the following definition can be used:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    wrapped: true
    -
    -
    
    -<animals>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</animals>
    -
    -

    Affecting both internal and external names:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    
    -<aliens>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</aliens>
    -
    -

    If we change the external element but not the internal ones:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    
    -<aliens>
    -  <aliens>value</aliens>
    -  <aliens>value</aliens>
    -</aliens>
    -
    -

    Security Scheme Object

    -

    Defines a security scheme that can be used by the operations. -Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [[!RFC6749]], and OpenID Connect Discovery.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeApplies ToDescription
    typestringAnyREQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "oauth2", "openIdConnect".
    descriptionstringAnyA short description for security scheme. CommonMark syntax MAY be used for rich text representation.
    namestringapiKeyREQUIRED. The name of the header, query or cookie parameter to be used.
    instringapiKeyREQUIRED. The location of the API key. Valid values are "query", "header" or "cookie".
    schemestringhttpREQUIRED. The name of the HTTP Authorization scheme to be used in the Authorization header as defined in [[!RFC7235]].
    bearerFormatstringhttp ("bearer")A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes.
    flowsOAuth Flows Objectoauth2REQUIRED. An object containing configuration information for the flow types supported.
    openIdConnectUrlstringopenIdConnectREQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL.
    -

    This object MAY be extended with Specification Extensions.

    -

    Security Scheme Object Example

    -
    Basic Authentication Sample
    -
    
    -{
    -  "type": "http",
    -  "scheme": "basic"
    -}
    -
    -
    
    -type: http
    -scheme: basic
    -
    -
    API Key Sample
    -
    
    -{
    -  "type": "apiKey",
    -  "name": "api_key",
    -  "in": "header"
    -}
    -
    -
    
    -type: apiKey
    -name: api_key
    -in: header
    -
    -
    JWT Bearer Sample
    -
    
    -{
    -  "type": "http",
    -  "scheme": "bearer",
    -  "bearerFormat": "JWT",
    -}
    -
    -
    
    -type: http
    -scheme: bearer
    -bearerFormat: JWT
    -
    -
    Implicit OAuth2 Sample
    -
    
    -{
    -  "type": "oauth2",
    -  "flows": {
    -    "implicit": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -type: oauth2
    -flows: 
    -  implicit:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets
    -
    -

    OAuth Flows Object

    -

    Allows configuration of the supported OAuth Flows.

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    implicitOAuth Flow ObjectConfiguration for the OAuth Implicit flow
    passwordOAuth Flow ObjectConfiguration for the OAuth Resource Owner Password flow
    clientCredentialsOAuth Flow ObjectConfiguration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0.
    authorizationCodeOAuth Flow ObjectConfiguration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.
    -

    This object MAY be extended with Specification Extensions.

    -

    OAuth Flow Object

    -

    Configuration details for a supported OAuth Flow

    -

    Fixed Fields

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeApplies ToDescription
    authorizationUrlstringoauth2 ("implicit", "authorizationCode")REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL.
    tokenUrlstringoauth2 ("password", "clientCredentials", "authorizationCode")REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL.
    refreshUrlstringoauth2The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.
    scopesMap[string, string]oauth2REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it.
    -

    This object MAY be extended with Specification Extensions.

    -

    OAuth Flow Object Examples

    -
    
    -{
    -  "type": "oauth2",
    -  "flows": {
    -    "implicit": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    },
    -    "authorizationCode": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "tokenUrl": "https://example.com/api/oauth/token",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -type: oauth2
    -flows: 
    -  implicit:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets
    -  authorizationCode:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    tokenUrl: https://example.com/api/oauth/token
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets 
    -
    -

    Security Requirement Object

    -

    Lists the required security schemes to execute this operation. -The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.

    -

    Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. -This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.

    -

    When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.

    -

    Patterned Fields

    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}[string]Each name MUST correspond to a security scheme which is declared in the Security Schemes under the Components Object. If the security scheme is of type "oauth2" or "openIdConnect", then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty.
    -

    Security Requirement Object Examples

    -
    Non-OAuth2 Security Requirement
    -
    
    -{
    -  "api_key": []
    -}
    -
    -
    
    -api_key: []
    -
    -
    OAuth2 Security Requirement
    -
    
    -{
    -  "petstore_auth": [
    -    "write:pets",
    -    "read:pets"
    -  ]
    -}
    -
    -
    
    -petstore_auth:
    -- write:pets
    -- read:pets
    -
    -

    Specification Extensions

    -

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    -

    The extensions properties are implemented as patterned fields that are always prefixed by "x-".

    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the OpenAPI Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. 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).

    -

    Security Filtering

    -

    Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.

    -

    The reasoning is to allow an additional layer of access control over the documentation. -While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.

    -

    Two examples of this:

    -
      -
    1. The Paths Object MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication.
    2. -
    3. The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object, so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see.
    4. -
    -

    Appendix A: Revision History

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    VersionDateNotes
    3.0.12017-12-06Patch release of the OpenAPI Specification 3.0.1
    3.0.02017-07-26Release of the OpenAPI Specification 3.0.0
    3.0.0-rc22017-06-16rc2 of the 3.0 specification
    3.0.0-rc12017-04-27rc1 of the 3.0 specification
    3.0.0-rc02017-02-28Implementer’s Draft of the 3.0 specification
    2.02015-12-31Donation of Swagger 2.0 to the Open API Initiative
    2.02014-09-08Release of Swagger 2.0
    1.22014-03-14Initial release of the formal document.
    1.12012-08-22Release of Swagger 1.1
    1.02011-08-10First release of the Swagger Specification
    - diff --git a/scripts/md2html/respec.sh b/scripts/md2html/respec.sh deleted file mode 100755 index 414f11b590..0000000000 --- a/scripts/md2html/respec.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -node md2html.js --maintainers ../../MAINTAINERS.md ../../versions/3.0.1.md > respec.html From cbdd3ebd1b94a084e4f8cf99bb8a1e2bd130e578 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Wed, 27 May 2020 17:34:17 +0100 Subject: [PATCH 28/34] md2html; tidying up --- package.json | 4 +- scripts/md2html/v2/2.0.bs | 3093 ---------------- scripts/md2html/v2/heading.bs | 62 - scripts/md2html/v2/oas_2.0.html | 4324 ---------------------- scripts/md2html/v3/3.0.0.bs | 4085 --------------------- scripts/md2html/v3/3.0.1.bs | 4031 -------------------- scripts/md2html/v3/h3.0.0.bs | 62 - scripts/md2html/v3/h3.0.1.bs | 64 - scripts/md2html/v3/oas_3.0.0.html | 5428 --------------------------- scripts/md2html/v3/oas_3.0.1.html | 5644 ----------------------------- 10 files changed, 2 insertions(+), 26795 deletions(-) delete mode 100644 scripts/md2html/v2/2.0.bs delete mode 100644 scripts/md2html/v2/heading.bs delete mode 100644 scripts/md2html/v2/oas_2.0.html delete mode 100644 scripts/md2html/v3/3.0.0.bs delete mode 100644 scripts/md2html/v3/3.0.1.bs delete mode 100644 scripts/md2html/v3/h3.0.0.bs delete mode 100644 scripts/md2html/v3/h3.0.1.bs delete mode 100644 scripts/md2html/v3/oas_3.0.0.html delete mode 100644 scripts/md2html/v3/oas_3.0.1.html diff --git a/package.json b/package.json index 7d553b94c6..e4f1c278ef 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,8 @@ ], "dependencies": { "cheerio": "^1.0.0-rc.2", - "highlight.js": "^9.18.1", - "markdown-it": "^8.4.0", + "highlight.js": "^10.0.3", + "markdown-it": "^11.0.0", "yargs": "^12.0.5" }, "devDependencies": { diff --git a/scripts/md2html/v2/2.0.bs b/scripts/md2html/v2/2.0.bs deleted file mode 100644 index b8fa547027..0000000000 --- a/scripts/md2html/v2/2.0.bs +++ /dev/null @@ -1,3093 +0,0 @@ -OpenAPI Specification -

    OpenAPI Specification

    -

    (fka Swagger RESTful API Documentation Specification)

    -

    Version 2.0

    -

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [!rfc2119].

    -

    The Swagger specification is licensed under The Apache License, Version 2.0.

    -

    Introductions

    -

    Swagger™ is a project used to describe and document RESTful APIs.

    -

    The Swagger specification defines a set of files required to describe such an API. These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various languages. Additional utilities can also take advantage of the resulting files, such as testing tools.

    -

    Revision History

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    VersionDateNotes
    2.02014-09-08Release of Swagger 2.0
    1.22014-03-14Initial release of the formal document.
    1.12012-08-22Release of Swagger 1.1
    1.02011-08-10First release of the Swagger Specification
    -

    Definitions

    -

    Path Templating

    -

    Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters.

    -
    Mime Types
    -

    Mime type definitions are spread across several resources. The mime type definitions should be in compliance with [[!rfc6838]].

    -

    Some examples of possible mime type definitions:

    -
    
    -  text/plain; charset=utf-8
    -  application/json
    -  application/vnd.github+json
    -  application/vnd.github.v3+json
    -  application/vnd.github.v3.raw+json
    -  application/vnd.github.v3.text+json
    -  application/vnd.github.v3.html+json
    -  application/vnd.github.v3.full+json
    -  application/vnd.github.v3.diff
    -  application/vnd.github.v3.patch
    -
    -
    HTTP Status Codes
    -

    The HTTP Status Codes are used to indicate the status of the executed operation. The available status codes are described by [[!rfc7231]]section-6) and in the IANA Status Code Registry.

    -

    Specification

    -

    Format

    -

    The files describing the RESTful API in accordance with the Swagger specification are represented as JSON objects and conform to the JSON standards. YAML, being a superset of JSON, can be used as well to -represent a Swagger specification file.

    -

    For example, if a field is said to have an array value, the JSON array representation will be used:

    -
    
    -{
    -   "field" : [...]
    -}
    -
    -

    While the API is described using JSON it does not impose a JSON input/output to the API itself.

    -

    All field names in the specification are case sensitive.

    -

    The schema exposes two types of fields. Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. Patterned fields can have multiple occurrences as long as each has a unique name.

    -

    File Structure

    -

    The Swagger representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for $ref fields in the specification as follows from the JSON Schema definitions.

    -

    By convention, the Swagger specification file is named swagger.json.

    -

    Data Types

    -

    Primitive data types in the Swagger Specification are based on the types supported by the JSON-Schema Draft 4. Models are described using the Schema Object which is a subset of JSON Schema Draft 4.

    -

    An additional primitive data type "file" is used by the Parameter Object and the Response Object to set the parameter type or the response as being a file.

    -

    Primitives have an optional modifier property format. Swagger uses several known formats to more finely define the data type being used. However, the format property is an open string-valued property, and can have any value to support documentation needs. Formats such as "email", "uuid", etc., can be used even though they are not defined by this specification. Types that are not accompanied by a format property follow their definition from the JSON Schema (except for file type which is defined above). The formats defined by the Swagger Specification are:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Common NametypeformatComments
    integerintegerint32signed 32 bits
    longintegerint64signed 64 bits
    floatnumberfloat
    doublenumberdouble
    stringstring
    bytestringbytebase64 encoded characters
    binarystringbinaryany sequence of octets
    booleanboolean
    datestringdateAs defined by full-date - [!rfc3339]
    dateTimestringdate-timeAs defined by date-time - [!rfc3339]
    passwordstringpasswordUsed to hint UIs the input needs to be obscured.
    -

    Schema

    -

    Swagger Object

    -

    This is the root document object for the API specification. It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    swaggerstringRequired. 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".
    infoInfo ObjectRequired. Provides metadata about the API. The metadata can be used by the clients if needed.
    hoststringThe 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.
    basePathstringThe 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.
    schemes[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.
    consumes[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.
    produces[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.
    pathsPaths ObjectRequired. The available paths and operations for the API.
    definitionsDefinitions ObjectAn object to hold data types produced and consumed by operations.
    parametersParameters Definitions ObjectAn object to hold parameters that can be used across operations. This property does not define global parameters for all operations.
    responsesResponses Definitions ObjectAn object to hold responses that can be used across operations. This property does not define global responses for all operations.
    securityDefinitionsSecurity Definitions ObjectSecurity scheme definitions that can be used across the specification.
    security[Security Requirement Object]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.
    tags[Tag Object]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.
    externalDocsExternal Documentation ObjectAdditional external documentation.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -

    Info Object

    -

    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.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    titlestringRequired. The title of the application.
    descriptionstringA short description of the application. GFM syntax can be used for rich text representation.
    termsOfServicestringThe Terms of Service for the API.
    contactContact ObjectThe contact information for the exposed API.
    licenseLicense ObjectThe license information for the exposed API.
    versionstringRequired Provides the version of the application API (not to be confused with the specification version).
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Info Object Example:
    -
    
    -{
    -  "title": "Swagger Sample App",
    -  "description": "This is a sample server Petstore server.",
    -  "termsOfService": "http://swagger.io/terms/",
    -  "contact": {
    -    "name": "API Support",
    -    "url": "http://www.swagger.io/support",
    -    "email": "support@swagger.io"
    -  },
    -  "license": {
    -    "name": "Apache 2.0",
    -    "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    -  },
    -  "version": "1.0.1"
    -}
    -
    -
    
    -title: Swagger Sample App
    -description: This is a sample server Petstore server.
    -termsOfService: http://swagger.io/terms/
    -contact:
    -  name: API Support
    -  url: http://www.swagger.io/support
    -  email: support@swagger.io
    -license:
    -  name: Apache 2.0
    -  url: http://www.apache.org/licenses/LICENSE-2.0.html
    -version: 1.0.1
    -
    -

    Contact Object

    -

    Contact information for the exposed API.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringThe identifying name of the contact person/organization.
    urlstringThe URL pointing to the contact information. MUST be in the format of a URL.
    emailstringThe email address of the contact person/organization. MUST be in the format of an email address.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Contact Object Example:
    -
    
    -{
    -  "name": "API Support",
    -  "url": "http://www.swagger.io/support",
    -  "email": "support@swagger.io"
    -}
    -
    -
    
    -name: API Support
    -url: http://www.swagger.io/support
    -email: support@swagger.io
    -
    -

    License Object

    -

    License information for the exposed API.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringRequired. The license name used for the API.
    urlstringA URL to the license used for the API. MUST be in the format of a URL.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    License Object Example:
    -
    
    -{
    -  "name": "Apache 2.0",
    -  "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    -}
    -
    -
    
    -name: Apache 2.0
    -url: http://www.apache.org/licenses/LICENSE-2.0.html
    -
    -

    Paths Object

    -

    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.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    /{path}Path Item ObjectA relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended to the basePath in order to construct the full URL. Path templating is allowed.
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Paths Object Example
    -
    
    -{
    -  "/pets": {
    -    "get": {
    -      "description": "Returns all pets from the system that the user has access to",
    -      "produces": [
    -        "application/json"
    -      ],
    -      "responses": {
    -        "200": {
    -          "description": "A list of pets.",
    -          "schema": {
    -            "type": "array",
    -            "items": {
    -              "$ref": "#/definitions/pet"
    -            }
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -/pets:
    -  get:
    -    description: Returns all pets from the system that the user has access to
    -    produces:
    -    - application/json
    -    responses:
    -      '200':
    -        description: A list of pets.
    -        schema:
    -          type: array
    -          items:
    -            $ref: '#/definitions/pet'
    -
    -

    Path Item Object

    -

    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.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    $refstringAllows 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.
    getOperation ObjectA definition of a GET operation on this path.
    putOperation ObjectA definition of a PUT operation on this path.
    postOperation ObjectA definition of a POST operation on this path.
    deleteOperation ObjectA definition of a DELETE operation on this path.
    optionsOperation ObjectA definition of a OPTIONS operation on this path.
    headOperation ObjectA definition of a HEAD operation on this path.
    patchOperation ObjectA definition of a PATCH operation on this path.
    parameters[Parameter Object ¦ Reference Object]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.
    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Path Item Object Example
    -
    
    -{
    -  "get": {
    -    "description": "Returns pets based on ID",
    -    "summary": "Find pets by ID",
    -    "operationId": "getPetsById",
    -    "produces": [
    -      "application/json",
    -      "text/html"
    -    ],
    -    "responses": {
    -      "200": {
    -        "description": "pet response",
    -        "schema": {
    -          "type": "array",
    -          "items": {
    -            "$ref": "#/definitions/Pet"
    -          }
    -        }
    -      },
    -      "default": {
    -        "description": "error payload",
    -        "schema": {
    -          "$ref": "#/definitions/ErrorModel"
    -        }
    -      }
    -    }
    -  },
    -  "parameters": [
    -    {
    -      "name": "id",
    -      "in": "path",
    -      "description": "ID of pet to use",
    -      "required": true,
    -      "type": "array",
    -      "items": {
    -        "type": "string"
    -      },
    -      "collectionFormat": "csv"
    -    }
    -  ]
    -}
    -
    -
    
    -get:
    -  description: Returns pets based on ID
    -  summary: Find pets by ID
    -  operationId: getPetsById
    -  produces:
    -  - application/json
    -  - text/html
    -  responses:
    -    '200':
    -      description: pet response
    -      schema:
    -        type: array
    -        items:
    -          $ref: '#/definitions/Pet'
    -    default:
    -      description: error payload
    -      schema:
    -        $ref: '#/definitions/ErrorModel'
    -parameters:
    -- name: id
    -  in: path
    -  description: ID of pet to use
    -  required: true
    -  type: array
    -  items:
    -    type: string
    -  collectionFormat: csv
    -
    -

    Operation Object

    -

    Describes a single API operation on a path.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    tags[string]A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
    summarystringA short summary of what the operation does. For maximum readability in the swagger-ui, this field SHOULD be less than 120 characters.
    descriptionstringA verbose explanation of the operation behavior. GFM syntax can be used for rich text representation.
    externalDocsExternal Documentation ObjectAdditional external documentation for this operation.
    operationIdstringUnique 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.
    consumes[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.
    produces[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.
    parameters[Parameter Object ¦ Reference Object]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.
    responsesResponses ObjectRequired. The list of possible responses as they are returned from executing this operation.
    schemes[string]The transfer protocol for the operation. Values MUST be from the list: "http", "https", "ws", "wss". The value overrides the Swagger Object schemes definition.
    deprecatedbooleanDeclares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is false.
    security[Security Requirement Object]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.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Operation Object Example
    -
    
    -{
    -  "tags": [
    -    "pet"
    -  ],
    -  "summary": "Updates a pet in the store with form data",
    -  "description": "",
    -  "operationId": "updatePetWithForm",
    -  "consumes": [
    -    "application/x-www-form-urlencoded"
    -  ],
    -  "produces": [
    -    "application/json",
    -    "application/xml"
    -  ],
    -  "parameters": [
    -    {
    -      "name": "petId",
    -      "in": "path",
    -      "description": "ID of pet that needs to be updated",
    -      "required": true,
    -      "type": "string"
    -    },
    -    {
    -      "name": "name",
    -      "in": "formData",
    -      "description": "Updated name of the pet",
    -      "required": false,
    -      "type": "string"
    -    },
    -    {
    -      "name": "status",
    -      "in": "formData",
    -      "description": "Updated status of the pet",
    -      "required": false,
    -      "type": "string"
    -    }
    -  ],
    -  "responses": {
    -    "200": {
    -      "description": "Pet updated."
    -    },
    -    "405": {
    -      "description": "Invalid input"
    -    }
    -  },
    -  "security": [
    -    {
    -      "petstore_auth": [
    -        "write:pets",
    -        "read:pets"
    -      ]
    -    }
    -  ]
    -}
    -
    -
    
    -tags:
    -- pet
    -summary: Updates a pet in the store with form data
    -description: ""
    -operationId: updatePetWithForm
    -consumes:
    -- application/x-www-form-urlencoded
    -produces:
    -- application/json
    -- application/xml
    -parameters:
    -- name: petId
    -  in: path
    -  description: ID of pet that needs to be updated
    -  required: true
    -  type: string
    -- name: name
    -  in: formData
    -  description: Updated name of the pet
    -  required: false
    -  type: string
    -- name: status
    -  in: formData
    -  description: Updated status of the pet
    -  required: false
    -  type: string
    -responses:
    -  '200':
    -    description: Pet updated.
    -  '405':
    -    description: Invalid input
    -security:
    -- petstore_auth:
    -  - write:pets
    -  - read:pets
    -
    -

    External Documentation Object

    -

    Allows referencing an external resource for extended documentation.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringA short description of the target documentation. GFM syntax can be used for rich text representation.
    urlstringRequired. The URL for the target documentation. Value MUST be in the format of a URL.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    External Documentation Object Example
    -
    
    -{
    -  "description": "Find more info here",
    -  "url": "https://swagger.io"
    -}
    -
    -
    
    -description: Find more info here
    -url: https://swagger.io
    -
    -

    Parameter Object

    -

    Describes a single operation parameter.

    -

    A unique parameter is defined by a combination of a name and location.

    -

    There are five possible parameter types.

    -
      -
    • Path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId.
    • -
    • Query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id.
    • -
    • Header - Custom headers that are expected as part of the request.
    • -
    • Body - The payload that’s appended to the HTTP request. Since there can only be one payload, there can only be one body parameter. The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation.
    • -
    • Form - Used to describe the payload of an HTTP request when either application/x-www-form-urlencoded, multipart/form-data or both are used as the content type of the request (in Swagger’s definition, the consumes property of an operation). This is the only parameter type that can be used to send files, thus supporting the file type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): -
        -
      • application/x-www-form-urlencoded - Similar to the format of Query parameters but as a payload. For example, foo=1&bar=swagger - both foo and bar are form parameters. This is normally used for simple parameters that are being transferred.
      • -
      • multipart/form-data - each parameter takes a section in the payload with an internal header. For example, for the header Content-Disposition: form-data; name="submit-name" the name of the parameter is submit-name. This type of form parameters is more commonly used for file transfers.
      • -
      -
    • -
    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringRequired. 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.
    instringRequired. The location of the parameter. Possible values are “query”, “header”, “path”, “formData” or “body”.
    descriptionstringA brief description of the parameter. This could contain examples of use. GFM syntax can be used for rich text representation.
    requiredbooleanDetermines 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.
    -

    If in is "body":

    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    schemaSchema ObjectRequired. The schema defining the type used for the body parameter.
    -

    If in is any value other than "body":

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    typestringRequired. 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".
    formatstringThe extending format for the previously mentioned type. See Data Type Formats for further details.
    allowEmptyValuebooleanSets 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.
    itemsItems ObjectRequired if type is “array”. Describes the type of items in the array.
    collectionFormatstringDetermines 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.
    default*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.
    maximumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
    exclusiveMaximumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
    minimumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
    exclusiveMinimumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
    maxLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1.
    minLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2.
    patternstringSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.
    maxItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2.
    minItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3.
    uniqueItemsbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4.
    enum[*]See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1.
    multipleOfnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1.
    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Parameter Object Examples
    -
    Body Parameters
    -

    A body parameter with a referenced schema definition (normally for a model definition):

    -
    
    -{
    -  "name": "user",
    -  "in": "body",
    -  "description": "user to add to the system",
    -  "required": true,
    -  "schema": {
    -    "$ref": "#/definitions/User"
    -  }
    -}
    -
    -
    
    -name: user
    -in: body
    -description: user to add to the system
    -required: true
    -schema:
    -  $ref: '#/definitions/User'
    -
    -

    A body parameter that is an array of string values:

    -
    
    -{
    -  "name": "user",
    -  "in": "body",
    -  "description": "user to add to the system",
    -  "required": true,
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    }
    -  }
    -}
    -
    -
    
    -name: user
    -in: body
    -description: user to add to the system
    -required: true
    -schema:
    -  type: array
    -  items:
    -    type: string
    -
    -
    Other Parameters
    -

    A header parameter with an array of 64 bit integer numbers:

    -
    
    -{
    -  "name": "token",
    -  "in": "header",
    -  "description": "token to be passed as a header",
    -  "required": true,
    -  "type": "array",
    -  "items": {
    -    "type": "integer",
    -    "format": "int64"
    -  },
    -  "collectionFormat": "csv"
    -}
    -
    -
    
    -name: token
    -in: header
    -description: token to be passed as a header
    -required: true
    -type: array
    -items:
    -  type: integer
    -  format: int64
    -collectionFormat: csv
    -
    -

    A path parameter of a string value:

    -
    
    -{
    -  "name": "username",
    -  "in": "path",
    -  "description": "username to fetch",
    -  "required": true,
    -  "type": "string"
    -}
    -
    -
    
    -name: username
    -in: path
    -description: username to fetch
    -required: true
    -type: string
    -
    -

    An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

    -
    
    -{
    -  "name": "id",
    -  "in": "query",
    -  "description": "ID of the object to fetch",
    -  "required": false,
    -  "type": "array",
    -  "items": {
    -    "type": "string"
    -  },
    -  "collectionFormat": "multi"
    -}
    -
    -
    
    -name: id
    -in: query
    -description: ID of the object to fetch
    -required: false
    -type: array
    -items:
    -  type: string
    -collectionFormat: multi
    -
    -

    A form data with file type for a file upload:

    -
    
    -{
    -  "name": "avatar",
    -  "in": "formData",
    -  "description": "The avatar of the user",
    -  "required": true,
    -  "type": "file"
    -}
    -
    -
    
    -name: avatar
    -in: formData
    -description: The avatar of the user
    -required: true
    -type: file
    -
    -

    Items Object

    -

    A limited subset of JSON-Schema’s items object. It is used by parameter definitions that are not located in "body".

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    typestringRequired. The internal type of the array. The value MUST be one of "string", "number", "integer", "boolean", or "array". Files and models are not allowed.
    formatstringThe extending format for the previously mentioned type. See Data Type Formats for further details.
    itemsItems ObjectRequired if type is “array”. Describes the type of items in the array.
    collectionFormatstringDetermines 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.
    Default value is csv.
    default*Declares the value of the item that the server will use if none is provided. (Note: “default” has no meaning for required items.) 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 the data type.
    maximumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
    exclusiveMaximumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
    minimumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
    exclusiveMinimumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
    maxLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1.
    minLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2.
    patternstringSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.
    maxItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2.
    minItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3.
    uniqueItemsbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4.
    enum[*]See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1.
    multipleOfnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Items Object Examples
    -

    Items must be of type string and have the minimum length of 2 characters:

    -
    
    -{
    -    "type": "string",
    -    "minLength": 2
    -}
    -
    -
    
    -type: string
    -minLength: 2
    -
    -

    An array of arrays, the internal array being of type integer, numbers must be between 0 and 63 (inclusive):

    -
    
    -{
    -    "type": "array",
    -    "items": {
    -        "type": "integer",
    -        "minimum": 0,
    -        "maximum": 63
    -    }
    -}
    -
    -
    
    -type: array
    -items:
    -  type: integer
    -  minimum: 0
    -  maximum: 63
    -
    -

    Responses Object

    -

    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 Responses Object MUST contain at least one response code, and it SHOULD be the response for a successful operation call.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    defaultResponse Object ¦ Reference ObjectThe 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.
    -
    Patterned Fields
    - - - - - - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {HTTP Status Code}Response Object ¦ Reference ObjectAny HTTP status code can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. Reference Object can be used to link to a response that is defined at the Swagger Object’s responses section.
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Responses Object Example
    -

    A 200 response for successful operation and a default response for others (implying an error):

    -
    
    -{
    -  "200": {
    -    "description": "a pet to be returned",
    -    "schema": {
    -      "$ref": "#/definitions/Pet"
    -    }
    -  },
    -  "default": {
    -    "description": "Unexpected error",
    -    "schema": {
    -      "$ref": "#/definitions/ErrorModel"
    -    }
    -  }
    -}
    -
    -
    
    -'200':
    -  description: a pet to be returned
    -  schema:
    -    $ref: '#/definitions/Pet'
    -default:
    -  description: Unexpected error
    -  schema:
    -    $ref: '#/definitions/ErrorModel'
    -
    -

    Response Object

    -

    Describes a single response from an API Operation.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringRequired. A short description of the response. GFM syntax can be used for rich text representation.
    schemaSchema ObjectA 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 Schema Object, its root type value may also be "file". This SHOULD be accompanied by a relevant produces mime-type.
    headersHeaders ObjectA list of headers that are sent with the response.
    examplesExample ObjectAn example of the response message.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Response Object Examples
    -

    Response of an array of a complex type:

    -
    
    -{
    -  "description": "A complex object array response",
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "$ref": "#/definitions/VeryComplexType"
    -    }
    -  }
    -}
    -
    -
    
    -description: A complex object array response
    -schema:
    -  type: array
    -  items:
    -    $ref: '#/definitions/VeryComplexType'
    -
    -

    Response with a string type:

    -
    
    -{
    -  "description": "A simple string response",
    -  "schema": {
    -    "type": "string"
    -  }
    -}
    -
    -
    
    -description: A simple string response
    -schema:
    -  type: string
    -
    -

    Response with headers:

    -
    
    -{
    -  "description": "A simple string response",
    -  "schema": {
    -    "type": "string"
    -  },
    -  "headers": {
    -    "X-Rate-Limit-Limit": {
    -      "description": "The number of allowed requests in the current period",
    -      "type": "integer"
    -    },
    -    "X-Rate-Limit-Remaining": {
    -      "description": "The number of remaining requests in the current period",
    -      "type": "integer"
    -    },
    -    "X-Rate-Limit-Reset": {
    -      "description": "The number of seconds left in the current period",
    -      "type": "integer"
    -    }
    -  }
    -}
    -
    -
    
    -description: A simple string response
    -schema:
    -  type: string
    -headers:
    -  X-Rate-Limit-Limit:
    -    description: The number of allowed requests in the current period
    -    type: integer
    -  X-Rate-Limit-Remaining:
    -    description: The number of remaining requests in the current period
    -    type: integer
    -  X-Rate-Limit-Reset:
    -    description: The number of seconds left in the current period
    -    type: integer
    -
    -

    Response with no return value:

    -
    
    -{
    -  "description": "object created"
    -}
    -
    -
    
    -description: object created
    -
    -

    Headers Object

    -

    Lists the headers that can be sent as part of a response.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}Header ObjectThe name of the property corresponds to the name of the header. The value describes the type of the header.
    -
    Headers Object Example
    -

    Rate-limit headers:

    -
    
    -{
    -    "X-Rate-Limit-Limit": {
    -        "description": "The number of allowed requests in the current period",
    -        "type": "integer"
    -    },
    -    "X-Rate-Limit-Remaining": {
    -        "description": "The number of remaining requests in the current period",
    -        "type": "integer"
    -    },
    -    "X-Rate-Limit-Reset": {
    -        "description": "The number of seconds left in the current period",
    -        "type": "integer"
    -    }
    -}
    -
    -
    
    -X-Rate-Limit-Limit:
    -  description: The number of allowed requests in the current period
    -  type: integer
    -X-Rate-Limit-Remaining:
    -  description: The number of remaining requests in the current period
    -  type: integer
    -X-Rate-Limit-Reset:
    -  description: The number of seconds left in the current period
    -  type: integer
    -
    -

    Example Object

    -

    Allows sharing examples for operation responses.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {mime type}AnyThe 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.
    -
    Example Object Example
    -

    Example response for application/json mimetype of a Pet data type:

    -
    
    -{
    -  "application/json": {
    -    "name": "Puma",
    -    "type": "Dog",
    -    "color": "Black",
    -    "gender": "Female",
    -    "breed": "Mixed"
    -  }
    -}
    -
    -
    
    -application/json:
    -  name: Puma
    -  type: Dog
    -  color: Black
    -  gender: Female
    -  breed: Mixed
    -
    -

    Header Object

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringA short description of the header.
    typestringRequired. The type of the object. The value MUST be one of "string", "number", "integer", "boolean", or "array".
    formatstringThe extending format for the previously mentioned type. See Data Type Formats for further details.
    itemsItems ObjectRequired if type is “array”. Describes the type of items in the array.
    collectionFormatstringDetermines 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.
    Default value is csv.
    default*Declares the value of the header that the server will use if none is provided. (Note: “default” has no meaning for required headers.) 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 the header.
    maximumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
    exclusiveMaximumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2.
    minimumnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
    exclusiveMinimumbooleanSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3.
    maxLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1.
    minLengthintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2.
    patternstringSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.
    maxItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2.
    minItemsintegerSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3.
    uniqueItemsbooleanhttps://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4.
    enum[*]See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1.
    multipleOfnumberSee https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Header Object Example
    -

    A simple header with of an integer type:

    -
    
    -{
    -  "description": "The number of allowed requests in the current period",
    -  "type": "integer"
    -}
    -
    -
    
    -description: The number of allowed requests in the current period
    -type: integer
    -
    -

    Tag Object

    -

    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.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringRequired. The name of the tag.
    descriptionstringA short description for the tag. GFM syntax can be used for rich text representation.
    externalDocsExternal Documentation ObjectAdditional external documentation for this tag.
    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Tag Object Example
    -
    
    -{
    -	"name": "pet",
    -	"description": "Pets operations"
    -}
    -
    -
    
    -name: pet
    -description: Pets operations
    -
    -

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

    -
    Fixed Fields
    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    $refstringRequired. The reference string.
    -
    Reference Object Example
    -
    
    -{
    -	"$ref": "#/definitions/Pet"
    -}
    -
    -
    
    -$ref: '#/definitions/Pet'
    -
    -
    Relative Schema File Example
    -
    
    -{
    -  "$ref": "Pet.json"
    -}
    -
    -
    
    -$ref: 'Pet.yaml'
    -
    -
    Relative Files With Embedded Schema Example
    -
    
    -{
    -  "$ref": "definitions.json#/Pet"
    -}
    -
    -
    
    -$ref: 'definitions.yaml#/Pet'
    -
    -

    Schema Object

    -

    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.

    -

    Further information about the properties can be found in JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here.

    -

    The following properties are taken directly from the JSON Schema definition and follow the same specifications:

    -
      -
    • $ref - As a JSON Reference
    • -
    • format (See Data Type Formats for further details)
    • -
    • title
    • -
    • description (GFM syntax can be used for rich text representation)
    • -
    • default (Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object)
    • -
    • multipleOf
    • -
    • maximum
    • -
    • exclusiveMaximum
    • -
    • minimum
    • -
    • exclusiveMinimum
    • -
    • maxLength
    • -
    • minLength
    • -
    • pattern
    • -
    • maxItems
    • -
    • minItems
    • -
    • uniqueItems
    • -
    • maxProperties
    • -
    • minProperties
    • -
    • required
    • -
    • enum
    • -
    • type
    • -
    -

    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.

    -
      -
    • items
    • -
    • allOf
    • -
    • properties
    • -
    • additionalProperties
    • -
    -

    Other than the JSON Schema subset fields, the following fields may be used for further schema documentation.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    discriminatorstringAdds 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.
    readOnlybooleanRelevant 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.
    xmlXML ObjectThis 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.
    externalDocsExternal Documentation ObjectAdditional external documentation for this schema.
    exampleAnyA free-form property to include an example of an instance for this schema.
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Composition and Inheritance (Polymorphism)
    -

    Swagger allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. allOf takes in an array of object definitions that are validated independently but together compose a single object.

    -

    While composition offers model extensibility, it does not imply a hierarchy between the models. To support polymorphism, Swagger adds the support of the discriminator field. When used, the discriminator will be the name of the property used to decide which schema definition is used to validate the structure of the model. As such, the discriminator field MUST be a required field. The value of the chosen property has to be the friendly name given to the model under the definitions property. As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism.

    -
    XML Modeling
    -

    The xml property allows extra definitions when translating the JSON definition to XML. The XML Object contains additional information about the available options.

    -
    Schema Object Examples
    -
    Primitive Sample
    -

    Unlike previous versions of Swagger, Schema definitions can be used to describe primitive and arrays as well.

    -
    
    -{
    -    "type": "string",
    -    "format": "email"
    -}
    -
    -
    
    -type: string
    -format: email
    -
    -
    Simple Model
    -
    
    -{
    -  "type": "object",
    -  "required": [
    -    "name"
    -  ],
    -  "properties": {
    -    "name": {
    -      "type": "string"
    -    },
    -    "address": {
    -      "$ref": "#/definitions/Address"
    -    },
    -    "age": {
    -      "type": "integer",
    -      "format": "int32",
    -      "minimum": 0
    -    }
    -  }
    -}
    -
    -
    
    -type: object
    -required:
    -- name
    -properties:
    -  name:
    -    type: string
    -  address:
    -    $ref: '#/definitions/Address'
    -  age:
    -    type: integer
    -    format: int32
    -    minimum: 0
    -
    -
    Model with Map/Dictionary Properties
    -

    For a simple string to string mapping:

    -
    
    -{
    -  "type": "object",
    -  "additionalProperties": {
    -    "type": "string"
    -  }
    -}
    -
    -
    
    -type: object
    -additionalProperties:
    -  type: string
    -
    -

    For a string to model mapping:

    -
    
    -{
    -  "type": "object",
    -  "additionalProperties": {
    -    "$ref": "#/definitions/ComplexModel"
    -  }
    -}
    -
    -
    
    -type: object
    -additionalProperties:
    -  $ref: '#/definitions/ComplexModel'
    -
    -
    Model with Example
    -
    
    -{
    -  "type": "object",
    -  "properties": {
    -    "id": {
    -      "type": "integer",
    -      "format": "int64"
    -    },
    -    "name": {
    -      "type": "string"
    -    }
    -  },
    -  "required": [
    -    "name"
    -  ],
    -  "example": {
    -    "name": "Puma",
    -    "id": 1
    -  }
    -}
    -
    -
    
    -type: object
    -properties:
    -  id:
    -    type: integer
    -    format: int64
    -  name:
    -    type: string
    -required:
    -- name
    -example:
    -  name: Puma
    -  id: 1
    -
    -
    Models with Composition
    -
    
    -{
    -  "definitions": {
    -    "ErrorModel": {
    -      "type": "object",
    -      "required": [
    -        "message",
    -        "code"
    -      ],
    -      "properties": {
    -        "message": {
    -          "type": "string"
    -        },
    -        "code": {
    -          "type": "integer",
    -          "minimum": 100,
    -          "maximum": 600
    -        }
    -      }
    -    },
    -    "ExtendedErrorModel": {
    -      "allOf": [
    -        {
    -          "$ref": "#/definitions/ErrorModel"
    -        },
    -        {
    -          "type": "object",
    -          "required": [
    -            "rootCause"
    -          ],
    -          "properties": {
    -            "rootCause": {
    -              "type": "string"
    -            }
    -          }
    -        }
    -      ]
    -    }
    -  }
    -}
    -
    -
    
    -definitions:
    -  ErrorModel:
    -    type: object
    -    required:
    -    - message
    -    - code
    -    properties:
    -      message:
    -        type: string
    -      code:
    -        type: integer
    -        minimum: 100
    -        maximum: 600
    -  ExtendedErrorModel:
    -    allOf:
    -    - $ref: '#/definitions/ErrorModel'
    -    - type: object
    -      required:
    -      - rootCause
    -      properties:
    -        rootCause:
    -          type: string
    -
    -
    Models with Polymorphism Support
    -
    
    -{
    -  "definitions": {
    -    "Pet": {
    -      "type": "object",
    -      "discriminator": "petType",
    -      "properties": {
    -        "name": {
    -          "type": "string"
    -        },
    -        "petType": {
    -          "type": "string"
    -        }
    -      },
    -      "required": [
    -        "name",
    -        "petType"
    -      ]
    -    },
    -    "Cat": {
    -      "description": "A representation of a cat",
    -      "allOf": [
    -        {
    -          "$ref": "#/definitions/Pet"
    -        },
    -        {
    -          "type": "object",
    -          "properties": {
    -            "huntingSkill": {
    -              "type": "string",
    -              "description": "The measured skill for hunting",
    -              "default": "lazy",
    -              "enum": [
    -                "clueless",
    -                "lazy",
    -                "adventurous",
    -                "aggressive"
    -              ]
    -            }
    -          },
    -          "required": [
    -            "huntingSkill"
    -          ]
    -        }
    -      ]
    -    },
    -    "Dog": {
    -      "description": "A representation of a dog",
    -      "allOf": [
    -        {
    -          "$ref": "#/definitions/Pet"
    -        },
    -        {
    -          "type": "object",
    -          "properties": {
    -            "packSize": {
    -              "type": "integer",
    -              "format": "int32",
    -              "description": "the size of the pack the dog is from",
    -              "default": 0,
    -              "minimum": 0
    -            }
    -          },
    -          "required": [
    -            "packSize"
    -          ]
    -        }
    -      ]
    -    }
    -  }
    -}
    -
    -
    
    -definitions:
    -  Pet:
    -    type: object
    -    discriminator: petType
    -    properties:
    -      name:
    -        type: string
    -      petType:
    -        type: string
    -    required:
    -    - name
    -    - petType
    -  Cat:
    -    description: A representation of a cat
    -    allOf:
    -    - $ref: '#/definitions/Pet'
    -    - type: object
    -      properties:
    -        huntingSkill:
    -          type: string
    -          description: The measured skill for hunting
    -          default: lazy
    -          enum:
    -          - clueless
    -          - lazy
    -          - adventurous
    -          - aggressive
    -      required:
    -      - huntingSkill
    -  Dog:
    -    description: A representation of a dog
    -    allOf:
    -    - $ref: '#/definitions/Pet'
    -    - type: object
    -      properties:
    -        packSize:
    -          type: integer
    -          format: int32
    -          description: the size of the pack the dog is from
    -          default: 0
    -          minimum: 0
    -      required:
    -      - packSize
    -
    -

    XML Object

    -

    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.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringReplaces 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.
    namespacestringThe URL of the namespace definition. Value SHOULD be in the form of a URL.
    prefixstringThe prefix to be used for the name.
    attributebooleanDeclares whether the property definition translates to an attribute instead of an element. Default value is false.
    wrappedbooleanMAY 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).
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    XML Object Examples
    -

    The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

    -
    No XML Element
    -

    Basic string property:

    -
    
    -{
    -    "animals": {
    -        "type": "string"
    -    }
    -}
    -
    -
    
    -animals:
    -  type: string
    -
    -
    
    -<animals>...</animals>
    -
    -

    Basic string array property (wrapped is false by default):

    -
    
    -{
    -    "animals": {
    -        "type": "array",
    -        "items": {
    -            "type": "string"
    -        }
    -    }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -
    -
    
    -<animals>...</animals>
    -<animals>...</animals>
    -<animals>...</animals>
    -
    -
    XML Name Replacement
    -
    
    -{
    -  "animals": {
    -    "type": "string",
    -    "xml": {
    -      "name": "animal"
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: string
    -  xml:
    -    name: animal
    -
    -
    
    -<animal>...</animal>
    -
    -
    XML Attribute, Prefix and Namespace
    -

    In this example, a full model definition is shown.

    -
    
    -{
    -  "Person": {
    -    "type": "object",
    -    "properties": {
    -      "id": {
    -        "type": "integer",
    -        "format": "int32",
    -        "xml": {
    -          "attribute": true
    -        }
    -      },
    -      "name": {
    -        "type": "string",
    -        "xml": {
    -          "namespace": "http://swagger.io/schema/sample",
    -          "prefix": "sample"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -Person:
    -  type: object
    -  properties:
    -    id:
    -      type: integer
    -      format: int32
    -      xml:
    -        attribute: true
    -    name:
    -      type: string
    -      xml:
    -        namespace: http://swagger.io/schema/sample
    -        prefix: sample
    -
    -
    
    -<Person id="123">
    -    <sample:name xmlns:sample="http://swagger.io/schema/sample">example</sample:name>
    -</Person>
    -
    -
    XML Arrays
    -

    Changing the element names:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -
    -
    
    -<animal>value</animal>
    -<animal>value</animal>
    -
    -

    The external name property has no effect on the XML:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens"
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -
    -
    
    -<animal>value</animal>
    -<animal>value</animal>
    -
    -

    Even when the array is wrapped, if no name is explicitly defined, the same name will be used both internally and externally:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    wrapped: true
    -
    -
    
    -<animals>
    -  <animals>value</animals>
    -  <animals>value</animals>
    -</animals>
    -
    -

    To overcome the above example, the following definition can be used:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    wrapped: true
    -
    -
    
    -<animals>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</animals>
    -
    -

    Affecting both internal and external names:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    
    -<aliens>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</aliens>
    -
    -

    If we change the external element but not the internal ones:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    
    -<aliens>
    -  <aliens>value</aliens>
    -  <aliens>value</aliens>
    -</aliens>
    -
    -

    Definitions Object

    -

    An object to hold data types that can be consumed and produced by operations. These data types can be primitives, arrays or models.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}Schema ObjectA single definition, mapping a “name” to the schema it defines.
    -
    Definitions Object Example
    -
    
    -{
    -  "Category": {
    -    "type": "object",
    -    "properties": {
    -      "id": {
    -        "type": "integer",
    -        "format": "int64"
    -      },
    -      "name": {
    -        "type": "string"
    -      }
    -    }
    -  },
    -  "Tag": {
    -    "type": "object",
    -    "properties": {
    -      "id": {
    -        "type": "integer",
    -        "format": "int64"
    -      },
    -      "name": {
    -        "type": "string"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -Category:
    -  type: object
    -  properties:
    -    id:
    -      type: integer
    -      format: int64
    -    name:
    -      type: string
    -Tag:
    -  type: object
    -  properties:
    -    id:
    -      type: integer
    -      format: int64
    -    name:
    -      type: string
    -
    -

    Parameters Definitions Object

    -

    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.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}Parameter ObjectA single parameter definition, mapping a “name” to the parameter it defines.
    -
    Parameters Definition Object Example
    -
    
    -{
    -  "skipParam": {
    -    "name": "skip",
    -    "in": "query",
    -    "description": "number of items to skip",
    -    "required": true,
    -    "type": "integer",
    -    "format": "int32"
    -  },
    -  "limitParam": {
    -    "name": "limit",
    -    "in": "query",
    -    "description": "max records to return",
    -    "required": true,
    -    "type": "integer",
    -    "format": "int32"
    -  }
    -}
    -
    -
    
    -skipParam:
    -  name: skip
    -  in: query
    -  description: number of items to skip
    -  required: true
    -  type: integer
    -  format: int32
    -limitParam:
    -  name: limit
    -  in: query
    -  description: max records to return
    -  required: true
    -  type: integer
    -  format: int32
    -
    -

    Responses Definitions Object

    -

    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.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}Response ObjectA single response definition, mapping a “name” to the response it defines.
    -
    Responses Definitions Object Example
    -
    
    -{
    -  "NotFound": {
    -    "description": "Entity not found."
    -  },
    -  "IllegalInput": {
    -  	"description": "Illegal input for operation."
    -  },
    -  "GeneralError": {
    -  	"description": "General Error",
    -  	"schema": {
    -  		"$ref": "#/definitions/GeneralError"
    -  	}
    -  }
    -}
    -
    -
    
    -NotFound:
    -  description: Entity not found.
    -IllegalInput:
    -  description: Illegal input for operation.
    -GeneralError:
    -  description: General Error
    -  schema:
    -    $ref: '#/definitions/GeneralError'
    -
    -

    Security Definitions Object

    -

    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.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}Security Scheme ObjectA single security scheme definition, mapping a “name” to the scheme it defines.
    -
    Security Definitions Object Example
    -
    
    -{
    -  "api_key": {
    -    "type": "apiKey",
    -    "name": "api_key",
    -    "in": "header"
    -  },
    -  "petstore_auth": {
    -    "type": "oauth2",
    -    "authorizationUrl": "http://swagger.io/api/oauth/dialog",
    -    "flow": "implicit",
    -    "scopes": {
    -      "write:pets": "modify pets in your account",
    -      "read:pets": "read your pets"
    -    }
    -  }
    -}
    -
    -
    
    -api_key:
    -  type: apiKey
    -  name: api_key
    -  in: header
    -petstore_auth:
    -  type: oauth2
    -  authorizationUrl: http://swagger.io/api/oauth/dialog
    -  flow: implicit
    -  scopes:
    -    write:pets: modify pets in your account
    -    read:pets: read your pets
    -
    -

    Security Scheme Object

    -

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

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeValidityDescription
    typestringAnyRequired. The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".
    descriptionstringAnyA short description for security scheme.
    namestringapiKeyRequired. The name of the header or query parameter to be used.
    instringapiKeyRequired The location of the API key. Valid values are "query" or "header".
    flowstringoauth2Required. The flow used by the OAuth2 security scheme. Valid values are "implicit", "password", "application" or "accessCode".
    authorizationUrlstringoauth2 ("implicit", "accessCode")Required. The authorization URL to be used for this flow. This SHOULD be in the form of a URL.
    tokenUrlstringoauth2 ("password", "application", "accessCode")Required. The token URL to be used for this flow. This SHOULD be in the form of a URL.
    scopesScopes Objectoauth2Required. The available scopes for the OAuth2 security scheme.
    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Security Scheme Object Example
    -
    Basic Authentication Sample
    -
    
    -{
    -  "type": "basic"
    -}
    -
    -
    
    -type: basic
    -
    -
    API Key Sample
    -
    
    -{
    -  "type": "apiKey",
    -  "name": "api_key",
    -  "in": "header"
    -}
    -
    -
    
    -type: apiKey
    -name: api_key
    -in: header
    -
    -
    Implicit OAuth2 Sample
    -
    
    -{
    -  "type": "oauth2",
    -  "authorizationUrl": "http://swagger.io/api/oauth/dialog",
    -  "flow": "implicit",
    -  "scopes": {
    -    "write:pets": "modify pets in your account",
    -    "read:pets": "read your pets"
    -  }
    -}
    -
    -
    
    -type: oauth2
    -authorizationUrl: http://swagger.io/api/oauth/dialog
    -flow: implicit
    -scopes:
    -  write:pets: modify pets in your account
    -  read:pets: read your pets
    -
    -

    Scopes Object

    -

    Lists the available scopes for an OAuth2 security scheme.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}stringMaps between a name of a scope to a short description of it (as the value of the property).
    -
    Patterned Objects
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details.
    -
    Scopes Object Example
    -
    
    -{
    -  "write:pets": "modify pets in your account",
    -  "read:pets": "read your pets"
    -}
    -
    -
    
    -write:pets: modify pets in your account
    -read:pets: read your pets
    -
    -

    Security Requirement Object

    -

    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.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}[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.
    -
    Security Requirement Object Examples
    -
    Non-OAuth2 Security Requirement
    -
    
    -{
    -  "api_key": []
    -}
    -
    -
    
    -api_key: []
    -
    -
    OAuth2 Security Requirement
    -
    
    -{
    -  "petstore_auth": [
    -    "write:pets",
    -    "read:pets"
    -  ]
    -}
    -
    -
    
    -petstore_auth:
    -- write:pets
    -- read:pets
    -
    -

    Specification Extensions

    -

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

    -

    Security Filtering

    -

    Some objects in the Swagger specification may be declared and remain empty, or completely be removed, even though they are inherently the core of the API documentation.

    -

    The reasoning behind it is to allow an additional layer of access control over the documentation itself. While not part of the specification itself, certain libraries may choose to allow access to parts of the documentation based on some form of authentication/authorization.

    -

    Two examples for this:

    -
      -
    1. The Paths Object may be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication.
    2. -
    3. The Path Item Object may be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object so the user will not be aware of its existence. This allows the documentation provider a finer control over what the viewer can see.
    4. -
    - diff --git a/scripts/md2html/v2/heading.bs b/scripts/md2html/v2/heading.bs deleted file mode 100644 index 4a380a6f98..0000000000 --- a/scripts/md2html/v2/heading.bs +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - -Open API Initiative logo diff --git a/scripts/md2html/v2/oas_2.0.html b/scripts/md2html/v2/oas_2.0.html deleted file mode 100644 index b0cafe19ce..0000000000 --- a/scripts/md2html/v2/oas_2.0.html +++ /dev/null @@ -1,4324 +0,0 @@ - - - - - - OpenAPI Specification - - - - - - - - - - - - - - -
    -
    -

    -

    OpenAPI Specification

    -

    Final Community Group Report,

    -
    -
    -
    -
    This version: -
    https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md -
    Issue Tracking: -
    GitHub -
    Editors: -
    Darrel Miller -
    Jason Harmon -
    Jeremy Whitlock -
    Marsh Gardiner -
    Ron Ratovsky -
    Tony Tam -
    -
    -
    - -
    -
    -
    -

    Abstract

    -

    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    -
    -

    Status of this document

    -
    -

    -
    -
    - -
    - - - -

    Open API Initiative logo

    - OpenAPI Specification -

    OpenAPI Specification

    -

    1. (fka Swagger RESTful API Documentation Specification)

    -

    1.1. Version 2.0

    -

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [!rfc2119].

    -

    The Swagger specification is licensed under The Apache License, Version 2.0.

    -

    2. Introductions

    -

    Swagger™ is a project used to describe and document RESTful APIs.

    -

    The Swagger specification defines a set of files required to describe such an API. These files can then be used by the Swagger-UI project to display the API and Swagger-Codegen to generate clients in various languages. Additional utilities can also take advantage of the resulting files, such as testing tools.

    -

    3. Revision History

    - - - - - - - - -
    Version - Date - Notes -
    2.0 - 2014-09-08 - Release of Swagger 2.0 -
    1.2 - 2014-03-14 - Initial release of the formal document. -
    1.1 - 2012-08-22 - Release of Swagger 1.1 -
    1.0 - 2011-08-10 - First release of the Swagger Specification -
    -

    4. Definitions

    -

    Path Templating

    -

    Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters.

    -
    4.1. Mime Types
    -

    Mime type definitions are spread across several resources. The mime type definitions should be in compliance with [rfc6838].

    -

    Some examples of possible mime type definitions:

    -
    text/plain; charset=utf-8
    -application/json
    -application/vnd.github+json
    -application/vnd.github.v3+json
    -application/vnd.github.v3.raw+json
    -application/vnd.github.v3.text+json
    -application/vnd.github.v3.html+json
    -application/vnd.github.v3.full+json
    -application/vnd.github.v3.diff
    -application/vnd.github.v3.patch
    -
    -
    4.2. HTTP Status Codes
    -

    The HTTP Status Codes are used to indicate the status of the executed operation. The available status codes are described by [rfc7231]section-6) and in the IANA Status Code Registry.

    -

    5. Specification

    -

    5.1. Format

    -

    The files describing the RESTful API in accordance with the Swagger specification are represented as JSON objects and conform to the JSON standards. YAML, being a superset of JSON, can be used as well to -represent a Swagger specification file.

    -

    For example, if a field is said to have an array value, the JSON array representation will be used:

    -
    {
    -   "field" : [...]
    -}
    -
    -

    While the API is described using JSON it does not impose a JSON input/output to the API itself.

    -

    All field names in the specification are case sensitive.

    -

    The schema exposes two types of fields. Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name. Patterned fields can have multiple occurrences as long as each has a unique name.

    -

    5.2. File Structure

    -

    The Swagger representation of the API is made of a single file. However, parts of the definitions can be split into separate files, at the discretion of the user. This is applicable for $ref fields in the specification as follows from the JSON Schema definitions.

    -

    By convention, the Swagger specification file is named swagger.json.

    -

    5.3. Data Types

    -

    Primitive data types in the Swagger Specification are based on the types supported by the JSON-Schema Draft 4. Models are described using the Schema Object which is a subset of JSON Schema Draft 4.

    -

    An additional primitive data type "file" is used by the Parameter Object and the Response Object to set the parameter type or the response as being a file.

    -

    Primitives have an optional modifier property format. Swagger uses several known formats to more finely define the data type being used. However, the format property is an open string-valued property, and can have any value to support documentation needs. Formats such as "email", "uuid", etc., can be used even though they are not defined by this specification. Types that are not accompanied by a format property follow their definition from the JSON Schema (except for file type which is defined above). The formats defined by the Swagger Specification are:

    - - - - - - - - - - - - - - - -
    Common Name - type - format - Comments -
    integer - integer - int32 - signed 32 bits -
    long - integer - int64 - signed 64 bits -
    float - number - float - -
    double - number - double - -
    string - string - - -
    byte - string - byte - base64 encoded characters -
    binary - string - binary - any sequence of octets -
    boolean - boolean - - -
    date - string - date - As defined by full-date - [!rfc3339] -
    dateTime - string - date-time - As defined by date-time - [!rfc3339] -
    password - string - password - Used to hint UIs the input needs to be obscured. -
    -

    5.4. Schema

    -

    5.4.1. Swagger Object

    -

    This is the root document object for the API specification. It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document.

    -
    5.4.1.1. Fixed Fields
    - - - - - - - - - - - - - - - - - - - -
    Field Name - Type - Description -
    swagger - string - Required. 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". -
    info - Info Object - Required. Provides metadata about the API. The metadata can be used by the clients if needed. -
    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. -
    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. -
    schemes - [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. -
    consumes - [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. -
    produces - [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. -
    paths - Paths Object - Required. The available paths and operations for the API. -
    definitions - Definitions Object - An object to hold data types produced and consumed by operations. -
    parameters - Parameters Definitions Object - An object to hold parameters that can be used across operations. This property does not define global parameters for all operations. -
    responses - Responses Definitions Object - An object to hold responses that can be used across operations. This property does not define global responses for all operations. -
    securityDefinitions - Security Definitions Object - Security scheme definitions that can be used across the specification. -
    security - [Security Requirement Object] - 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. -
    tags - [Tag Object] - 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. -
    externalDocs - External Documentation Object - Additional external documentation. -
    -
    5.4.1.2. Patterned Objects
    - - - - - -
    Field Pattern - Type - Description -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -

    5.4.2. Info Object

    -

    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.

    -
    5.4.2.1. Fixed Fields
    - - - - - - - - - - -
    Field Name - Type - Description -
    title - string - Required. The title of the application. -
    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. -
    contact - Contact Object - The contact information for the exposed API. -
    license - License Object - The license information for the exposed API. -
    version - string - Required Provides the version of the application API (not to be confused with the specification version). -
    -
    5.4.2.2. Patterned Objects
    - - - - - -
    Field Pattern - Type - Description -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -
    5.4.2.3. Info Object Example:
    -
    {
    -  "title": "Swagger Sample App",
    -  "description": "This is a sample server Petstore server.",
    -  "termsOfService": "http://swagger.io/terms/",
    -  "contact": {
    -    "name": "API Support",
    -    "url": "http://www.swagger.io/support",
    -    "email": "support@swagger.io"
    -  },
    -  "license": {
    -    "name": "Apache 2.0",
    -    "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    -  },
    -  "version": "1.0.1"
    -}
    -
    -
    title: Swagger Sample App
    -description: This is a sample server Petstore server.
    -termsOfService: http://swagger.io/terms/
    -contact:
    -  name: API Support
    -  url: http://www.swagger.io/support
    -  email: support@swagger.io
    -license:
    -  name: Apache 2.0
    -  url: http://www.apache.org/licenses/LICENSE-2.0.html
    -version: 1.0.1
    -
    -

    5.4.3. Contact Object

    -

    Contact information for the exposed API.

    -
    5.4.3.1. Fixed Fields
    - - - - - - - -
    Field Name - Type - Description -
    name - string - The identifying name of the contact person/organization. -
    url - string - The URL pointing to the contact information. MUST be in the format of a URL. -
    email - string - The email address of the contact person/organization. MUST be in the format of an email address. -
    -
    5.4.3.2. Patterned Objects
    - - - - - -
    Field Pattern - Type - Description -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -
    5.4.3.3. Contact Object Example:
    -
    {
    -  "name": "API Support",
    -  "url": "http://www.swagger.io/support",
    -  "email": "support@swagger.io"
    -}
    -
    -
    name: API Support
    -url: http://www.swagger.io/support
    -email: support@swagger.io
    -
    -

    5.4.4. License Object

    -

    License information for the exposed API.

    -
    5.4.4.1. Fixed Fields
    - - - - - - -
    Field Name - Type - Description -
    name - string - Required. The license name used for the API. -
    url - string - A URL to the license used for the API. MUST be in the format of a URL. -
    -
    5.4.4.2. Patterned Objects
    - - - - - -
    Field Pattern - Type - Description -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -
    5.4.4.3. License Object Example:
    -
    {
    -  "name": "Apache 2.0",
    -  "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    -}
    -
    -
    name: Apache 2.0
    -url: http://www.apache.org/licenses/LICENSE-2.0.html
    -
    -

    5.4.5. Paths Object

    -

    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.

    -
    5.4.5.1. Patterned Fields
    - - - - - - -
    Field Pattern - Type - Description -
    /{path} - Path Item Object - A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended to the basePath in order to construct the full URL. Path templating is allowed. -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -
    5.4.5.2. Paths Object Example
    -
    {
    -  "/pets": {
    -    "get": {
    -      "description": "Returns all pets from the system that the user has access to",
    -      "produces": [
    -        "application/json"
    -      ],
    -      "responses": {
    -        "200": {
    -          "description": "A list of pets.",
    -          "schema": {
    -            "type": "array",
    -            "items": {
    -              "$ref": "#/definitions/pet"
    -            }
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    /pets:
    -  get:
    -    description: Returns all pets from the system that the user has access to
    -    produces:
    -    - application/json
    -    responses:
    -      '200':
    -        description: A list of pets.
    -        schema:
    -          type: array
    -          items:
    -            $ref: '#/definitions/pet'
    -
    -

    5.4.6. Path Item Object

    -

    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.

    -
    5.4.6.1. Fixed Fields
    - - - - - - - - - - - - - -
    Field Name - Type - Description -
    $ref - string - 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. -
    get - Operation Object - A definition of a GET operation on this path. -
    put - Operation Object - A definition of a PUT operation on this path. -
    post - Operation Object - A definition of a POST operation on this path. -
    delete - Operation Object - A definition of a DELETE operation on this path. -
    options - Operation Object - A definition of a OPTIONS operation on this path. -
    head - Operation Object - A definition of a HEAD operation on this path. -
    patch - Operation Object - A definition of a PATCH operation on this path. -
    parameters - [Parameter Object ¦ Reference Object] - 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. -
    -
    5.4.6.2. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -
    5.4.6.3. Path Item Object Example
    -
    {
    -  "get": {
    -    "description": "Returns pets based on ID",
    -    "summary": "Find pets by ID",
    -    "operationId": "getPetsById",
    -    "produces": [
    -      "application/json",
    -      "text/html"
    -    ],
    -    "responses": {
    -      "200": {
    -        "description": "pet response",
    -        "schema": {
    -          "type": "array",
    -          "items": {
    -            "$ref": "#/definitions/Pet"
    -          }
    -        }
    -      },
    -      "default": {
    -        "description": "error payload",
    -        "schema": {
    -          "$ref": "#/definitions/ErrorModel"
    -        }
    -      }
    -    }
    -  },
    -  "parameters": [
    -    {
    -      "name": "id",
    -      "in": "path",
    -      "description": "ID of pet to use",
    -      "required": true,
    -      "type": "array",
    -      "items": {
    -        "type": "string"
    -      },
    -      "collectionFormat": "csv"
    -    }
    -  ]
    -}
    -
    -
    get:
    -  description: Returns pets based on ID
    -  summary: Find pets by ID
    -  operationId: getPetsById
    -  produces:
    -  - application/json
    -  - text/html
    -  responses:
    -    '200':
    -      description: pet response
    -      schema:
    -        type: array
    -        items:
    -          $ref: '#/definitions/Pet'
    -    default:
    -      description: error payload
    -      schema:
    -        $ref: '#/definitions/ErrorModel'
    -parameters:
    -- name: id
    -  in: path
    -  description: ID of pet to use
    -  required: true
    -  type: array
    -  items:
    -    type: string
    -  collectionFormat: csv
    -
    -

    5.4.7. Operation Object

    -

    Describes a single API operation on a path.

    -
    5.4.7.1. Fixed Fields
    - - - - - - - - - - - - - - - - -
    Field Name - Type - Description -
    tags - [string] - A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. -
    summary - string - A short summary of what the operation does. For maximum readability in the swagger-ui, this field SHOULD be less than 120 characters. -
    description - string - A verbose explanation of the operation behavior. GFM syntax can be used for rich text representation. -
    externalDocs - External Documentation Object - Additional external documentation for this operation. -
    operationId - string - 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. -
    consumes - [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. -
    produces - [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. -
    parameters - [Parameter Object ¦ Reference Object] - 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 - Responses Object - Required. The list of possible responses as they are returned from executing this operation. -
    schemes - [string] - The transfer protocol for the operation. Values MUST be from the list: "http", "https", "ws", "wss". The value overrides the Swagger Object schemes definition. -
    deprecated - boolean - Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is false. -
    security - [Security Requirement Object] - 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. -
    -
    5.4.7.2. Patterned Objects
    - - - - - -
    Field Pattern - Type - Description -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -
    5.4.7.3. Operation Object Example
    -
    {
    -  "tags": [
    -    "pet"
    -  ],
    -  "summary": "Updates a pet in the store with form data",
    -  "description": "",
    -  "operationId": "updatePetWithForm",
    -  "consumes": [
    -    "application/x-www-form-urlencoded"
    -  ],
    -  "produces": [
    -    "application/json",
    -    "application/xml"
    -  ],
    -  "parameters": [
    -    {
    -      "name": "petId",
    -      "in": "path",
    -      "description": "ID of pet that needs to be updated",
    -      "required": true,
    -      "type": "string"
    -    },
    -    {
    -      "name": "name",
    -      "in": "formData",
    -      "description": "Updated name of the pet",
    -      "required": false,
    -      "type": "string"
    -    },
    -    {
    -      "name": "status",
    -      "in": "formData",
    -      "description": "Updated status of the pet",
    -      "required": false,
    -      "type": "string"
    -    }
    -  ],
    -  "responses": {
    -    "200": {
    -      "description": "Pet updated."
    -    },
    -    "405": {
    -      "description": "Invalid input"
    -    }
    -  },
    -  "security": [
    -    {
    -      "petstore_auth": [
    -        "write:pets",
    -        "read:pets"
    -      ]
    -    }
    -  ]
    -}
    -
    -
    tags:
    -- pet
    -summary: Updates a pet in the store with form data
    -description: ""
    -operationId: updatePetWithForm
    -consumes:
    -- application/x-www-form-urlencoded
    -produces:
    -- application/json
    -- application/xml
    -parameters:
    -- name: petId
    -  in: path
    -  description: ID of pet that needs to be updated
    -  required: true
    -  type: string
    -- name: name
    -  in: formData
    -  description: Updated name of the pet
    -  required: false
    -  type: string
    -- name: status
    -  in: formData
    -  description: Updated status of the pet
    -  required: false
    -  type: string
    -responses:
    -  '200':
    -    description: Pet updated.
    -  '405':
    -    description: Invalid input
    -security:
    -- petstore_auth:
    -  - write:pets
    -  - read:pets
    -
    -

    5.4.8. External Documentation Object

    -

    Allows referencing an external resource for extended documentation.

    -
    5.4.8.1. Fixed Fields
    - - - - - - -
    Field Name - Type - Description -
    description - string - A short description of the target documentation. GFM syntax can be used for rich text representation. -
    url - string - Required. The URL for the target documentation. Value MUST be in the format of a URL. -
    -
    5.4.8.2. Patterned Objects
    - - - - - -
    Field Pattern - Type - Description -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -
    5.4.8.3. External Documentation Object Example
    -
    {
    -  "description": "Find more info here",
    -  "url": "https://swagger.io"
    -}
    -
    -
    description: Find more info here
    -url: https://swagger.io
    -
    -

    5.4.9. Parameter Object

    -

    Describes a single operation parameter.

    -

    A unique parameter is defined by a combination of a name and location.

    -

    There are five possible parameter types.

    -
      -
    • Path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId. -
    • Query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id. -
    • Header - Custom headers that are expected as part of the request. -
    • Body - The payload that’s appended to the HTTP request. Since there can only be one payload, there can only be one body parameter. The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation. -
    • - Form - Used to describe the payload of an HTTP request when either application/x-www-form-urlencoded, multipart/form-data or both are used as the content type of the request (in Swagger’s definition, the consumes property of an operation). This is the only parameter type that can be used to send files, thus supporting the file type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4): -
        -
      • application/x-www-form-urlencoded - Similar to the format of Query parameters but as a payload. For example, foo=1&bar=swagger - both foo and bar are form parameters. This is normally used for simple parameters that are being transferred. -
      • multipart/form-data - each parameter takes a section in the payload with an internal header. For example, for the header Content-Disposition: form-data; name="submit-name" the name of the parameter is submit-name. This type of form parameters is more commonly used for file transfers. -
      -
    -
    5.4.9.1. Fixed Fields
    - - - - - - - - -
    Field Name - Type - Description -
    name - string - - Required. 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. -
    -
    in - string - Required. The location of the parameter. Possible values are “query”, “header”, “path”, “formData” or “body”. -
    description - string - A brief description of the parameter. This could contain examples of use. GFM syntax can be used for rich text representation. -
    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. -
    -

    If in is "body":

    - - - - - -
    Field Name - Type - Description -
    schema - Schema Object - Required. The schema defining the type used for the body parameter. -
    -

    If in is any value other than "body":

    - - - - - - - - - - - - - - - - - - - - - - -
    Field Name - Type - Description -
    type - string - Required. 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". -
    format - string - The extending format for the previously mentioned type. See Data Type Formats for further details. -
    allowEmptyValue - boolean - 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. -
    items - Items Object - Required if type is “array”. Describes the type of items in the array. -
    collectionFormat - string - - 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. -
    default - * - 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. -
    maximum - number - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. -
    exclusiveMaximum - boolean - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. -
    minimum - number - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. -
    exclusiveMinimum - boolean - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. -
    maxLength - integer - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1. -
    minLength - integer - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2. -
    pattern - string - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. -
    maxItems - integer - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2. -
    minItems - integer - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3. -
    uniqueItems - boolean - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4. -
    enum - [*] - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1. -
    multipleOf - number - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1. -
    -
    5.4.9.2. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -
    5.4.9.3. Parameter Object Examples
    -
    5.4.9.3.1. Body Parameters
    -

    A body parameter with a referenced schema definition (normally for a model definition):

    -
    {
    -  "name": "user",
    -  "in": "body",
    -  "description": "user to add to the system",
    -  "required": true,
    -  "schema": {
    -    "$ref": "#/definitions/User"
    -  }
    -}
    -
    -
    name: user
    -in: body
    -description: user to add to the system
    -required: true
    -schema:
    -  $ref: '#/definitions/User'
    -
    -

    A body parameter that is an array of string values:

    -
    {
    -  "name": "user",
    -  "in": "body",
    -  "description": "user to add to the system",
    -  "required": true,
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    }
    -  }
    -}
    -
    -
    name: user
    -in: body
    -description: user to add to the system
    -required: true
    -schema:
    -  type: array
    -  items:
    -    type: string
    -
    -
    5.4.9.3.2. Other Parameters
    -

    A header parameter with an array of 64 bit integer numbers:

    -
    {
    -  "name": "token",
    -  "in": "header",
    -  "description": "token to be passed as a header",
    -  "required": true,
    -  "type": "array",
    -  "items": {
    -    "type": "integer",
    -    "format": "int64"
    -  },
    -  "collectionFormat": "csv"
    -}
    -
    -
    name: token
    -in: header
    -description: token to be passed as a header
    -required: true
    -type: array
    -items:
    -  type: integer
    -  format: int64
    -collectionFormat: csv
    -
    -

    A path parameter of a string value:

    -
    {
    -  "name": "username",
    -  "in": "path",
    -  "description": "username to fetch",
    -  "required": true,
    -  "type": "string"
    -}
    -
    -
    name: username
    -in: path
    -description: username to fetch
    -required: true
    -type: string
    -
    -

    An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

    -
    {
    -  "name": "id",
    -  "in": "query",
    -  "description": "ID of the object to fetch",
    -  "required": false,
    -  "type": "array",
    -  "items": {
    -    "type": "string"
    -  },
    -  "collectionFormat": "multi"
    -}
    -
    -
    name: id
    -in: query
    -description: ID of the object to fetch
    -required: false
    -type: array
    -items:
    -  type: string
    -collectionFormat: multi
    -
    -

    A form data with file type for a file upload:

    -
    {
    -  "name": "avatar",
    -  "in": "formData",
    -  "description": "The avatar of the user",
    -  "required": true,
    -  "type": "file"
    -}
    -
    -
    name: avatar
    -in: formData
    -description: The avatar of the user
    -required: true
    -type: file
    -
    -

    5.4.10. Items Object

    -

    A limited subset of JSON-Schema’s items object. It is used by parameter definitions that are not located in "body".

    -
    5.4.10.1. Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - -
    Field Name - Type - Description -
    type - string - Required. The internal type of the array. The value MUST be one of "string", "number", "integer", "boolean", or "array". Files and models are not allowed. -
    format - string - The extending format for the previously mentioned type. See Data Type Formats for further details. -
    items - Items Object - Required if type is “array”. Describes the type of items in the array. -
    collectionFormat - string - - 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. -
    - Default value is csv. -
    default - * - Declares the value of the item that the server will use if none is provided. (Note: “default” has no meaning for required items.) 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 the data type. -
    maximum - number - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. -
    exclusiveMaximum - boolean - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. -
    minimum - number - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. -
    exclusiveMinimum - boolean - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. -
    maxLength - integer - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1. -
    minLength - integer - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2. -
    pattern - string - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. -
    maxItems - integer - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2. -
    minItems - integer - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3. -
    uniqueItems - boolean - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4. -
    enum - [*] - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1. -
    multipleOf - number - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1. -
    -
    5.4.10.2. Patterned Objects
    - - - - - -
    Field Pattern - Type - Description -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -
    5.4.10.3. Items Object Examples
    -

    Items must be of type string and have the minimum length of 2 characters:

    -
    {
    -    "type": "string",
    -    "minLength": 2
    -}
    -
    -
    type: string
    -minLength: 2
    -
    -

    An array of arrays, the internal array being of type integer, numbers must be between 0 and 63 (inclusive):

    -
    {
    -    "type": "array",
    -    "items": {
    -        "type": "integer",
    -        "minimum": 0,
    -        "maximum": 63
    -    }
    -}
    -
    -
    type: array
    -items:
    -  type: integer
    -  minimum: 0
    -  maximum: 63
    -
    -

    5.4.11. Responses Object

    -

    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 Responses Object MUST contain at least one response code, and it SHOULD be the response for a successful operation call.

    -
    5.4.11.1. Fixed Fields
    - - - - - -
    Field Name - Type - Description -
    default - Response Object ¦ Reference Object - 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. -
    -
    5.4.11.2. Patterned Fields
    - - - - - - -
    Field Pattern - Type - Description -
    {HTTP Status Code} - Response Object ¦ Reference Object - Any HTTP status code can be used as the property name (one property per HTTP status code). Describes the expected response for that HTTP status code. Reference Object can be used to link to a response that is defined at the Swagger Object’s responses section. -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -
    5.4.11.3. Responses Object Example
    -

    A 200 response for successful operation and a default response for others (implying an error):

    -
    {
    -  "200": {
    -    "description": "a pet to be returned",
    -    "schema": {
    -      "$ref": "#/definitions/Pet"
    -    }
    -  },
    -  "default": {
    -    "description": "Unexpected error",
    -    "schema": {
    -      "$ref": "#/definitions/ErrorModel"
    -    }
    -  }
    -}
    -
    -
    '200':
    -  description: a pet to be returned
    -  schema:
    -    $ref: '#/definitions/Pet'
    -default:
    -  description: Unexpected error
    -  schema:
    -    $ref: '#/definitions/ErrorModel'
    -
    -

    5.4.12. Response Object

    -

    Describes a single response from an API Operation.

    -
    5.4.12.1. Fixed Fields
    - - - - - - - - -
    Field Name - Type - Description -
    description - string - Required. A short description of the response. GFM syntax can be used for rich text representation. -
    schema - Schema Object - 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 Schema Object, its root type value may also be "file". This SHOULD be accompanied by a relevant produces mime-type. -
    headers - Headers Object - A list of headers that are sent with the response. -
    examples - Example Object - An example of the response message. -
    -
    5.4.12.2. Patterned Objects
    - - - - - -
    Field Pattern - Type - Description -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -
    5.4.12.3. Response Object Examples
    -

    Response of an array of a complex type:

    -
    {
    -  "description": "A complex object array response",
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "$ref": "#/definitions/VeryComplexType"
    -    }
    -  }
    -}
    -
    -
    description: A complex object array response
    -schema:
    -  type: array
    -  items:
    -    $ref: '#/definitions/VeryComplexType'
    -
    -

    Response with a string type:

    -
    {
    -  "description": "A simple string response",
    -  "schema": {
    -    "type": "string"
    -  }
    -}
    -
    -
    description: A simple string response
    -schema:
    -  type: string
    -
    -

    Response with headers:

    -
    {
    -  "description": "A simple string response",
    -  "schema": {
    -    "type": "string"
    -  },
    -  "headers": {
    -    "X-Rate-Limit-Limit": {
    -      "description": "The number of allowed requests in the current period",
    -      "type": "integer"
    -    },
    -    "X-Rate-Limit-Remaining": {
    -      "description": "The number of remaining requests in the current period",
    -      "type": "integer"
    -    },
    -    "X-Rate-Limit-Reset": {
    -      "description": "The number of seconds left in the current period",
    -      "type": "integer"
    -    }
    -  }
    -}
    -
    -
    description: A simple string response
    -schema:
    -  type: string
    -headers:
    -  X-Rate-Limit-Limit:
    -    description: The number of allowed requests in the current period
    -    type: integer
    -  X-Rate-Limit-Remaining:
    -    description: The number of remaining requests in the current period
    -    type: integer
    -  X-Rate-Limit-Reset:
    -    description: The number of seconds left in the current period
    -    type: integer
    -
    -

    Response with no return value:

    -
    {
    -  "description": "object created"
    -}
    -
    -
    description: object created
    -
    -

    5.4.13. Headers Object

    -

    Lists the headers that can be sent as part of a response.

    -
    5.4.13.1. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    {name} - Header Object - The name of the property corresponds to the name of the header. The value describes the type of the header. -
    -
    5.4.13.2. Headers Object Example
    -

    Rate-limit headers:

    -
    {
    -    "X-Rate-Limit-Limit": {
    -        "description": "The number of allowed requests in the current period",
    -        "type": "integer"
    -    },
    -    "X-Rate-Limit-Remaining": {
    -        "description": "The number of remaining requests in the current period",
    -        "type": "integer"
    -    },
    -    "X-Rate-Limit-Reset": {
    -        "description": "The number of seconds left in the current period",
    -        "type": "integer"
    -    }
    -}
    -
    -
    X-Rate-Limit-Limit:
    -  description: The number of allowed requests in the current period
    -  type: integer
    -X-Rate-Limit-Remaining:
    -  description: The number of remaining requests in the current period
    -  type: integer
    -X-Rate-Limit-Reset:
    -  description: The number of seconds left in the current period
    -  type: integer
    -
    -

    5.4.14. Example Object

    -

    Allows sharing examples for operation responses.

    -
    5.4.14.1. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    {mime type} - Any - 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. -
    -
    5.4.14.2. Example Object Example
    -

    Example response for application/json mimetype of a Pet data type:

    -
    {
    -  "application/json": {
    -    "name": "Puma",
    -    "type": "Dog",
    -    "color": "Black",
    -    "gender": "Female",
    -    "breed": "Mixed"
    -  }
    -}
    -
    -
    application/json:
    -  name: Puma
    -  type: Dog
    -  color: Black
    -  gender: Female
    -  breed: Mixed
    -
    -

    5.4.15. Header Object

    - - - - - - - - - - - - - - - - - - - - - - -
    Field Name - Type - Description -
    description - string - A short description of the header. -
    type - string - Required. The type of the object. The value MUST be one of "string", "number", "integer", "boolean", or "array". -
    format - string - The extending format for the previously mentioned type. See Data Type Formats for further details. -
    items - Items Object - Required if type is “array”. Describes the type of items in the array. -
    collectionFormat - string - - 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. -
    - Default value is csv. -
    default - * - Declares the value of the header that the server will use if none is provided. (Note: “default” has no meaning for required headers.) 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 the header. -
    maximum - number - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. -
    exclusiveMaximum - boolean - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.2. -
    minimum - number - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. -
    exclusiveMinimum - boolean - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.3. -
    maxLength - integer - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1. -
    minLength - integer - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2. -
    pattern - string - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. -
    maxItems - integer - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2. -
    minItems - integer - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3. -
    uniqueItems - boolean - https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.4. -
    enum - [*] - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1. -
    multipleOf - number - See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1. -
    -
    5.4.15.1. Patterned Objects
    - - - - - -
    Field Pattern - Type - Description -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -
    5.4.15.2. Header Object Example
    -

    A simple header with of an integer type:

    -
    {
    -  "description": "The number of allowed requests in the current period",
    -  "type": "integer"
    -}
    -
    -
    description: The number of allowed requests in the current period
    -type: integer
    -
    -

    5.4.16. Tag Object

    -

    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.

    -
    5.4.16.1. Fixed Fields
    - - - - - - - -
    Field Name - Type - Description -
    name - string - Required. The name of the tag. -
    description - string - A short description for the tag. GFM syntax can be used for rich text representation. -
    externalDocs - External Documentation Object - Additional external documentation for this tag. -
    -
    5.4.16.2. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -
    5.4.16.3. Tag Object Example
    -
    {
    -  "name": "pet",
    -  "description": "Pets operations"
    -}
    -
    -
    name: pet
    -description: Pets operations
    -
    -

    5.4.17. Reference 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.

    -
    5.4.17.1. Fixed Fields
    - - - - - -
    Field Name - Type - Description -
    $ref - string - Required. The reference string. -
    -
    5.4.17.2. Reference Object Example
    -
    {
    -  "$ref": "#/definitions/Pet"
    -}
    -
    -
    $ref: '#/definitions/Pet'
    -
    -
    5.4.17.3. Relative Schema File Example
    -
    {
    -  "$ref": "Pet.json"
    -}
    -
    -
    $ref: 'Pet.yaml'
    -
    -
    5.4.17.4. Relative Files With Embedded Schema Example
    -
    {
    -  "$ref": "definitions.json#/Pet"
    -}
    -
    -
    $ref: 'definitions.yaml#/Pet'
    -
    -

    5.4.18. Schema Object

    -

    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.

    -

    Further information about the properties can be found in JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here.

    -

    The following properties are taken directly from the JSON Schema definition and follow the same specifications:

    -
      -
    • $ref - As a JSON Reference -
    • format (See Data Type Formats for further details) -
    • title -
    • description (GFM syntax can be used for rich text representation) -
    • default (Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object) -
    • multipleOf -
    • maximum -
    • exclusiveMaximum -
    • minimum -
    • exclusiveMinimum -
    • maxLength -
    • minLength -
    • pattern -
    • maxItems -
    • minItems -
    • uniqueItems -
    • maxProperties -
    • minProperties -
    • required -
    • enum -
    • type -
    -

    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.

    -
      -
    • items -
    • allOf -
    • properties -
    • additionalProperties -
    -

    Other than the JSON Schema subset fields, the following fields may be used for further schema documentation.

    -
    5.4.18.1. Fixed Fields
    - - - - - - - - - -
    Field Name - Type - Description -
    discriminator - string - 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. -
    readOnly - boolean - 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. -
    xml - XML Object - 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. -
    externalDocs - External Documentation Object - Additional external documentation for this schema. -
    example - Any - A free-form property to include an example of an instance for this schema. -
    -
    5.4.18.2. Patterned Objects
    - - - - - -
    Field Pattern - Type - Description -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -
    5.4.18.2.1. Composition and Inheritance (Polymorphism)
    -

    Swagger allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. allOf takes in an array of object definitions that are validated independently but together compose a single object.

    -

    While composition offers model extensibility, it does not imply a hierarchy between the models. To support polymorphism, Swagger adds the support of the discriminator field. When used, the discriminator will be the name of the property used to decide which schema definition is used to validate the structure of the model. As such, the discriminator field MUST be a required field. The value of the chosen property has to be the friendly name given to the model under the definitions property. As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism.

    -
    5.4.18.2.2. XML Modeling
    -

    The xml property allows extra definitions when translating the JSON definition to XML. The XML Object contains additional information about the available options.

    -
    5.4.18.3. Schema Object Examples
    -
    5.4.18.3.1. Primitive Sample
    -

    Unlike previous versions of Swagger, Schema definitions can be used to describe primitive and arrays as well.

    -
    {
    -    "type": "string",
    -    "format": "email"
    -}
    -
    -
    type: string
    -format: email
    -
    -
    5.4.18.3.2. Simple Model
    -
    {
    -  "type": "object",
    -  "required": [
    -    "name"
    -  ],
    -  "properties": {
    -    "name": {
    -      "type": "string"
    -    },
    -    "address": {
    -      "$ref": "#/definitions/Address"
    -    },
    -    "age": {
    -      "type": "integer",
    -      "format": "int32",
    -      "minimum": 0
    -    }
    -  }
    -}
    -
    -
    type: object
    -required:
    -- name
    -properties:
    -  name:
    -    type: string
    -  address:
    -    $ref: '#/definitions/Address'
    -  age:
    -    type: integer
    -    format: int32
    -    minimum: 0
    -
    -
    5.4.18.3.3. Model with Map/Dictionary Properties
    -

    For a simple string to string mapping:

    -
    {
    -  "type": "object",
    -  "additionalProperties": {
    -    "type": "string"
    -  }
    -}
    -
    -
    type: object
    -additionalProperties:
    -  type: string
    -
    -

    For a string to model mapping:

    -
    {
    -  "type": "object",
    -  "additionalProperties": {
    -    "$ref": "#/definitions/ComplexModel"
    -  }
    -}
    -
    -
    type: object
    -additionalProperties:
    -  $ref: '#/definitions/ComplexModel'
    -
    -
    5.4.18.3.4. Model with Example
    -
    {
    -  "type": "object",
    -  "properties": {
    -    "id": {
    -      "type": "integer",
    -      "format": "int64"
    -    },
    -    "name": {
    -      "type": "string"
    -    }
    -  },
    -  "required": [
    -    "name"
    -  ],
    -  "example": {
    -    "name": "Puma",
    -    "id": 1
    -  }
    -}
    -
    -
    type: object
    -properties:
    -  id:
    -    type: integer
    -    format: int64
    -  name:
    -    type: string
    -required:
    -- name
    -example:
    -  name: Puma
    -  id: 1
    -
    -
    5.4.18.3.5. Models with Composition
    -
    {
    -  "definitions": {
    -    "ErrorModel": {
    -      "type": "object",
    -      "required": [
    -        "message",
    -        "code"
    -      ],
    -      "properties": {
    -        "message": {
    -          "type": "string"
    -        },
    -        "code": {
    -          "type": "integer",
    -          "minimum": 100,
    -          "maximum": 600
    -        }
    -      }
    -    },
    -    "ExtendedErrorModel": {
    -      "allOf": [
    -        {
    -          "$ref": "#/definitions/ErrorModel"
    -        },
    -        {
    -          "type": "object",
    -          "required": [
    -            "rootCause"
    -          ],
    -          "properties": {
    -            "rootCause": {
    -              "type": "string"
    -            }
    -          }
    -        }
    -      ]
    -    }
    -  }
    -}
    -
    -
    definitions:
    -  ErrorModel:
    -    type: object
    -    required:
    -    - message
    -    - code
    -    properties:
    -      message:
    -        type: string
    -      code:
    -        type: integer
    -        minimum: 100
    -        maximum: 600
    -  ExtendedErrorModel:
    -    allOf:
    -    - $ref: '#/definitions/ErrorModel'
    -    - type: object
    -      required:
    -      - rootCause
    -      properties:
    -        rootCause:
    -          type: string
    -
    -
    5.4.18.3.6. Models with Polymorphism Support
    -
    {
    -  "definitions": {
    -    "Pet": {
    -      "type": "object",
    -      "discriminator": "petType",
    -      "properties": {
    -        "name": {
    -          "type": "string"
    -        },
    -        "petType": {
    -          "type": "string"
    -        }
    -      },
    -      "required": [
    -        "name",
    -        "petType"
    -      ]
    -    },
    -    "Cat": {
    -      "description": "A representation of a cat",
    -      "allOf": [
    -        {
    -          "$ref": "#/definitions/Pet"
    -        },
    -        {
    -          "type": "object",
    -          "properties": {
    -            "huntingSkill": {
    -              "type": "string",
    -              "description": "The measured skill for hunting",
    -              "default": "lazy",
    -              "enum": [
    -                "clueless",
    -                "lazy",
    -                "adventurous",
    -                "aggressive"
    -              ]
    -            }
    -          },
    -          "required": [
    -            "huntingSkill"
    -          ]
    -        }
    -      ]
    -    },
    -    "Dog": {
    -      "description": "A representation of a dog",
    -      "allOf": [
    -        {
    -          "$ref": "#/definitions/Pet"
    -        },
    -        {
    -          "type": "object",
    -          "properties": {
    -            "packSize": {
    -              "type": "integer",
    -              "format": "int32",
    -              "description": "the size of the pack the dog is from",
    -              "default": 0,
    -              "minimum": 0
    -            }
    -          },
    -          "required": [
    -            "packSize"
    -          ]
    -        }
    -      ]
    -    }
    -  }
    -}
    -
    -
    definitions:
    -  Pet:
    -    type: object
    -    discriminator: petType
    -    properties:
    -      name:
    -        type: string
    -      petType:
    -        type: string
    -    required:
    -    - name
    -    - petType
    -  Cat:
    -    description: A representation of a cat
    -    allOf:
    -    - $ref: '#/definitions/Pet'
    -    - type: object
    -      properties:
    -        huntingSkill:
    -          type: string
    -          description: The measured skill for hunting
    -          default: lazy
    -          enum:
    -          - clueless
    -          - lazy
    -          - adventurous
    -          - aggressive
    -      required:
    -      - huntingSkill
    -  Dog:
    -    description: A representation of a dog
    -    allOf:
    -    - $ref: '#/definitions/Pet'
    -    - type: object
    -      properties:
    -        packSize:
    -          type: integer
    -          format: int32
    -          description: the size of the pack the dog is from
    -          default: 0
    -          minimum: 0
    -      required:
    -      - packSize
    -
    -

    5.4.19. XML Object

    -

    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.

    -
    5.4.19.1. Fixed Fields
    - - - - - - - - - -
    Field Name - Type - Description -
    name - string - 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. -
    namespace - string - The URL of the namespace definition. Value SHOULD be in the form of a URL. -
    prefix - string - The prefix to be used for the name. -
    attribute - boolean - Declares whether the property definition translates to an attribute instead of an element. Default value is false. -
    wrapped - 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). -
    -
    5.4.19.2. Patterned Objects
    - - - - - -
    Field Pattern - Type - Description -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -
    5.4.19.3. XML Object Examples
    -

    The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

    -
    5.4.19.3.1. No XML Element
    -

    Basic string property:

    -
    {
    -    "animals": {
    -        "type": "string"
    -    }
    -}
    -
    -
    animals:
    -  type: string
    -
    -
    <animals>...</animals>
    -
    -

    Basic string array property (wrapped is false by default):

    -
    {
    -    "animals": {
    -        "type": "array",
    -        "items": {
    -            "type": "string"
    -        }
    -    }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -
    -
    <animals>...</animals>
    -<animals>...</animals>
    -<animals>...</animals>
    -
    -
    5.4.19.3.2. XML Name Replacement
    -
    {
    -  "animals": {
    -    "type": "string",
    -    "xml": {
    -      "name": "animal"
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: string
    -  xml:
    -    name: animal
    -
    -
    <animal>...</animal>
    -
    -
    5.4.19.3.3. XML Attribute, Prefix and Namespace
    -

    In this example, a full model definition is shown.

    -
    {
    -  "Person": {
    -    "type": "object",
    -    "properties": {
    -      "id": {
    -        "type": "integer",
    -        "format": "int32",
    -        "xml": {
    -          "attribute": true
    -        }
    -      },
    -      "name": {
    -        "type": "string",
    -        "xml": {
    -          "namespace": "http://swagger.io/schema/sample",
    -          "prefix": "sample"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    Person:
    -  type: object
    -  properties:
    -    id:
    -      type: integer
    -      format: int32
    -      xml:
    -        attribute: true
    -    name:
    -      type: string
    -      xml:
    -        namespace: http://swagger.io/schema/sample
    -        prefix: sample
    -
    -
    <Person id="123">
    -    <sample:name xmlns:sample="http://swagger.io/schema/sample">example</sample:name>
    -</Person>
    -
    -
    5.4.19.3.4. XML Arrays
    -

    Changing the element names:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -
    -
    <animal>value</animal>
    -<animal>value</animal>
    -
    -

    The external name property has no effect on the XML:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens"
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -
    -
    <animal>value</animal>
    -<animal>value</animal>
    -
    -

    Even when the array is wrapped, if no name is explicitly defined, the same name will be used both internally and externally:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    wrapped: true
    -
    -
    <animals>
    -  <animals>value</animals>
    -  <animals>value</animals>
    -</animals>
    -
    -

    To overcome the above example, the following definition can be used:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    wrapped: true
    -
    -
    <animals>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</animals>
    -
    -

    Affecting both internal and external names:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    <aliens>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</aliens>
    -
    -

    If we change the external element but not the internal ones:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    <aliens>
    -  <aliens>value</aliens>
    -  <aliens>value</aliens>
    -</aliens>
    -
    -

    5.4.20. Definitions Object

    -

    An object to hold data types that can be consumed and produced by operations. These data types can be primitives, arrays or models.

    -
    5.4.20.1. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    {name} - Schema Object - A single definition, mapping a “name” to the schema it defines. -
    -
    5.4.20.2. Definitions Object Example
    -
    {
    -  "Category": {
    -    "type": "object",
    -    "properties": {
    -      "id": {
    -        "type": "integer",
    -        "format": "int64"
    -      },
    -      "name": {
    -        "type": "string"
    -      }
    -    }
    -  },
    -  "Tag": {
    -    "type": "object",
    -    "properties": {
    -      "id": {
    -        "type": "integer",
    -        "format": "int64"
    -      },
    -      "name": {
    -        "type": "string"
    -      }
    -    }
    -  }
    -}
    -
    -
    Category:
    -  type: object
    -  properties:
    -    id:
    -      type: integer
    -      format: int64
    -    name:
    -      type: string
    -Tag:
    -  type: object
    -  properties:
    -    id:
    -      type: integer
    -      format: int64
    -    name:
    -      type: string
    -
    -

    5.4.21. Parameters Definitions Object

    -

    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.

    -
    5.4.21.1. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    {name} - Parameter Object - A single parameter definition, mapping a “name” to the parameter it defines. -
    -
    5.4.21.2. Parameters Definition Object Example
    -
    {
    -  "skipParam": {
    -    "name": "skip",
    -    "in": "query",
    -    "description": "number of items to skip",
    -    "required": true,
    -    "type": "integer",
    -    "format": "int32"
    -  },
    -  "limitParam": {
    -    "name": "limit",
    -    "in": "query",
    -    "description": "max records to return",
    -    "required": true,
    -    "type": "integer",
    -    "format": "int32"
    -  }
    -}
    -
    -
    skipParam:
    -  name: skip
    -  in: query
    -  description: number of items to skip
    -  required: true
    -  type: integer
    -  format: int32
    -limitParam:
    -  name: limit
    -  in: query
    -  description: max records to return
    -  required: true
    -  type: integer
    -  format: int32
    -
    -

    5.4.22. Responses Definitions Object

    -

    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.

    -
    5.4.22.1. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    {name} - Response Object - A single response definition, mapping a “name” to the response it defines. -
    -
    5.4.22.2. Responses Definitions Object Example
    -
    {
    -  "NotFound": {
    -    "description": "Entity not found."
    -  },
    -  "IllegalInput": {
    -    "description": "Illegal input for operation."
    -  },
    -  "GeneralError": {
    -    "description": "General Error",
    -    "schema": {
    -      "$ref": "#/definitions/GeneralError"
    -    }
    -  }
    -}
    -
    -
    NotFound:
    -  description: Entity not found.
    -IllegalInput:
    -  description: Illegal input for operation.
    -GeneralError:
    -  description: General Error
    -  schema:
    -    $ref: '#/definitions/GeneralError'
    -
    -

    5.4.23. Security Definitions Object

    -

    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.

    -
    5.4.23.1. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    {name} - Security Scheme Object - A single security scheme definition, mapping a “name” to the scheme it defines. -
    -
    5.4.23.2. Security Definitions Object Example
    -
    {
    -  "api_key": {
    -    "type": "apiKey",
    -    "name": "api_key",
    -    "in": "header"
    -  },
    -  "petstore_auth": {
    -    "type": "oauth2",
    -    "authorizationUrl": "http://swagger.io/api/oauth/dialog",
    -    "flow": "implicit",
    -    "scopes": {
    -      "write:pets": "modify pets in your account",
    -      "read:pets": "read your pets"
    -    }
    -  }
    -}
    -
    -
    api_key:
    -  type: apiKey
    -  name: api_key
    -  in: header
    -petstore_auth:
    -  type: oauth2
    -  authorizationUrl: http://swagger.io/api/oauth/dialog
    -  flow: implicit
    -  scopes:
    -    write:pets: modify pets in your account
    -    read:pets: read your pets
    -
    -

    5.4.24. Security Scheme Object

    -

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

    -
    5.4.24.1. Fixed Fields
    - - - - - - - - - - - - -
    Field Name - Type - Validity - Description -
    type - string - Any - Required. The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2". -
    description - string - Any - A short description for security scheme. -
    name - string - apiKey - Required. The name of the header or query parameter to be used. -
    in - string - apiKey - Required The location of the API key. Valid values are "query" or "header". -
    flow - string - oauth2 - Required. The flow used by the OAuth2 security scheme. Valid values are "implicit", "password", "application" or "accessCode". -
    authorizationUrl - string - oauth2 ("implicit", "accessCode") - Required. The authorization URL to be used for this flow. This SHOULD be in the form of a URL. -
    tokenUrl - string - oauth2 ("password", "application", "accessCode") - Required. The token URL to be used for this flow. This SHOULD be in the form of a URL. -
    scopes - Scopes Object - oauth2 - Required. The available scopes for the OAuth2 security scheme. -
    -
    5.4.24.2. Patterned Fields
    - - - - - -
    Field Name - Type - Description -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -
    5.4.24.3. Security Scheme Object Example
    -
    5.4.24.3.1. Basic Authentication Sample
    -
    {
    -  "type": "basic"
    -}
    -
    -
    type: basic
    -
    -
    5.4.24.3.2. API Key Sample
    -
    {
    -  "type": "apiKey",
    -  "name": "api_key",
    -  "in": "header"
    -}
    -
    -
    type: apiKey
    -name: api_key
    -in: header
    -
    -
    5.4.24.3.3. Implicit OAuth2 Sample
    -
    {
    -  "type": "oauth2",
    -  "authorizationUrl": "http://swagger.io/api/oauth/dialog",
    -  "flow": "implicit",
    -  "scopes": {
    -    "write:pets": "modify pets in your account",
    -    "read:pets": "read your pets"
    -  }
    -}
    -
    -
    type: oauth2
    -authorizationUrl: http://swagger.io/api/oauth/dialog
    -flow: implicit
    -scopes:
    -  write:pets: modify pets in your account
    -  read:pets: read your pets
    -
    -

    5.4.25. Scopes Object

    -

    Lists the available scopes for an OAuth2 security scheme.

    -
    5.4.25.1. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    {name} - string - Maps between a name of a scope to a short description of it (as the value of the property). -
    -
    5.4.25.2. Patterned Objects
    - - - - - -
    Field Pattern - Type - Description -
    ^x- - Any - Allows extensions to the Swagger Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. See Vendor Extensions for further details. -
    -
    5.4.25.3. Scopes Object Example
    -
    {
    -  "write:pets": "modify pets in your account",
    -  "read:pets": "read your pets"
    -}
    -
    -
    write:pets: modify pets in your account
    -read:pets: read your pets
    -
    -

    5.4.26. Security Requirement Object

    -

    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.

    -
    5.4.26.1. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    {name} - [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. -
    -
    5.4.26.2. Security Requirement Object Examples
    -
    5.4.26.2.1. Non-OAuth2 Security Requirement
    -
    {
    -  "api_key": []
    -}
    -
    -
    api_key: []
    -
    -
    5.4.26.2.2. OAuth2 Security Requirement
    -
    {
    -  "petstore_auth": [
    -    "write:pets",
    -    "read:pets"
    -  ]
    -}
    -
    -
    petstore_auth:
    -- write:pets
    -- read:pets
    -
    -

    5.5. Specification Extensions

    -

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

    -

    5.6. Security Filtering

    -

    Some objects in the Swagger specification may be declared and remain empty, or completely be removed, even though they are inherently the core of the API documentation.

    -

    The reasoning behind it is to allow an additional layer of access control over the documentation itself. While not part of the specification itself, certain libraries may choose to allow access to parts of the documentation based on some form of authentication/authorization.

    -

    Two examples for this:

    -
      -
    1. The Paths Object may be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication. -
    2. The Path Item Object may be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object so the user will not be aware of its existence. This allows the documentation provider a finer control over what the viewer can see. -
    -
    - -

    Index

    -

    Terms defined by this specification

    - -

    References

    -

    Normative References

    -
    -
    [RFC6838] -
    N. Freed; J. Klensin; T. Hansen. Media Type Specifications and Registration Procedures. January 2013. Best Current Practice. URL: https://tools.ietf.org/html/rfc6838 -
    [RFC7231] -
    R. Fielding, Ed.; J. Reschke, Ed.. Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content. June 2014. Proposed Standard. URL: https://tools.ietf.org/html/rfc7231 -
    - - - - \ No newline at end of file diff --git a/scripts/md2html/v3/3.0.0.bs b/scripts/md2html/v3/3.0.0.bs deleted file mode 100644 index 1022f55a11..0000000000 --- a/scripts/md2html/v3/3.0.0.bs +++ /dev/null @@ -1,4085 +0,0 @@ -OpenAPI Specification -

    OpenAPI Specification

    -

    Version 3.0.0

    -

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [[!rfc2119]] [[!rfc8174]] when, and only when, they appear in all capitals, as shown here.

    -

    This document is licensed under The Apache License, Version 2.0.

    -

    Introduction

    -

    The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.

    -

    An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.

    - -

    Definitions

    -

    OpenAPI Document

    -

    A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification.

    -
    Path Templating
    -

    Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters.

    -
    Media Types
    -

    Media type definitions are spread across several resources. -The media type definitions SHOULD be in compliance with [[!rfc6838]].

    -

    Some examples of possible media type definitions:

    -
    
    -  text/plain; charset=utf-8
    -  application/json
    -  application/vnd.github+json
    -  application/vnd.github.v3+json
    -  application/vnd.github.v3.raw+json
    -  application/vnd.github.v3.text+json
    -  application/vnd.github.v3.html+json
    -  application/vnd.github.v3.full+json
    -  application/vnd.github.v3.diff
    -  application/vnd.github.v3.patch
    -
    -
    HTTP Status Codes
    -

    The HTTP Status Codes are used to indicate the status of the executed operation. -The available status codes are defined by [[!rfc7231]]section-6) and registered status codes are listed in the IANA Status Code Registry.

    -

    Specification

    -

    Versions

    -

    The OpenAPI Specification is versioned using Semantic Versioning 2.0.0 (semver) and follows the semver specification.

    -

    The major.minor portion of the semver (for example 3.0) SHALL designate the OAS feature set. Typically, .patch versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between 3.0.0 and 3.0.1 for example.

    -

    Subsequent minor version releases of the OpenAPI Specification (incrementing the minor version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical 3.1.0 specification SHOULD be usable with tooling designed for 3.0.0.

    -

    An OpenAPI document compatible with OAS 3.*.* contains a required openapi field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named swagger and value "2.0".)

    -

    Format

    -

    An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format.

    -

    For example, if a field has an array value, the JSON array representation will be used:

    -
    
    -{
    -   "field": [ 1, 2, 3 ]
    -}
    -
    -

    All field names in the specification are case sensitive.

    -

    The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name.

    -

    Patterned fields MUST have unique names within the containing object.

    -

    In order to preserve the ability to round-trip between YAML and JSON formats, YAML version 1.2 is RECOMMENDED along with some additional constraints:

    - -

    Note: While APIs may be defined by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML.

    -

    Document Structure

    -

    An OpenAPI document MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the user. In the latter case, $ref fields MUST be used in the specification to reference those parts as follows from the JSON Schema definitions.

    -

    It is RECOMMENDED that the root OpenAPI document be named: openapi.json or openapi.yaml.

    -

    Data Types

    -

    Primitive data types in the OAS are based on the types supported by the JSON Schema Specification Wright Draft 00. -Note that integer as a type is also supported and is defined as a JSON number without a fraction or exponent part. -null is not supported as a type (see nullable for an alternative solution). -Models are defined using the Schema Object, which is an extended subset of JSON Schema Specification Wright Draft 00.

    -

    Primitives have an optional modifier property: format. -OAS uses several known formats to define in fine detail the data type being used. -However, to support documentation needs, the format property is an open string-valued property, and can have any value. -Formats such as "email", "uuid", and so on, MAY be used even though undefined by this specification. -Types that are not accompanied by a format property follow the type definition in the JSON Schema. Tools that do not recognize a specific format MAY default back to the type alone, as if the format is not specified.

    -

    The formats defined by the OAS are:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Common NametypeformatComments
    integerintegerint32signed 32 bits
    longintegerint64signed 64 bits
    floatnumberfloat
    doublenumberdouble
    stringstring
    bytestringbytebase64 encoded characters
    binarystringbinaryany sequence of octets
    booleanboolean
    datestringdateAs defined by full-date - [!rfc3339]
    dateTimestringdate-timeAs defined by date-time - [!rfc3339]
    passwordstringpasswordA hint to UIs to obscure input.
    -

    Rich Text Formatting

    -

    Throughout the specification description fields are noted as supporting CommonMark markdown formatting. -Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by CommonMark 0.27. Tooling MAY choose to ignore some CommonMark features to address security concerns.

    -

    Relative References in URLs

    -

    Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [[!rfc3986]]section-4.2). -Relative references are resolved using the URLs defined in the Server Object as a Base URI.

    -

    Relative references used in $ref are processed as per JSON Reference, using the URL of the current document as the base URI. See also the Reference Object.

    -

    Schema

    -

    In the following description, if a field is not explicitly REQUIRED or described with a MUST or SHALL, it can be considered OPTIONAL.

    -

    OpenAPI Object

    -

    This is the root document object of the OpenAPI document.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    openapistringREQUIRED. This string MUST be the semantic version number of the OpenAPI Specification version that the OpenAPI document uses. The openapi field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is not related to the API info.version string.
    infoInfo ObjectREQUIRED. Provides metadata about the API. The metadata MAY be used by tooling as required.
    servers[Server Object]An array of Server Objects, which provide connectivity information to a target server. If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url value of /.
    pathsPaths ObjectREQUIRED. The available paths and operations for the API.
    componentsComponents ObjectAn element to hold various schemas for the specification.
    security[Security Requirement Object]A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition.
    tags[Tag Object]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.
    externalDocsExternal Documentation ObjectAdditional external documentation.
    -

    This object MAY be extended with Specification Extensions.

    -

    Info Object

    -

    The object provides metadata about the API. -The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    titlestringREQUIRED. The title of the application.
    descriptionstringA short description of the application. CommonMark syntax MAY be used for rich text representation.
    termsOfServicestringA URL to the Terms of Service for the API. MUST be in the format of a URL.
    contactContact ObjectThe contact information for the exposed API.
    licenseLicense ObjectThe license information for the exposed API.
    versionstringREQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version).
    -

    This object MAY be extended with Specification Extensions.

    -
    Info Object Example:
    -
    
    -{
    -  "title": "Sample Pet Store App",
    -  "description": "This is a sample server for a pet store.",
    -  "termsOfService": "http://example.com/terms/",
    -  "contact": {
    -    "name": "API Support",
    -    "url": "http://www.example.com/support",
    -    "email": "support@example.com"
    -  },
    -  "license": {
    -    "name": "Apache 2.0",
    -    "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    -  },
    -  "version": "1.0.1"
    -}
    -
    -
    
    -title: Sample Pet Store App
    -description: This is a sample server for a pet store.
    -termsOfService: http://example.com/terms/
    -contact:
    -  name: API Support
    -  url: http://www.example.com/support
    -  email: support@example.com
    -license:
    -  name: Apache 2.0
    -  url: http://www.apache.org/licenses/LICENSE-2.0.html
    -version: 1.0.1
    -
    -

    Contact Object

    -

    Contact information for the exposed API.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringThe identifying name of the contact person/organization.
    urlstringThe URL pointing to the contact information. MUST be in the format of a URL.
    emailstringThe email address of the contact person/organization. MUST be in the format of an email address.
    -

    This object MAY be extended with Specification Extensions.

    -
    Contact Object Example:
    -
    
    -{
    -  "name": "API Support",
    -  "url": "http://www.example.com/support",
    -  "email": "support@example.com"
    -}
    -
    -
    
    -name: API Support
    -url: http://www.example.com/support
    -email: support@example.com
    -
    -

    License Object

    -

    License information for the exposed API.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringREQUIRED. The license name used for the API.
    urlstringA URL to the license used for the API. MUST be in the format of a URL.
    -

    This object MAY be extended with Specification Extensions.

    -
    License Object Example:
    -
    
    -{
    -  "name": "Apache 2.0",
    -  "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    -}
    -
    -
    
    -name: Apache 2.0
    -url: http://www.apache.org/licenses/LICENSE-2.0.html
    -
    -

    Server Object

    -

    An object representing a Server.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    urlstringREQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in {brackets}.
    descriptionstringAn optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation.
    variablesMap[string, Server Variable Object]A map between a variable name and its value. The value is used for substitution in the server’s URL template.
    -

    This object MAY be extended with Specification Extensions.

    -
    Server Object Example
    -

    A single server would be described as:

    -
    
    -{
    -  "url": "https://development.gigantic-server.com/v1",
    -  "description": "Development server"
    -}
    -
    -
    
    -url: https://development.gigantic-server.com/v1
    -description: Development server
    -
    -

    The following shows how multiple servers can be described, for example, at the OpenAPI Object’s servers:

    -
    
    -{
    -  "servers": [
    -    {
    -      "url": "https://development.gigantic-server.com/v1",
    -      "description": "Development server"
    -    },
    -    {
    -      "url": "https://staging.gigantic-server.com/v1",
    -      "description": "Staging server"
    -    },
    -    {
    -      "url": "https://api.gigantic-server.com/v1",
    -      "description": "Production server"
    -    }
    -  ]
    -}
    -
    -
    
    -servers:
    -- url: https://development.gigantic-server.com/v1
    -  description: Development server
    -- url: https://staging.gigantic-server.com/v1
    -  description: Staging server
    -- url: https://api.gigantic-server.com/v1
    -  description: Production server
    -
    -

    The following shows how variables can be used for a server configuration:

    -
    
    -{
    -  "servers": [
    -    {
    -      "url": "https://{username}.gigantic-server.com:{port}/{basePath}",
    -      "description": "The production API server",
    -      "variables": {
    -        "username": {
    -          "default": "demo",
    -          "description": "this value is assigned by the service provider, in this example `gigantic-server.com`"
    -        },
    -        "port": {
    -          "enum": [
    -            "8443",
    -            "443"
    -          ],
    -          "default": "8443"
    -        },
    -        "basePath": {
    -          "default": "v2"
    -        }
    -      }
    -    }
    -  ]
    -}
    -
    -
    
    -servers:
    -- url: https://{username}.gigantic-server.com:{port}/{basePath}
    -  description: The production API server
    -  variables:
    -    username:
    -      # note! no enum here means it is an open value
    -      default: demo
    -      description: this value is assigned by the service provider, in this example `gigantic-server.com`
    -    port:
    -      enum:
    -        - '8443'
    -        - '443'
    -      default: '8443'
    -    basePath:
    -      # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2`
    -      default: v2
    -
    -

    Server Variable Object

    -

    An object representing a Server Variable for server URL template substitution.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    enum[string]An enumeration of string values to be used if the substitution options are from a limited set.
    defaultstringREQUIRED. The default value to use for substitution, and to send, if an alternate value is not supplied. Unlike the Schema Object’s default, this value MUST be provided by the consumer.
    descriptionstringAn optional description for the server variable. CommonMark syntax MAY be used for rich text representation.
    -

    This object MAY be extended with Specification Extensions.

    -

    Components Object

    -

    Holds a set of reusable objects for different aspects of the OAS. -All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    schemasMap[string, Schema Object ¦ Reference Object]An object to hold reusable Schema Objects.
    responsesMap[string, Response Object ¦ Reference Object]An object to hold reusable Response Objects.
    parametersMap[string, Parameter Object ¦ Reference Object]An object to hold reusable Parameter Objects.
    examplesMap[string, Example Object ¦ Reference Object]An object to hold reusable Example Objects.
    requestBodiesMap[string, Request Body Object ¦ Reference Object]An object to hold reusable Request Body Objects.
    headersMap[string, Header Object ¦ Reference Object]An object to hold reusable Header Objects.
    securitySchemesMap[string, Security Scheme Object ¦ Reference Object]An object to hold reusable Security Scheme Objects.
    linksMap[string, Link Object ¦ Reference Object]An object to hold reusable Link Objects.
    callbacksMap[string, Callback Object ¦ Reference Object]An object to hold reusable Callback Objects.
    -

    This object MAY be extended with Specification Extensions.

    -

    All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9\.\-_]+$.

    -

    Field Name Examples:

    -
    
    -User
    -User_1
    -User_Name
    -user-name
    -my.org.User
    -
    -
    Components Object Example
    -
    
    -"components": {
    -  "schemas": {
    -    "Category": {
    -      "type": "object",
    -      "properties": {
    -        "id": {
    -          "type": "integer",
    -          "format": "int64"
    -        },
    -        "name": {
    -          "type": "string"
    -        }
    -      }
    -    },
    -    "Tag": {
    -      "type": "object",
    -      "properties": {
    -        "id": {
    -          "type": "integer",
    -          "format": "int64"
    -        },
    -        "name": {
    -          "type": "string"
    -        }
    -      }
    -    }
    -  },
    -  "parameters": {
    -    "skipParam": {
    -      "name": "skip",
    -      "in": "query",
    -      "description": "number of items to skip",
    -      "required": true,
    -      "schema": {
    -        "type": "integer",
    -        "format": "int32"
    -      }
    -    },
    -    "limitParam": {
    -      "name": "limit",
    -      "in": "query",
    -      "description": "max records to return",
    -      "required": true,
    -      "schema" : {
    -        "type": "integer",
    -        "format": "int32"
    -      }
    -    }
    -  },
    -  "responses": {
    -    "NotFound": {
    -      "description": "Entity not found."
    -    },
    -    "IllegalInput": {
    -      "description": "Illegal input for operation."
    -    },
    -    "GeneralError": {
    -      "description": "General Error",
    -      "content": {
    -        "application/json": {
    -          "schema": {
    -            "$ref": "#/components/schemas/GeneralError"
    -          }
    -        }
    -      }
    -    }
    -  },
    -  "securitySchemes": {
    -    "api_key": {
    -      "type": "apiKey",
    -      "name": "api_key",
    -      "in": "header"
    -    },
    -    "petstore_auth": {
    -      "type": "oauth2",
    -      "flows": {
    -        "implicit": {
    -          "authorizationUrl": "http://example.org/api/oauth/dialog",
    -          "scopes": {
    -            "write:pets": "modify pets in your account",
    -            "read:pets": "read your pets"
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -components:
    -  schemas:
    -    Category:
    -      type: object
    -      properties:
    -        id:
    -          type: integer
    -          format: int64
    -        name:
    -          type: string
    -    Tag:
    -      type: object
    -      properties:
    -        id:
    -          type: integer
    -          format: int64
    -        name:
    -          type: string
    -  parameters:
    -    skipParam:
    -      name: skip
    -      in: query
    -      description: number of items to skip
    -      required: true
    -      schema:
    -        type: integer
    -        format: int32
    -    limitParam:
    -      name: limit
    -      in: query
    -      description: max records to return
    -      required: true
    -      schema:
    -        type: integer
    -        format: int32
    -  responses:
    -    NotFound:
    -      description: Entity not found.
    -    IllegalInput:
    -      description: Illegal input for operation.
    -    GeneralError:
    -      description: General Error
    -      content:
    -        application/json:
    -          schema:
    -            $ref: '#/components/schemas/GeneralError'
    -  securitySchemes:
    -    api_key:
    -      type: apiKey
    -      name: api_key
    -      in: header
    -    petstore_auth:
    -      type: oauth2
    -      flows: 
    -        implicit:
    -          authorizationUrl: http://example.org/api/oauth/dialog
    -          scopes:
    -            write:pets: modify pets in your account
    -            read:pets: read your pets
    -
    -

    Paths Object

    -

    Holds the relative paths to the individual endpoints and their operations. -The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    /{path}Path Item ObjectA relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended (no relative URL resolution) to the expanded URL from the Server Object's url field in order to construct the full URL. Path templating is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it’s up to the tooling to decide which one to use.
    -

    This object MAY be extended with Specification Extensions.

    -
    Path Templating Matching
    -

    Assuming the following paths, the concrete definition, /pets/mine, will be matched first if used:

    -
    
    -  /pets/{petId}
    -  /pets/mine
    -
    -

    The following paths are considered identical and invalid:

    -
    
    -  /pets/{petId}
    -  /pets/{name}
    -
    -

    The following may lead to ambiguous resolution:

    -
    
    -  /{entity}/me
    -  /books/{id}
    -
    -
    Paths Object Example
    -
    
    -{
    -  "/pets": {
    -    "get": {
    -      "description": "Returns all pets from the system that the user has access to",
    -      "responses": {
    -        "200": {          
    -          "description": "A list of pets.",
    -          "content": {
    -            "application/json": {
    -              "schema": {
    -                "type": "array",
    -                "items": {
    -                  "$ref": "#/components/schemas/pet"
    -                }
    -              }
    -            }
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -/pets:
    -  get:
    -    description: Returns all pets from the system that the user has access to
    -    responses:
    -      '200':
    -        description: A list of pets.
    -        content:
    -          application/json:
    -            schema:
    -              type: array
    -              items:
    -                $ref: '#/components/schemas/pet'
    -
    -

    Path Item Object

    -

    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.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    $refstringAllows 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.
    summarystringAn optional, string summary, intended to apply to all operations in this path.
    descriptionstringAn optional, string description, intended to apply to all operations in this path. CommonMark syntax MAY be used for rich text representation.
    getOperation ObjectA definition of a GET operation on this path.
    putOperation ObjectA definition of a PUT operation on this path.
    postOperation ObjectA definition of a POST operation on this path.
    deleteOperation ObjectA definition of a DELETE operation on this path.
    optionsOperation ObjectA definition of a OPTIONS operation on this path.
    headOperation ObjectA definition of a HEAD operation on this path.
    patchOperation ObjectA definition of a PATCH operation on this path.
    traceOperation ObjectA definition of a TRACE operation on this path.
    servers[Server Object]An alternative server array to service all operations in this path.
    parameters[Parameter Object ¦ Reference Object]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 OpenAPI Object’s components/parameters.
    -

    This object MAY be extended with Specification Extensions.

    -
    Path Item Object Example
    -
    
    -{
    -  "get": {
    -    "description": "Returns pets based on ID",
    -    "summary": "Find pets by ID",
    -    "operationId": "getPetsById",
    -    "responses": {
    -      "200": {
    -        "description": "pet response",
    -        "content": {
    -          "*/*": {
    -            "schema": {
    -              "type": "array",
    -              "items": {
    -                "$ref": "#/components/schemas/Pet"
    -              }
    -            }
    -          }
    -        }
    -      },
    -      "default": {
    -        "description": "error payload",
    -        "content": {
    -          "text/html": {
    -            "schema": {
    -              "$ref": "#/components/schemas/ErrorModel"
    -            }
    -          }
    -        }
    -      }
    -    }
    -  },
    -  "parameters": [
    -    {
    -      "name": "id",
    -      "in": "path",
    -      "description": "ID of pet to use",
    -      "required": true,
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "type": "string"
    -        }
    -      },
    -      "style": "simple"
    -    }
    -  ]
    -}
    -
    -
    
    -get:
    -  description: Returns pets based on ID
    -  summary: Find pets by ID
    -  operationId: getPetsById
    -  responses:
    -    '200':
    -      description: pet response
    -      content:
    -        '*/*' :
    -          schema:
    -            type: array
    -            items:
    -              $ref: '#/components/schemas/Pet'
    -    default:
    -      description: error payload
    -      content:
    -        'text/html':
    -          schema:
    -            $ref: '#/components/schemas/ErrorModel'
    -parameters:
    -- name: id
    -  in: path
    -  description: ID of pet to use
    -  required: true
    -  schema:
    -    type: array
    -    style: simple
    -    items:
    -      type: string  
    -
    -

    Operation Object

    -

    Describes a single API operation on a path.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    tags[string]A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
    summarystringA short summary of what the operation does.
    descriptionstringA verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation.
    externalDocsExternal Documentation ObjectAdditional external documentation for this operation.
    operationIdstringUnique 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[Parameter Object ¦ Reference Object]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 OpenAPI Object’s components/parameters.
    requestBodyRequest Body Object ¦ Reference ObjectThe request body applicable for this operation. The requestBody is only supported in HTTP methods where the HTTP 1.1 specification [[!rfc7231]]section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers.
    responsesResponses ObjectREQUIRED. The list of possible responses as they are returned from executing this operation.
    callbacksMap[string, Callback Object ¦ Reference Object]A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
    deprecatedbooleanDeclares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is false.
    security[Security Requirement Object]A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used.
    servers[Server Object]An alternative server array to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value.
    -

    This object MAY be extended with Specification Extensions.

    -
    Operation Object Example
    -
    
    -{
    -  "tags": [
    -    "pet"
    -  ],
    -  "summary": "Updates a pet in the store with form data",
    -  "operationId": "updatePetWithForm",
    -  "parameters": [
    -    {
    -      "name": "petId",
    -      "in": "path",
    -      "description": "ID of pet that needs to be updated",
    -      "required": true,
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  ],
    -  "requestBody": {
    -    "content": {
    -      "application/x-www-form-urlencoded": {
    -        "schema": {
    -          "type": "object",
    -           "properties": {
    -              "name": { 
    -                "description": "Updated name of the pet",
    -                "type": "string"
    -              },
    -              "status": {
    -                "description": "Updated status of the pet",
    -                "type": "string"
    -             }
    -           },
    -        "required": ["status"] 
    -        }
    -      }
    -    }
    -  },
    -  "responses": {
    -    "200": {
    -      "description": "Pet updated.",
    -      "content": {
    -        "application/json": {},
    -        "application/xml": {}
    -      }
    -    },
    -    "405": {
    -      "description": "Invalid input",
    -      "content": {
    -        "application/json": {},
    -        "application/xml": {}
    -      }
    -    }
    -  },
    -  "security": [
    -    {
    -      "petstore_auth": [
    -        "write:pets",
    -        "read:pets"
    -      ]
    -    }
    -  ]
    -}
    -
    -
    
    -tags:
    -- pet
    -summary: Updates a pet in the store with form data
    -operationId: updatePetWithForm
    -parameters:
    -- name: petId
    -  in: path
    -  description: ID of pet that needs to be updated
    -  required: true
    -  schema:
    -    type: string
    -requestBody:
    -  content:
    -    'application/x-www-form-urlencoded':
    -      schema:
    -       properties:
    -          name: 
    -            description: Updated name of the pet
    -            type: string
    -          status:
    -            description: Updated status of the pet
    -            type: string
    -       required:
    -         - status
    -responses:
    -  '200':
    -    description: Pet updated.
    -    content: 
    -      'application/json': {}
    -      'application/xml': {}
    -  '405':
    -    description: Invalid input
    -    content: 
    -      'application/json': {}
    -      'application/xml': {}
    -security:
    -- petstore_auth:
    -  - write:pets
    -  - read:pets
    -
    -

    External Documentation Object

    -

    Allows referencing an external resource for extended documentation.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringA short description of the target documentation. CommonMark syntax MAY be used for rich text representation.
    urlstringREQUIRED. The URL for the target documentation. Value MUST be in the format of a URL.
    -

    This object MAY be extended with Specification Extensions.

    -
    External Documentation Object Example
    -
    
    -{
    -  "description": "Find more info here",
    -  "url": "https://example.com"
    -}
    -
    -
    
    -description: Find more info here
    -url: https://example.com
    -
    -

    Parameter Object

    -

    Describes a single operation parameter.

    -

    A unique parameter is defined by a combination of a name and location.

    -
    Parameter Locations
    -

    There are four possible parameter locations specified by the in field:

    -
      -
    • path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId.
    • -
    • query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id.
    • -
    • header - Custom headers that are expected as part of the request. Note that [[!rfc7230]]page-22) states header names are case insensitive.
    • -
    • cookie - Used to pass a specific cookie value to the API.
    • -
    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringREQUIRED. 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.
    • If in is "header" and the name field is "Accept", "Content-Type" or "Authorization", the parameter definition SHALL be ignored.
    • For all other cases, the name corresponds to the parameter name used by the in property.
    instringREQUIRED. The location of the parameter. Possible values are “query”, “header”, “path” or “cookie”.
    descriptionstringA brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
    requiredbooleanDetermines whether this parameter is mandatory. If the parameter location is “path”, this property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and its default value is false.
    deprecatedbooleanSpecifies that a parameter is deprecated and SHOULD be transitioned out of usage.
    allowEmptyValuebooleanSets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored.
    -

    The rules for serialization of the parameter are specified in one of two ways. -For simpler scenarios, a schema and style can describe the structure and syntax of the parameter.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    stylestringDescribes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form.
    explodebooleanWhen this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false.
    allowReservedbooleanDetermines whether the parameter value SHOULD allow reserved characters, as defined by [[!rfc3986]]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false.
    schemaSchema Object ¦ Reference ObjectThe schema defining the type used for the parameter.
    exampleAnyExample of the media type. The example SHOULD match the specified schema and encoding properties if present. The example object is mutually exclusive of the examples object. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.
    examplesMap[ string, Example Object ¦ Reference Object]Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The examples object is mutually exclusive of the example object. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema.
    -

    For more complex scenarios, the content property can define the media type and schema of the parameter. -A parameter MUST contain either a schema property, or a content property, but not both. -When example or examples are provided in conjunction with the schema object, the example MUST follow the prescribed serialization strategy for the parameter.

    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    contentMap[string, Media Type Object]A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.
    -
    Style Values
    -

    In order to support common ways of serializing simple parameters, a set of style values are defined.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    styletypeinComments
    matrixprimitive, array, objectpathPath-style parameters defined by [[!rfc6570]]section-3.2.7)
    labelprimitive, array, objectpathLabel style parameters defined by [[!rfc6570]]section-3.2.5)
    formprimitive, array, objectquery, cookieForm style parameters defined by [[!rfc6570]]section-3.2.8). This option replaces collectionFormat with a csv (when explode is false) or multi (when explode is true) value from OpenAPI 2.0.
    simplearraypath, headerSimple style parameters defined by [[!rfc6570]]section-3.2.2). This option replaces collectionFormat with a csv value from OpenAPI 2.0.
    spaceDelimitedarrayquerySpace separated array values. This option replaces collectionFormat equal to ssv from OpenAPI 2.0.
    pipeDelimitedarrayqueryPipe separated array values. This option replaces collectionFormat equal to pipes from OpenAPI 2.0.
    deepObjectobjectqueryProvides a simple way of rendering nested objects using form parameters.
    -
    Style Examples
    -

    Assume a parameter named color has one of the following values:

    -
    
    -   string -> "blue"
    -   array -> ["blue","black","brown"]
    -   object -> { "R": 100, "G": 200, "B": 150 }
    -
    -

    The following table shows examples of rendering differences for each value.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    styleexplodeemptystringarrayobject
    matrixfalse;color;color=blue;color=blue,black,brown;color=R,100,G,200,B,150
    matrixtrue;color;color=blue;color=blue;color=black;color=brown;R=100;G=200;B=150
    labelfalse..blue.blue.black.brown.R.100.G.200.B.150
    labeltrue..blue.blue.black.brown.R=100.G=200.B=150
    formfalsecolor=color=bluecolor=blue,black,browncolor=R,100,G,200,B,150
    formtruecolor=color=bluecolor=blue&color=black&color=brownR=100&G=200&B=150
    simplefalsen/ablueblue,black,brownR,100,G,200,B,150
    simpletruen/ablueblue,black,brownR=100,G=200,B=150
    spaceDelimitedfalsen/an/ablue%20black%20brownR%20100%20G%20200%20B%20150
    pipeDelimitedfalsen/an/ablue¦black¦brownR¦100¦G¦200
    deepObjecttruen/an/an/acolor[R]=100&color[G]=200&color[B]=150
    -

    This object MAY be extended with Specification Extensions.

    -
    Parameter Object Examples
    -

    A header parameter with an array of 64 bit integer numbers:

    -
    
    -{
    -  "name": "token",
    -  "in": "header",
    -  "description": "token to be passed as a header",
    -  "required": true,
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "type": "integer",
    -      "format": "int64"
    -    }
    -  },
    -  "style": "simple"
    -}
    -
    -
    
    -name: token
    -in: header
    -description: token to be passed as a header
    -required: true
    -schema:
    -  type: array
    -  items:
    -    type: integer
    -    format: int64
    -style: simple
    -
    -

    A path parameter of a string value:

    -
    
    -{
    -  "name": "username",
    -  "in": "path",
    -  "description": "username to fetch",
    -  "required": true,
    -  "schema": {
    -    "type": "string"
    -  }
    -}
    -
    -
    
    -name: username
    -in: path
    -description: username to fetch
    -required: true
    -schema:
    -  type: string
    -
    -

    An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

    -
    
    -{
    -  "name": "id",
    -  "in": "query",
    -  "description": "ID of the object to fetch",
    -  "required": false,
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    }
    -  },
    -  "style": "form",
    -  "explode": true
    -}
    -
    -
    
    -name: id
    -in: query
    -description: ID of the object to fetch
    -required: false
    -schema:
    -  type: array
    -  items:
    -    type: string
    -style: form
    -explode: true
    -
    -

    A free-form query parameter, allowing undefined parameters of a specific type:

    -
    
    -{
    -  "in": "query",
    -  "name": "freeForm",
    -  "schema": {
    -    "type": "object",
    -    "additionalProperties": {
    -      "type": "integer"
    -    },
    -  },
    -  "style": "form"
    -}
    -
    -
    
    -in: query
    -name: freeForm
    -schema:
    -  type: object
    -  additionalProperties:
    -    type: integer
    -style: form
    -
    -

    A complex parameter using content to define serialization:

    -
    
    -{
    -  "in": "query",
    -  "name": "coordinates",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "type": "object",
    -        "required": [
    -          "lat",
    -          "long"
    -        ],
    -        "properties": {
    -          "lat": {
    -            "type": "number"
    -          },
    -          "long": {
    -            "type": "number"
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -in: query
    -name: coordinates
    -content:
    -  application/json:
    -    schema:
    -      type: object
    -      required:
    -        - lat
    -        - long
    -      properties:
    -        lat:
    -          type: number
    -        long:
    -          type: number
    -
    -

    Request Body Object

    -

    Describes a single request body.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringA brief description of the request body. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
    contentMap[string, Media Type Object]REQUIRED. The content of the request body. The key is a media type or [media type range]appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
    requiredbooleanDetermines if the request body is required in the request. Defaults to false.
    -

    This object MAY be extended with Specification Extensions.

    -
    Request Body Examples
    -

    A request body with a referenced model definition.

    -
    
    -{
    -  "description": "user to add to the system",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "$ref": "#/components/schemas/User"
    -      },
    -      "examples": {
    -          "user" : {
    -            "summary": "User Example", 
    -            "externalValue": "http://foo.bar/examples/user-example.json"
    -          } 
    -        }
    -    },
    -    "application/xml": {
    -      "schema": {
    -        "$ref": "#/components/schemas/User"
    -      },
    -      "examples": {
    -          "user" : {
    -            "summary": "User example in XML",
    -            "externalValue": "http://foo.bar/examples/user-example.xml"
    -          }
    -        }
    -    },
    -    "text/plain": {
    -      "examples": {
    -        "user" : {
    -            "summary": "User example in Plain text",
    -            "externalValue": "http://foo.bar/examples/user-example.txt" 
    -        }
    -      } 
    -    },
    -    "*/*": {
    -      "examples": {
    -        "user" : {
    -            "summary": "User example in other format",
    -            "externalValue": "http://foo.bar/examples/user-example.whatever"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -description: user to add to the system
    -content: 
    -  'application/json':
    -    schema:
    -      $ref: '#/components/schemas/User'
    -    examples:
    -      user:
    -        summary: User Example
    -        externalValue: 'http://foo.bar/examples/user-example.json'
    -  'application/xml':
    -    schema:
    -      $ref: '#/components/schemas/User'
    -    examples:
    -      user:
    -        summary: User Example in XML
    -        externalValue: 'http://foo.bar/examples/user-example.xml'
    -  'text/plain':
    -    examples:
    -      user:
    -        summary: User example in text plain format
    -        externalValue: 'http://foo.bar/examples/user-example.txt'
    -  '*/*':
    -    examples:
    -      user: 
    -        summary: User example in other format
    -        externalValue: 'http://foo.bar/examples/user-example.whatever'
    -
    -

    A body parameter that is an array of string values:

    -
    
    -{
    -  "description": "user to add to the system",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "type": "string"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -description: user to add to the system
    -required: true
    -content:
    -  text/plain:
    -    schema:
    -      type: array
    -      items:
    -        type: string
    -
    -

    Media Type Object

    -

    Each Media Type Object provides schema and examples for the media type identified by its key.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    schemaSchema Object ¦ Reference ObjectThe schema defining the type used for the request body.
    exampleAnyExample of the media type. The example object SHOULD be in the correct format as specified by the media type. The example object is mutually exclusive of the examples object. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema.
    examplesMap[ string, Example Object ¦ Reference Object]Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The examples object is mutually exclusive of the example object. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema.
    encodingMap[string, Encoding Object]A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded.
    -

    This object MAY be extended with Specification Extensions.

    -
    Media Type Examples
    -
    
    -{
    -  "application/json": {
    -    "schema": {
    -         "$ref": "#/components/schemas/Pet"
    -    },
    -    "examples": {
    -      "cat" : {
    -        "summary": "An example of a cat",
    -        "value": 
    -          {
    -            "name": "Fluffy",
    -            "petType": "Cat",
    -            "color": "White",
    -            "gender": "male",
    -            "breed": "Persian"
    -          }
    -      },
    -      "dog": {
    -        "summary": "An example of a dog with a cat's name",
    -        "value" :  { 
    -          "name": "Puma",
    -          "petType": "Dog",
    -          "color": "Black",
    -          "gender": "Female",
    -          "breed": "Mixed"
    -        },
    -      "frog": {
    -          "$ref": "#/components/examples/frog-example"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -application/json: 
    -  schema:
    -    $ref: "#/components/schemas/Pet"
    -  examples:
    -    cat:
    -      summary: An example of a cat
    -      value:
    -        name: Fluffy
    -        petType: Cat
    -        color: White
    -        gender: male
    -        breed: Persian
    -    dog:
    -      summary: An example of a dog with a cat's name
    -      value:
    -        name: Puma
    -        petType: Dog
    -        color: Black
    -        gender: Female
    -        breed: Mixed
    -    frog:
    -      $ref: "#/components/examples/frog-example"
    -
    -
    Considerations for File Uploads
    -

    In contrast with the 2.0 specification, file input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically:

    -
    
    -# content transferred with base64 encoding
    -schema:
    -  type: string
    -  format: base64
    -
    -
    
    -# content transferred in binary (octet-stream):
    -schema:
    -  type: string
    -  format: binary
    -
    -

    These examples apply to either input payloads of file uploads or response payloads.

    -

    A requestBody for submitting a file in a POST operation may look like the following example:

    -
    
    -requestBody:
    -  content:
    -    application/octet-stream:
    -      # any media type is accepted, functionally equivalent to `*/*`
    -      schema:
    -        # a binary file of any type
    -        type: string
    -        format: binary
    -
    -

    In addition, specific media types MAY be specified:

    -
    
    -# multiple, specific media types may be specified:
    -requestBody:
    -  content:
    -      # a binary file of type png or jpeg
    -    'image/jpeg':
    -      schema:
    -        type: string
    -        format: binary
    -    'image/png':
    -      schema:
    -        type: string
    -        format: binary        
    -
    -

    To upload multiple files, a multipart media type MUST be used:

    -
    
    -requestBody:
    -  content:
    -    multipart/form-data:
    -      schema:
    -        properties:
    -          # The property name 'file' will be used for all files.
    -          file:
    -            type: array
    -            items:
    -              type: string
    -              format: binary
    -
    -
    -
    Support for x-www-form-urlencoded Request Bodies
    -

    To submit content using form url encoding via [[!rfc1866]], the following -definition may be used:

    -
    
    -requestBody:
    -  content:
    -    application/x-www-form-urlencoded:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            type: string
    -            format: uuid
    -          address:
    -            # complex types are stringified to support RFC 1866
    -            type: object
    -            properties: {}
    -
    -

    In this example, the contents in the requestBody MUST be stringified per [[!rfc1866]]) when passed to the server. In addition, the address field complex object will be stringified.

    -

    When passing complex objects in the application/x-www-form-urlencoded content type, the default serialization strategy of such properties is described in the Encoding Object's style property as form.

    -
    Special Considerations for multipart Content
    -

    It is common to use multipart/form-data as a Content-Type when transferring request bodies to operations. In contrast to 2.0, a schema is REQUIRED to define the input parameters to the operation when using multipart content. This supports complex structures as well as supporting mechanisms for multiple file uploads.

    -

    When passing in multipart types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default Content-Types are defined for multipart:

    -
      -
    • If the property is a primitive, or an array of primitive values, the default Content-Type is text/plain
    • -
    • If the property is complex, or an array of complex values, the default Content-Type is application/json
    • -
    • If the property is a type: string with format: binary or format: base64 (aka a file object), the default Content-Type is application/octet-stream
    • -
    -

    Examples:

    -
    
    -requestBody:
    -  content:
    -    multipart/form-data:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            type: string
    -            format: uuid
    -          address:
    -            # default Content-Type for objects is `application/json`
    -            type: object
    -            properties: {}
    -          profileImage:
    -            # default Content-Type for string/binary is `application/octet-stream`
    -            type: string
    -            format: binary
    -          children:
    -            # default Content-Type for arrays is based on the `inner` type (text/plain here)
    -            type: array
    -            items:
    -              type: string
    -          addresses:
    -            # default Content-Type for arrays is based on the `inner` type (object shown, so `application/json` in this example)
    -            type: array
    -            items:
    -              type: '#/components/schemas/Address'
    -
    -

    An encoding attribute is introduced to give you control over the serialization of parts of multipart request bodies. This attribute is only applicable to multipart and application/x-www-form-urlencoded request bodies.

    -

    Encoding Object

    -

    A single encoding definition applied to a single schema property.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    contentTypestringThe Content-Type for encoding a specific property. Default value depends on the property type: for string with format being binaryapplication/octet-stream; for other primitive types – text/plain; for object - application/json; for array – the default is defined based on the inner type. The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types.
    headersMap[string, Header Object ¦ Reference Object]A map allowing additional information to be provided as headers, for example Content-Disposition. Content-Type is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a multipart.
    stylestringDescribes how a specific property value will be serialized depending on its type. See Parameter Object for details on the style property. The behavior follows the same values as query parameters, including default values. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
    explodebooleanWhen this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
    allowReservedbooleanDetermines whether the parameter value SHOULD allow reserved characters, as defined by [[!rfc3986]]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
    -

    This object MAY be extended with Specification Extensions.

    -
    Encoding Object Example
    -
    
    -requestBody:
    -  content:
    -    multipart/mixed:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            # default is text/plain
    -            type: string
    -            format: uuid
    -          address:
    -            # default is application/json
    -            type: object
    -            properties: {}
    -          historyMetadata:
    -            # need to declare XML format!
    -            description: metadata in XML format
    -            type: object
    -            properties: {}
    -          profileImage:
    -            # default is application/octet-stream, need to declare an image type only!
    -            type: string
    -            format: binary
    -      encoding:
    -        historyMetadata:
    -          # require XML Content-Type in utf-8 encoding
    -          contentType: application/xml; charset=utf-8
    -        profileImage:
    -          # only accept png/jpeg
    -          contentType: image/png, image/jpeg
    -          headers:
    -            X-Rate-Limit-Limit:
    -              description: The number of allowed requests in the current period
    -              schema:
    -                type: integer
    -
    -

    Responses Object

    -

    A container for the expected responses of an operation. -The container maps a HTTP response code to the expected response.

    -

    The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. -However, documentation is expected to cover a successful operation response and any known errors.

    -

    The default MAY be used as a default response object for all HTTP codes -that are not covered individually by the specification.

    -

    The Responses Object MUST contain at least one response code, and it -SHOULD be the response for a successful operation call.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    defaultResponse Object ¦ Reference ObjectThe documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. A Reference Object can link to a response that the OpenAPI Object’s components/responses section defines.
    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    HTTP Status CodeResponse Object ¦ Reference ObjectAny HTTP status code can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A Reference Object can link to a response that is defined in the OpenAPI Object’s components/responses section. This field MUST be enclosed in quotation marks (for example, “200”) for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character X. For example, 2XX represents all response codes between [200-299]. The following range definitions are allowed: 1XX, 2XX, 3XX, 4XX, and 5XX. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code.
    -

    This object MAY be extended with Specification Extensions.

    -
    Responses Object Example
    -

    A 200 response for a successful operation and a default response for others (implying an error):

    -
    
    -{
    -  "200": {
    -    "description": "a pet to be returned",
    -    "content": {
    -      "application/json": {
    -        "schema": {
    -          "$ref": "#/components/schemas/Pet"
    -        }
    -      }
    -    }
    -  },
    -  "default": {
    -    "description": "Unexpected error",
    -    "content": {
    -      "application/json": {
    -        "schema": {
    -          "$ref": "#/components/schemas/ErrorModel"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -'200':
    -  description: a pet to be returned
    -  content: 
    -    application/json:
    -      schema:
    -        $ref: '#/components/schemas/Pet'
    -default:
    -  description: Unexpected error
    -  content:
    -    application/json:
    -      schema:
    -        $ref: '#/components/schemas/ErrorModel'
    -
    -

    Response Object

    -

    Describes a single response from an API Operation, including design-time, static -links to operations based on the response.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringREQUIRED. A short description of the response. CommonMark syntax MAY be used for rich text representation.
    headersMap[string, Header Object ¦ Reference Object]Maps a header name to its definition. [[!rfc7230]]page-22) states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored.
    contentMap[string, Media Type Object]A map containing descriptions of potential response payloads. The key is a media type or [media type range]appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
    linksMap[string, Link Object ¦ Reference Object]A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for Component Objects.
    -

    This object MAY be extended with Specification Extensions.

    -
    Response Object Examples
    -

    Response of an array of a complex type:

    -
    
    -{
    -  "description": "A complex object array response",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "$ref": "#/components/schemas/VeryComplexType"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -description: A complex object array response
    -content: 
    -  application/json:
    -    schema: 
    -      type: array
    -      items:
    -        $ref: '#/components/schemas/VeryComplexType'
    -
    -

    Response with a string type:

    -
    
    -{
    -  "description": "A simple string response",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  }
    -
    -}
    -
    -
    
    -description: A simple string response
    -representations:
    -  text/plain:
    -    schema:
    -      type: string
    -
    -

    Plain text response with headers:

    -
    
    -{
    -  "description": "A simple string response",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  },
    -  "headers": {
    -    "X-Rate-Limit-Limit": {
    -      "description": "The number of allowed requests in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    },
    -    "X-Rate-Limit-Remaining": {
    -      "description": "The number of remaining requests in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    },
    -    "X-Rate-Limit-Reset": {
    -      "description": "The number of seconds left in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -description: A simple string response
    -content:
    -  text/plain:
    -    schema:
    -      type: string
    -    example: 'whoa!'
    -headers:
    -  X-Rate-Limit-Limit:
    -    description: The number of allowed requests in the current period
    -    schema:
    -      type: integer
    -  X-Rate-Limit-Remaining:
    -    description: The number of remaining requests in the current period
    -    schema:
    -      type: integer
    -  X-Rate-Limit-Reset:
    -    description: The number of seconds left in the current period
    -    schema:
    -      type: integer
    -
    -

    Response with no return value:

    -
    
    -{
    -  "description": "object created"
    -}
    -
    -
    
    -description: object created
    -
    -

    Callback Object

    -

    A map of possible out-of band callbacks related to the parent operation. -Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. -The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {expression}Path Item ObjectA Path Item Object used to define a callback request and expected responses. A complete example is available.
    -

    This object MAY be extended with Specification Extensions.

    -
    Key Expression
    -

    The key that identifies the Path Item Object is a runtime expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. -A simple example might be $request.body#/url. -However, using a runtime expression the complete HTTP message can be accessed. -This includes accessing any part of a body that a JSON Pointer [[!rfc6901]] can reference.

    -

    For example, given the following HTTP request:

    -
    
    -POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1
    -Host: example.org
    -Content-Type: application/json
    -Content-Length: 187
    -
    -{
    -  "failedUrl" : "http://clientdomain.com/failed",
    -  "successUrls" : [
    -    "http://clientdomain.com/fast",
    -    "http://clientdomain.com/medium",
    -    "http://clientdomain.com/slow"
    -  ] 
    -}
    -
    -201 Created
    -Location: http://example.org/subscription/1
    -
    -

    The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named eventType and a query parameter named queryUrl.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ExpressionValue
    $urlhttp://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning
    $methodPOST
    $request.path.eventTypemyevent
    $request.query.queryUrlhttp://clientdomain.com/stillrunning
    $request.header.content-Typeapplication/json
    $request.body#/failedUrlhttp://clientdomain.com/stillrunning
    $request.body#/successUrls/2http://clientdomain.com/medium
    $response.header.Locationhttp://example.org/subscription/1
    -
    Callback Object Example
    -

    The following example shows a callback to the URL specified by the id and email property in the request body.

    -
    
    -myWebhook:
    -  'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
    -    post:
    -      requestBody:
    -        description: Callback payload
    -        content: 
    -          'application/json':
    -            schema:
    -              $ref: '#/components/schemas/SomePayload'
    -      responses:
    -        '200':
    -          description: webhook successfully processed and no retries will be performed
    -
    -

    Example Object

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    summarystringShort description for the example.
    descriptionstringLong description for the example. CommonMark syntax MAY be used for rich text representation.
    valueAnyEmbedded literal example. The value field and externalValue field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary.
    externalValuestringA URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The value field and externalValue field are mutually exclusive.
    -

    This object MAY be extended with Specification Extensions.

    -

    In all cases, the example value is expected to be compatible with the type schema -of its associated value. Tooling implementations MAY choose to -validate compatibility automatically, and reject the example value(s) if incompatible.

    -
    Example Object Example
    -
    
    -# in a model
    -schemas:
    -  properties:
    -    name:
    -      type: string
    -      examples:
    -        name:
    -          $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example
    -
    -# in a request body:
    -  requestBody:
    -    content:
    -      'application/json':
    -        schema:
    -          $ref: '#/components/schemas/Address'
    -        examples: 
    -          foo:
    -            summary: A foo example
    -            value: {"foo": "bar"}
    -          bar:
    -            summary: A bar example
    -            value: {"bar": "baz"}
    -      'application/xml':
    -        examples: 
    -          xmlExample:
    -            summary: This is an example in XML
    -            externalValue: 'http://example.org/examples/address-example.xml'
    -      'text/plain':
    -        examples:
    -          textExample: 
    -            summary: This is a text example
    -            externalValue: 'http://foo.bar/examples/address-example.txt' 
    -
    -
    -# in a parameter
    -  parameters:
    -    - name: 'zipCode'
    -      in: 'query'
    -      schema:
    -        type: 'string'
    -        format: 'zip-code'
    -        examples:
    -          zip-example: 
    -            $ref: '#/components/examples/zip-example'
    -
    -# in a response
    -  responses:
    -    '200':
    -      description: your car appointment has been booked
    -      content: 
    -        application/json:
    -          schema:
    -            $ref: '#/components/schemas/SuccessResponse'
    -          examples:
    -            confirmation-success:
    -              $ref: '#/components/examples/confirmation-success'
    -
    -

    Link Object

    -

    The Link object represents a possible design-time link for a response. -The presence of a link does not guarantee the caller’s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.

    -

    Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.

    -

    For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    operationRefstringA relative or absolute reference to an OAS operation. This field is mutually exclusive of the operationId field, and MUST point to an Operation Object. Relative operationRef values MAY be used to locate an existing Operation Object in the OpenAPI definition.
    operationIdstringThe name of an existing, resolvable OAS operation, as defined with a unique operationId. This field is mutually exclusive of the operationRef field.
    parametersMap[string, Any ¦ {expression}]A map representing parameters to pass to an operation as specified with operationId or identified via operationRef. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id).
    requestBodyAny ¦ {expression}A literal value or {expression} to use as a request body when calling the target operation.
    descriptionstringA description of the link. CommonMark syntax MAY be used for rich text representation.
    serverServer ObjectA server object to be used by the target operation.
    -

    This object MAY be extended with Specification Extensions.

    -

    A linked operation MUST be identified using either an operationRef or operationId. -In the case of an operationId, it MUST be unique and resolved in the scope of the OAS document. -Because of the potential for name clashes, the operationRef syntax is preferred -for specifications with external references.

    -
    Examples
    -

    Computing a link from a request operation where the $request.path.id is used to pass a request parameter to the linked operation.

    -
    
    -paths:
    -  /users/{id}:
    -    parameters:
    -    - name: id
    -      in: path
    -      required: true
    -      description: the user identifier, as userId 
    -      schema:
    -        type: string
    -    get:
    -      responses:
    -        '200':
    -          description: the user being returned
    -          content:
    -            application/json:
    -              schema:
    -                type: object
    -                properties:
    -                  uuid: # the unique user id
    -                    type: string
    -                    format: uuid
    -        links:
    -          address:
    -            # the target link operationId
    -            operationId: getUserAddress
    -            parameters:
    -              # get the `id` field from the request path parameter named `id`
    -              userId: $request.path.id
    -  # the path item of the linked operation
    -  /users/{userid}/address:
    -    parameters:
    -    - name: userid
    -      in: path
    -      required: true
    -      description: the user identifier, as userId 
    -      schema:
    -        type: string
    -      # linked operation
    -      get:
    -        operationId: getUserAddress
    -        responses:
    -          '200':
    -            description: the user's address
    -
    -

    When a runtime expression fails to evaluate, no parameter value is passed to the target operation.

    -

    Values from the response body can be used to drive a linked operation.

    -
    
    -links:
    -  address:
    -    operationId: getUserAddressByUUID
    -    parameters:
    -      # get the `id` field from the request path parameter named `id`
    -      userUuid: $response.body#/uuid
    -
    -

    Clients follow all links at their discretion. -Neither permissions, nor the capability to make a successful call to that link, is guaranteed -solely by the existence of a relationship.

    -
    OperationRef Examples
    -

    As references to operationId MAY NOT be possible (the operationId is an optional -value), references MAY also be made through a relative operationRef:

    -
    
    -links:
    -  UserRepositories:
    -    # returns array of '#/components/schemas/repository'
    -    operationRef: '#/paths/~12.0~1repositories~1{username}/get'
    -    parameters:
    -      username: $response.body#/username
    -
    -

    or an absolute operationRef:

    -
    
    -links:
    -  UserRepositories:
    -    # returns array of '#/components/schemas/repository'
    -    operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get'
    -    parameters:
    -      username: $response.body#/username
    -
    -

    Note that in the use of operationRef, the escaped forward-slash is necessary when -using JSON references.

    -
    Runtime Expressions
    -

    Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. -This mechanism is used by Link Objects and Callback Objects.

    -

    The runtime expression is defined by the following [Augmented Backus-Naur Form] syntax

    -
    
    -      expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source )
    -      source = ( header-reference | query-reference | path-reference | body-reference )  
    -      header-reference = "header." token
    -      query-reference = "query." name  
    -      path-reference = "path." name
    -      body-reference = "body" ["#" fragment]
    -      fragment = a JSON Pointer [[!rfc6901]]  
    -      name = *( char )
    -      char = as per RFC [7159]section-7)
    -      token = as per RFC [7230]section-3.2.6)
    -
    -

    The name identifier is case-sensitive, whereas token is not.

    -

    The table below provides examples of runtime expressions and examples of their use in a value:

    -
    Examples
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Source Locationexample expressionnotes
    HTTP Method$methodThe allowable values for the $method will be those for the HTTP operation.
    Requested media type$request.header.accept
    Request parameter$request.path.idRequest parameters MUST be declared in the parameters section of the parent operation or they cannot be evaluated. This includes request headers.
    Request body property$request.body#/user/uuidIn operations which accept payloads, references may be made to portions of the requestBody or the entire body.
    Request URL$url
    Response value$response.body#/statusIn operations which return payloads, references may be made to portions of the response body or the entire body.
    Response header$response.header.ServerSingle header values only are available
    -

    Runtime expressions preserve the type of the referenced value. -Expressions can be embedded into string values by surrounding the expression with {} curly braces.

    -

    Header Object

    -

    The Header Object follows the structure of the Parameter Object with the following changes:

    -
      -
    1. name MUST NOT be specified, it is given in the corresponding headers map.
    2. -
    3. in MUST NOT be specified, it is implicitly in header.
    4. -
    5. All traits that are affected by the location MUST be applicable to a location of header (for example, style).
    6. -
    -
    Header Object Example
    -

    A simple header of type integer:

    -
    
    -{
    -  "description": "The number of allowed requests in the current period",
    -  "schema": {
    -    "type": "integer"
    -  }
    -}
    -
    -
    
    -description: The number of allowed requests in the current period
    -schema:
    -  type: integer
    -
    -

    Tag Object

    -

    Adds metadata to a single tag that is used by the Operation Object. -It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringREQUIRED. The name of the tag.
    descriptionstringA short description for the tag. CommonMark syntax MAY be used for rich text representation.
    externalDocsExternal Documentation ObjectAdditional external documentation for this tag.
    -

    This object MAY be extended with Specification Extensions.

    -
    Tag Object Example
    -
    
    -{
    -	"name": "pet",
    -	"description": "Pets operations"
    -}
    -
    -
    
    -name: pet
    -description: Pets operations
    -
    -

    Examples Object

    -

    In an example, a JSON Reference MAY be used, with the -explicit restriction that examples having a JSON format with object named -$ref are not allowed. Therefore, that example, structurally, can be -either a string primitive or an object, similar to additionalProperties.

    -

    In all cases, the payload is expected to be compatible with the type schema -for the associated value. Tooling implementations MAY choose to -validate compatibility automatically, and reject the example value(s) if they -are incompatible.

    -
    
    -# in a model
    -schemas:
    -  properties:
    -    name:
    -      type: string
    -      example:
    -        $ref: http://foo.bar#/examples/name-example
    -
    -# in a request body, note the plural `examples`
    -  requestBody:
    -    content:
    -      'application/json':
    -        schema:
    -          $ref: '#/components/schemas/Address'
    -        examples:
    -          foo:
    -            value: {"foo": "bar"}
    -          bar:
    -            value: {"bar": "baz"}
    -      'application/xml':
    -        examples:
    -          xml:
    -            externalValue: 'http://foo.bar/examples/address-example.xml'
    -      'text/plain':
    -        examples:
    -          text:
    -            externalValue: 'http://foo.bar/examples/address-example.txt'
    -        
    -# in a parameter
    -  parameters:
    -    - name: 'zipCode'
    -      in: 'query'
    -      schema:
    -        type: 'string'
    -        format: 'zip-code'
    -        example: 
    -          $ref: 'http://foo.bar#/examples/zip-example'
    -
    -# in a response, note the singular `example`:
    -  responses:
    -    '200':
    -      description: your car appointment has been booked
    -      content: 
    -        application/json:
    -          schema:
    -            $ref: '#/components/schemas/SuccessResponse'
    -          example:
    -            $ref: http://foo.bar#/examples/address-example.json
    -
    -

    Reference Object

    -

    A simple object to allow referencing other components in the specification, internally and externally.

    -

    The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.

    -

    For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    $refstringREQUIRED. The reference string.
    -

    This object cannot be extended with additional properties and any properties added SHALL be ignored.

    -
    Reference Object Example
    -
    
    -{
    -	"$ref": "#/components/schemas/Pet"
    -}
    -
    -
    
    -$ref: '#/components/schemas/Pet'
    -
    -
    Relative Schema Document Example
    -
    
    -{
    -  "$ref": "Pet.json"
    -}
    -
    -
    
    -$ref: Pet.yaml
    -
    -
    Relative Documents With Embedded Schema Example
    -
    
    -{
    -  "$ref": "definitions.json#/Pet"
    -}
    -
    -
    
    -$ref: definitions.yaml#/Pet
    -
    -

    Schema Object

    -

    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 an extended subset of the JSON Schema Specification Wright Draft 00.

    -

    For more information about the properties, see JSON Schema Core and JSON Schema Validation. -Unless stated otherwise, the property definitions follow the JSON Schema.

    -
    Properties
    -

    The following properties are taken directly from the JSON Schema definition and follow the same specifications:

    -
      -
    • title
    • -
    • multipleOf
    • -
    • maximum
    • -
    • exclusiveMaximum
    • -
    • minimum
    • -
    • exclusiveMinimum
    • -
    • maxLength
    • -
    • minLength
    • -
    • pattern (This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect)
    • -
    • maxItems
    • -
    • minItems
    • -
    • uniqueItems
    • -
    • maxProperties
    • -
    • minProperties
    • -
    • required
    • -
    • enum
    • -
    -

    The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification.

    -
      -
    • type - Value MUST be a string. Multiple types via an array are not supported.
    • -
    • allOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • oneOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • anyOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • not - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. items MUST be present if the type is array.
    • -
    • properties - Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced).
    • -
    • additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • description - CommonMark syntax MAY be used for rich text representation.
    • -
    • format - See Data Type Formats for further details. While relying on JSON Schema’s defined formats, the OAS offers a few additional predefined formats.
    • -
    • default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if type is string, then default can be "foo" but cannot be 1.
    • -
    -

    Alternatively, any time a Schema Object can be used, a Reference Object can be used in its place. This allows referencing definitions instead of defining them inline.

    -

    Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported.

    -

    Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation:

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    nullablebooleanAllows sending a null value for the defined schema. Default value is false.
    discriminatorDiscriminator ObjectAdds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See Composition and Inheritance for more details.
    readOnlybooleanRelevant only for Schema "properties" definitions. Declares the property as “read only”. This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.
    writeOnlybooleanRelevant only for Schema "properties" definitions. Declares the property as “write only”. Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as writeOnly being true and is in the required list, the required will take effect on the request only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.
    xmlXML ObjectThis MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property.
    externalDocsExternal Documentation ObjectAdditional external documentation for this schema.
    exampleAnyA free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary.
    deprecatedbooleanSpecifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false.
    -

    This object MAY be extended with Specification Extensions.

    -
    Composition and Inheritance (Polymorphism)
    -

    The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. -allOf takes an array of object definitions that are validated independently but together compose a single object.

    -

    While composition offers model extensibility, it does not imply a hierarchy between the models. -To support polymorphism, the OpenAPI Specification adds the discriminator field. -When used, the discriminator will be the name of the property that decides which schema definition validates the structure of the model. -As such, the discriminator field MUST be a required field. -There are are two ways to define the value of a discriminator for an inheriting instance.

    -
      -
    • Use the schema name.
    • -
    • Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name. -As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism.
    • -
    -
    XML Modeling
    -

    The xml property allows extra definitions when translating the JSON definition to XML. -The XML Object contains additional information about the available options.

    -
    Schema Object Examples
    -
    Primitive Sample
    -
    
    -{
    -  "type": "string",
    -  "format": "email"
    -}
    -
    -
    
    -type: string
    -format: email
    -
    -
    Simple Model
    -
    
    -{
    -  "type": "object",
    -  "required": [
    -    "name"
    -  ],
    -  "properties": {
    -    "name": {
    -      "type": "string"
    -    },
    -    "address": {
    -      "$ref": "#/components/schemas/Address"
    -    },
    -    "age": {
    -      "type": "integer",
    -      "format": "int32",
    -      "minimum": 0
    -    }
    -  }
    -}
    -
    -
    
    -type: object
    -required:
    -- name
    -properties:
    -  name:
    -    type: string
    -  address:
    -    $ref: '#/components/schemas/Address'
    -  age:
    -    type: integer
    -    format: int32
    -    minimum: 0
    -
    -
    Model with Map/Dictionary Properties
    -

    For a simple string to string mapping:

    -
    
    -{
    -  "type": "object",
    -  "additionalProperties": {
    -    "type": "string"
    -  }
    -}
    -
    -
    
    -type: object
    -additionalProperties:
    -  type: string
    -
    -

    For a string to model mapping:

    -
    
    -{
    -  "type": "object",
    -  "additionalProperties": {
    -    "$ref": "#/components/schemas/ComplexModel"
    -  }
    -}
    -
    -
    
    -type: object
    -additionalProperties:
    -  $ref: '#/components/schemas/ComplexModel'
    -
    -
    Model with Example
    -
    
    -{
    -  "type": "object",
    -  "properties": {
    -    "id": {
    -      "type": "integer",
    -      "format": "int64"
    -    },
    -    "name": {
    -      "type": "string"
    -    }
    -  },
    -  "required": [
    -    "name"
    -  ],
    -  "example": {
    -    "name": "Puma",
    -    "id": 1
    -  }
    -}
    -
    -
    
    -type: object
    -properties:
    -  id:
    -    type: integer
    -    format: int64
    -  name:
    -    type: string
    -required:
    -- name
    -example:
    -  name: Puma
    -  id: 1
    -
    -
    Models with Composition
    -
    
    -{
    -  "components": {
    -    "schemas": {
    -      "ErrorModel": {
    -        "type": "object",
    -        "required": [
    -          "message",
    -          "code"
    -        ],
    -        "properties": {
    -          "message": {
    -            "type": "string"
    -          },
    -          "code": {
    -            "type": "integer",
    -            "minimum": 100,
    -            "maximum": 600
    -          }
    -        }
    -      },
    -      "ExtendedErrorModel": {
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/ErrorModel"
    -          },
    -          {
    -            "type": "object",
    -            "required": [
    -              "rootCause"
    -            ],
    -            "properties": {
    -              "rootCause": {
    -                "type": "string"
    -              }
    -            }
    -          }
    -        ]
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -components:
    -  schemas:
    -    ErrorModel:
    -      type: object
    -      required:
    -      - message
    -      - code
    -      properties:
    -        message:
    -          type: string
    -        code:
    -          type: integer
    -          minimum: 100
    -          maximum: 600
    -    ExtendedErrorModel:
    -      allOf:
    -      - $ref: '#/components/schemas/ErrorModel'
    -      - type: object
    -        required:
    -        - rootCause
    -        properties:
    -          rootCause:
    -            type: string
    -
    -
    Models with Polymorphism Support
    -
    
    -{
    -  "components": {
    -    "schemas": {
    -      "Pet": {
    -        "type": "object",
    -        "discriminator": {
    -          "propertyName": "petType"
    -        },
    -        "properties": {
    -          "name": {
    -            "type": "string"
    -          },
    -          "petType": {
    -            "type": "string"
    -          }
    -        },
    -        "required": [
    -          "name",
    -          "petType"
    -        ]
    -      },
    -      "Cat": {
    -        "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.",
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/Pet"
    -          },
    -          {
    -            "type": "object",
    -            "properties": {
    -              "huntingSkill": {
    -                "type": "string",
    -                "description": "The measured skill for hunting",
    -                "default": "lazy",
    -                "enum": [
    -                  "clueless",
    -                  "lazy",
    -                  "adventurous",
    -                  "aggressive"
    -                ]
    -              }
    -            },
    -            "required": [
    -              "huntingSkill"
    -            ]
    -          }
    -        ]
    -      },
    -      "Dog": {
    -        "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.",
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/Pet"
    -          },
    -          {
    -            "type": "object",
    -            "properties": {
    -              "packSize": {
    -                "type": "integer",
    -                "format": "int32",
    -                "description": "the size of the pack the dog is from",
    -                "default": 0,
    -                "minimum": 0
    -              }
    -            },
    -            "required": [
    -              "packSize"
    -            ]
    -          }
    -        ]
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -components:
    -  schemas:
    -    Pet:
    -      type: object
    -      discriminator:
    -        propertyName: petType
    -      properties:
    -        name:
    -          type: string
    -        petType:
    -          type: string
    -      required:
    -      - name
    -      - petType
    -    Cat:  ## "Cat" will be used as the discriminator value
    -      description: A representation of a cat
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        properties:
    -          huntingSkill:
    -            type: string
    -            description: The measured skill for hunting
    -            enum:
    -            - clueless
    -            - lazy
    -            - adventurous
    -            - aggressive
    -        required:
    -        - huntingSkill
    -    Dog:  ## "Dog" will be used as the discriminator value
    -      description: A representation of a dog
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        properties:
    -          packSize:
    -            type: integer
    -            format: int32
    -            description: the size of the pack the dog is from
    -            default: 0
    -            minimum: 0
    -        required:
    -        - packSize
    -
    -
    Discriminator Object
    -

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    -

    When using the discriminator, inline schemas will not be considered.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    propertyNamestringREQUIRED. The name of the property in the payload that will hold the discriminator value.
    mappingMap[string, string]An object to hold mappings between payload values and schema names or references.
    -

    The discriminator attribute is legal only when using one of the composite keywords oneOf, anyOf, allOf.

    -

    In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:

    -
    
    -MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -
    -

    which means the payload MUST, by validation, match exactly one of the schemas described by Cat, Dog, or Lizard. In this case, a discriminator MAY act as a “hint” to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use:

    -
    
    -MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -  discriminator:
    -    propertyName: pet_type
    -
    -

    The expectation now is that a property with name pet_type MUST be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload:

    -
    
    -{
    -  "id": 12345,
    -  "pet_type": "Cat"
    -}
    -
    -

    Will indicate that the Cat schema be used in conjunction with this payload.

    -

    In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional mapping definition MAY be used:

    -
    
    -MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -  - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json'
    -  discriminator:
    -    propertyName: pet_type
    -    mapping:
    -      dog: '#/components/schemas/Dog'
    -      monster: 'https://gigantic-server.com/schemas/Monster/schema.json'
    -
    -

    Here the discriminator value of dog will map to the schema #/components/schemas/Dog, rather than the default (implicit) value of Dog. If the discriminator value does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison.

    -

    When used in conjunction with the anyOf construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload.

    -

    In both the oneOf and anyOf use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an allOf construct may be used as an alternate schema.

    -

    For example:

    -
    
    -components:
    -  schemas:
    -    Pet:
    -      type: object
    -      required:
    -      - pet_type
    -      properties:
    -        pet_type:
    -          type: string
    -      discriminator:
    -        propertyName: pet_type
    -        mapping:
    -          cachorro: Dog
    -    Cat:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a `Cat`
    -        properties:
    -          name:
    -            type: string
    -    Dog:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a `Dog`
    -        properties:
    -          bark:
    -            type: string
    -    Lizard:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a `Lizard`
    -        properties:
    -          lovesRocks:
    -            type: boolean
    -
    -

    a payload like this:

    -
    
    -{
    -  "pet_type": "Cat",
    -  "name": "misty"
    -}
    -
    -

    will indicate that the Cat schema be used. Likewise this schema:

    -
    
    -{
    -  "pet_type": "cachorro",
    -  "bark": "soft"
    -}
    -
    -

    will map to Dog because of the definition in the mappings element.

    -

    XML Object

    -

    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.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringReplaces the name of the element/attribute used for the described schema property. When defined within 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.
    namespacestringThe URI of the namespace definition. Value MUST be in the form of an absolute URI.
    prefixstringThe prefix to be used for the name.
    attributebooleanDeclares whether the property definition translates to an attribute instead of an element. Default value is false.
    wrappedbooleanMAY 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).
    -

    This object MAY be extended with Specification Extensions.

    -
    XML Object Examples
    -

    The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

    -
    No XML Element
    -

    Basic string property:

    -
    
    -{
    -    "animals": {
    -        "type": "string"
    -    }
    -}
    -
    -
    
    -animals:
    -  type: string
    -
    -
    
    -<animals>...</animals>
    -
    -

    Basic string array property (wrapped is false by default):

    -
    
    -{
    -    "animals": {
    -        "type": "array",
    -        "items": {
    -            "type": "string"
    -        }
    -    }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -
    -
    
    -<animals>...</animals>
    -<animals>...</animals>
    -<animals>...</animals>
    -
    -
    XML Name Replacement
    -
    
    -{
    -  "animals": {
    -    "type": "string",
    -    "xml": {
    -      "name": "animal"
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: string
    -  xml:
    -    name: animal
    -
    -
    
    -<animal>...</animal>
    -
    -
    XML Attribute, Prefix and Namespace
    -

    In this example, a full model definition is shown.

    -
    
    -{
    -  "Person": {
    -    "type": "object",
    -    "properties": {
    -      "id": {
    -        "type": "integer",
    -        "format": "int32",
    -        "xml": {
    -          "attribute": true
    -        }
    -      },
    -      "name": {
    -        "type": "string",
    -        "xml": {
    -          "namespace": "http://example.com/schema/sample",
    -          "prefix": "sample"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -Person:
    -  type: object
    -  properties:
    -    id:
    -      type: integer
    -      format: int32
    -      xml:
    -        attribute: true
    -    name:
    -      type: string
    -      xml:
    -        namespace: http://example.com/schema/sample
    -        prefix: sample
    -
    -
    
    -<Person id="123">
    -    <sample:name xmlns:sample="http://example.com/schema/sample">example</sample:name>
    -</Person>
    -
    -
    XML Arrays
    -

    Changing the element names:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -
    -
    
    -<animal>value</animal>
    -<animal>value</animal>
    -
    -

    The external name property has no effect on the XML:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens"
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -
    -
    
    -<animal>value</animal>
    -<animal>value</animal>
    -
    -

    Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    wrapped: true
    -
    -
    
    -<animals>
    -  <animals>value</animals>
    -  <animals>value</animals>
    -</animals>
    -
    -

    To overcome the naming problem in the example above, the following definition can be used:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    wrapped: true
    -
    -
    
    -<animals>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</animals>
    -
    -

    Affecting both internal and external names:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    
    -<aliens>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</aliens>
    -
    -

    If we change the external element but not the internal ones:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    
    -<aliens>
    -  <aliens>value</aliens>
    -  <aliens>value</aliens>
    -</aliens>
    -
    -

    Security Scheme Object

    -

    Defines a security scheme that can be used by the operations. -Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [[!rfc6749]], and OpenID Connect Discovery.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeApplies ToDescription
    typestringAnyREQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "oauth2", "openIdConnect".
    descriptionstringAnyA short description for security scheme. CommonMark syntax MAY be used for rich text representation.
    namestringapiKeyREQUIRED. The name of the header, query or cookie parameter to be used.
    instringapiKeyREQUIRED. The location of the API key. Valid values are "query", "header" or "cookie".
    schemestringhttpREQUIRED. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235]section-5.1).
    bearerFormatstringhttp ("bearer")A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes.
    flowsOAuth Flows Objectoauth2REQUIRED. An object containing configuration information for the flow types supported.
    openIdConnectUrlstringopenIdConnectREQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL.
    -

    This object MAY be extended with Specification Extensions.

    -
    Security Scheme Object Example
    -
    Basic Authentication Sample
    -
    
    -{
    -  "type": "http",
    -  "scheme": "basic"
    -}
    -
    -
    
    -type: http
    -scheme: basic
    -
    -
    API Key Sample
    -
    
    -{
    -  "type": "apiKey",
    -  "name": "api_key",
    -  "in": "header"
    -}
    -
    -
    
    -type: apiKey
    -name: api_key
    -in: header
    -
    -
    JWT Bearer Sample
    -
    
    -{
    -  "type": "http",
    -  "scheme": "bearer",
    -  "bearerFormat": "JWT",
    -}
    -
    -
    
    -type: http
    -scheme: bearer
    -bearerFormat: JWT
    -
    -
    Implicit OAuth2 Sample
    -
    
    -{
    -  "type": "oauth2",
    -  "flows": {
    -    "implicit": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -type: oauth2
    -flows: 
    -  implicit:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets
    -
    -

    OAuth Flows Object

    -

    Allows configuration of the supported OAuth Flows.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    implicitOAuth Flow ObjectConfiguration for the OAuth Implicit flow
    passwordOAuth Flow ObjectConfiguration for the OAuth Resource Owner Password flow
    clientCredentialsOAuth Flow ObjectConfiguration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0.
    authorizationCodeOAuth Flow ObjectConfiguration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.
    -

    This object MAY be extended with Specification Extensions.

    -

    OAuth Flow Object

    -

    Configuration details for a supported OAuth Flow

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeApplies ToDescription
    authorizationUrlstringoauth2 ("implicit", "authorizationCode")REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL.
    tokenUrlstringoauth2 ("password", "clientCredentials", "authorizationCode")REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL.
    refreshUrlstringoauth2The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.
    scopesMap[string, string]oauth2REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it.
    -

    This object MAY be extended with Specification Extensions.

    -
    OAuth Flow Object Examples
    -
    
    -{
    -  "type": "oauth2",
    -  "flows": {
    -    "implicit": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    },
    -    "authorizationCode": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "tokenUrl": "https://example.com/api/oauth/token",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -type: oauth2
    -flows: 
    -  implicit:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets
    -  authorizationCode:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    tokenUrl: https://example.com/api/oauth/token
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets 
    -
    -

    Security Requirement Object

    -

    Lists the required security schemes to execute this operation. -The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.

    -

    Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. -This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.

    -

    When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}[string]Each name MUST correspond to a security scheme which is declared in the Security Schemes under the Components Object. If the security scheme is of type "oauth2" or "openIdConnect", then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty.
    -
    Security Requirement Object Examples
    -
    Non-OAuth2 Security Requirement
    -
    
    -{
    -  "api_key": []
    -}
    -
    -
    
    -api_key: []
    -
    -
    OAuth2 Security Requirement
    -
    
    -{
    -  "petstore_auth": [
    -    "write:pets",
    -    "read:pets"
    -  ]
    -}
    -
    -
    
    -petstore_auth:
    -- write:pets
    -- read:pets
    -
    -

    Specification Extensions

    -

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    -

    The extensions properties are implemented as patterned fields that are always prefixed by "x-".

    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the OpenAPI Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. 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).

    -

    Security Filtering

    -

    Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.

    -

    The reasoning is to allow an additional layer of access control over the documentation. -While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.

    -

    Two examples of this:

    -
      -
    1. The Paths Object MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication.
    2. -
    3. The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object, so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see.
    4. -
    -

    Appendix A: Revision History

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    VersionDateNotes
    3.0.02017-07-26Release of the OpenAPI Specification 3.0.0
    3.0.0-rc22017-06-16rc2 of the 3.0 specification
    3.0.0-rc12017-04-27rc1 of the 3.0 specification
    3.0.0-rc02017-02-28Implementer’s Draft of the 3.0 specification
    2.02015-12-31Donation of Swagger 2.0 to the Open API Initiative
    2.02014-09-08Release of Swagger 2.0
    1.22014-03-14Initial release of the formal document.
    1.12012-08-22Release of Swagger 1.1
    1.02011-08-10First release of the Swagger Specification
    - diff --git a/scripts/md2html/v3/3.0.1.bs b/scripts/md2html/v3/3.0.1.bs deleted file mode 100644 index c9d4017233..0000000000 --- a/scripts/md2html/v3/3.0.1.bs +++ /dev/null @@ -1,4031 +0,0 @@ -OpenAPI Specification -

    OpenAPI Specification

    -

    Version 3.0.1

    -

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [[!rfc2119]] [[!rfc8174]] when, and only when, they appear in all capitals, as shown here.

    -

    This document is licensed under The Apache License, Version 2.0.

    -

    Introduction

    -

    The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.

    -

    An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.

    - -

    Definitions

    -

    OpenAPI Document

    -

    A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification.

    -

    Path Templating

    -

    Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters.

    -

    Media Types

    -

    Media type definitions are spread across several resources. -The media type definitions SHOULD be in compliance with [[!rfc6838]].

    -

    Some examples of possible media type definitions:

    -
    
    -  text/plain; charset=utf-8
    -  application/json
    -  application/vnd.github+json
    -  application/vnd.github.v3+json
    -  application/vnd.github.v3.raw+json
    -  application/vnd.github.v3.text+json
    -  application/vnd.github.v3.html+json
    -  application/vnd.github.v3.full+json
    -  application/vnd.github.v3.diff
    -  application/vnd.github.v3.patch
    -
    -

    HTTP Status Codes

    -

    The HTTP Status Codes are used to indicate the status of the executed operation. -The available status codes are defined by [[!rfc7231]]section-6) and registered status codes are listed in the IANA Status Code Registry.

    -

    Specification

    -

    Versions

    -

    The OpenAPI Specification is versioned using Semantic Versioning 2.0.0 (semver) and follows the semver specification.

    -

    The major.minor portion of the semver (for example 3.0) SHALL designate the OAS feature set. Typically, .patch versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between 3.0.0 and 3.0.1 for example.

    -

    Subsequent minor version releases of the OpenAPI Specification (incrementing the minor version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical 3.1.0 specification SHOULD be usable with tooling designed for 3.0.0.

    -

    An OpenAPI document compatible with OAS 3.*.* contains a required openapi field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named swagger and value "2.0".)

    -

    Format

    -

    An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format.

    -

    For example, if a field has an array value, the JSON array representation will be used:

    -
    
    -{
    -   "field": [ 1, 2, 3 ]
    -}
    -
    -

    All field names in the specification are case sensitive.

    -

    The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name.

    -

    Patterned fields MUST have unique names within the containing object.

    -

    In order to preserve the ability to round-trip between YAML and JSON formats, YAML version 1.2 is RECOMMENDED along with some additional constraints:

    - -

    Note: While APIs may be defined by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML.

    -

    Document Structure

    -

    An OpenAPI document MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the user. In the latter case, $ref fields MUST be used in the specification to reference those parts as follows from the JSON Schema definitions.

    -

    It is RECOMMENDED that the root OpenAPI document be named: openapi.json or openapi.yaml.

    -

    Data Types

    -

    Primitive data types in the OAS are based on the types supported by the JSON Schema Specification Wright Draft 00. -Note that integer as a type is also supported and is defined as a JSON number without a fraction or exponent part. -null is not supported as a type (see nullable for an alternative solution). -Models are defined using the Schema Object, which is an extended subset of JSON Schema Specification Wright Draft 00.

    -

    Primitives have an optional modifier property: format. -OAS uses several known formats to define in fine detail the data type being used. -However, to support documentation needs, the format property is an open string-valued property, and can have any value. -Formats such as "email", "uuid", and so on, MAY be used even though undefined by this specification. -Types that are not accompanied by a format property follow the type definition in the JSON Schema. Tools that do not recognize a specific format MAY default back to the type alone, as if the format is not specified.

    -

    The formats defined by the OAS are:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Common NametypeformatComments
    integerintegerint32signed 32 bits
    longintegerint64signed 64 bits
    floatnumberfloat
    doublenumberdouble
    stringstring
    bytestringbytebase64 encoded characters
    binarystringbinaryany sequence of octets
    booleanboolean
    datestringdateAs defined by full-date - [!rfc3339]
    dateTimestringdate-timeAs defined by date-time - [!rfc3339]
    passwordstringpasswordA hint to UIs to obscure input.
    -

    Rich Text Formatting

    -

    Throughout the specification description fields are noted as supporting CommonMark markdown formatting. -Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by CommonMark 0.27. Tooling MAY choose to ignore some CommonMark features to address security concerns.

    -

    Relative References in URLs

    -

    Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [[!rfc3986]]section-4.2). -Relative references are resolved using the URLs defined in the Server Object as a Base URI.

    -

    Relative references used in $ref are processed as per JSON Reference, using the URL of the current document as the base URI. See also the Reference Object.

    -

    Schema

    -

    In the following description, if a field is not explicitly REQUIRED or described with a MUST or SHALL, it can be considered OPTIONAL.

    -

    OpenAPI Object

    -

    This is the root document object of the OpenAPI document.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    openapistringREQUIRED. This string MUST be the semantic version number of the OpenAPI Specification version that the OpenAPI document uses. The openapi field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is not related to the API info.version string.
    infoInfo ObjectREQUIRED. Provides metadata about the API. The metadata MAY be used by tooling as required.
    servers[Server Object]An array of Server Objects, which provide connectivity information to a target server. If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url value of /.
    pathsPaths ObjectREQUIRED. The available paths and operations for the API.
    componentsComponents ObjectAn element to hold various schemas for the specification.
    security[Security Requirement Object]A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition.
    tags[Tag Object]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.
    externalDocsExternal Documentation ObjectAdditional external documentation.
    -

    This object MAY be extended with Specification Extensions.

    -

    Info Object

    -

    The object provides metadata about the API. -The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    titlestringREQUIRED. The title of the application.
    descriptionstringA short description of the application. CommonMark syntax MAY be used for rich text representation.
    termsOfServicestringA URL to the Terms of Service for the API. MUST be in the format of a URL.
    contactContact ObjectThe contact information for the exposed API.
    licenseLicense ObjectThe license information for the exposed API.
    versionstringREQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version).
    -

    This object MAY be extended with Specification Extensions.

    -
    Info Object Example:
    -
    
    -{
    -  "title": "Sample Pet Store App",
    -  "description": "This is a sample server for a pet store.",
    -  "termsOfService": "http://example.com/terms/",
    -  "contact": {
    -    "name": "API Support",
    -    "url": "http://www.example.com/support",
    -    "email": "support@example.com"
    -  },
    -  "license": {
    -    "name": "Apache 2.0",
    -    "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    -  },
    -  "version": "1.0.1"
    -}
    -
    -
    
    -title: Sample Pet Store App
    -description: This is a sample server for a pet store.
    -termsOfService: http://example.com/terms/
    -contact:
    -  name: API Support
    -  url: http://www.example.com/support
    -  email: support@example.com
    -license:
    -  name: Apache 2.0
    -  url: https://www.apache.org/licenses/LICENSE-2.0.html
    -version: 1.0.1
    -
    -

    Contact Object

    -

    Contact information for the exposed API.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringThe identifying name of the contact person/organization.
    urlstringThe URL pointing to the contact information. MUST be in the format of a URL.
    emailstringThe email address of the contact person/organization. MUST be in the format of an email address.
    -

    This object MAY be extended with Specification Extensions.

    -
    Contact Object Example:
    -
    
    -{
    -  "name": "API Support",
    -  "url": "http://www.example.com/support",
    -  "email": "support@example.com"
    -}
    -
    -
    
    -name: API Support
    -url: http://www.example.com/support
    -email: support@example.com
    -
    -

    License Object

    -

    License information for the exposed API.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringREQUIRED. The license name used for the API.
    urlstringA URL to the license used for the API. MUST be in the format of a URL.
    -

    This object MAY be extended with Specification Extensions.

    -
    License Object Example:
    -
    
    -{
    -  "name": "Apache 2.0",
    -  "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    -}
    -
    -
    
    -name: Apache 2.0
    -url: https://www.apache.org/licenses/LICENSE-2.0.html
    -
    -

    Server Object

    -

    An object representing a Server.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    urlstringREQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in {brackets}.
    descriptionstringAn optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation.
    variablesMap[string, Server Variable Object]A map between a variable name and its value. The value is used for substitution in the server’s URL template.
    -

    This object MAY be extended with Specification Extensions.

    -
    Server Object Example
    -

    A single server would be described as:

    -
    
    -{
    -  "url": "https://development.gigantic-server.com/v1",
    -  "description": "Development server"
    -}
    -
    -
    
    -url: https://development.gigantic-server.com/v1
    -description: Development server
    -
    -

    The following shows how multiple servers can be described, for example, at the OpenAPI Object’s servers:

    -
    
    -{
    -  "servers": [
    -    {
    -      "url": "https://development.gigantic-server.com/v1",
    -      "description": "Development server"
    -    },
    -    {
    -      "url": "https://staging.gigantic-server.com/v1",
    -      "description": "Staging server"
    -    },
    -    {
    -      "url": "https://api.gigantic-server.com/v1",
    -      "description": "Production server"
    -    }
    -  ]
    -}
    -
    -
    
    -servers:
    -- url: https://development.gigantic-server.com/v1
    -  description: Development server
    -- url: https://staging.gigantic-server.com/v1
    -  description: Staging server
    -- url: https://api.gigantic-server.com/v1
    -  description: Production server
    -
    -

    The following shows how variables can be used for a server configuration:

    -
    
    -{
    -  "servers": [
    -    {
    -      "url": "https://{username}.gigantic-server.com:{port}/{basePath}",
    -      "description": "The production API server",
    -      "variables": {
    -        "username": {
    -          "default": "demo",
    -          "description": "this value is assigned by the service provider, in this example `gigantic-server.com`"
    -        },
    -        "port": {
    -          "enum": [
    -            "8443",
    -            "443"
    -          ],
    -          "default": "8443"
    -        },
    -        "basePath": {
    -          "default": "v2"
    -        }
    -      }
    -    }
    -  ]
    -}
    -
    -
    
    -servers:
    -- url: https://{username}.gigantic-server.com:{port}/{basePath}
    -  description: The production API server
    -  variables:
    -    username:
    -      # note! no enum here means it is an open value
    -      default: demo
    -      description: this value is assigned by the service provider, in this example `gigantic-server.com`
    -    port:
    -      enum:
    -        - '8443'
    -        - '443'
    -      default: '8443'
    -    basePath:
    -      # open meaning there is the opportunity to use special base paths as assigned by the provider, default is `v2`
    -      default: v2
    -
    -

    Server Variable Object

    -

    An object representing a Server Variable for server URL template substitution.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    enum[string]An enumeration of string values to be used if the substitution options are from a limited set.
    defaultstringREQUIRED. The default value to use for substitution, and to send, if an alternate value is not supplied. Unlike the Schema Object’s default, this value MUST be provided by the consumer.
    descriptionstringAn optional description for the server variable. CommonMark syntax MAY be used for rich text representation.
    -

    This object MAY be extended with Specification Extensions.

    -

    Components Object

    -

    Holds a set of reusable objects for different aspects of the OAS. -All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    schemasMap[string, Schema Object ¦ Reference Object]An object to hold reusable Schema Objects.
    responsesMap[string, Response Object ¦ Reference Object]An object to hold reusable Response Objects.
    parametersMap[string, Parameter Object ¦ Reference Object]An object to hold reusable Parameter Objects.
    examplesMap[string, Example Object ¦ Reference Object]An object to hold reusable Example Objects.
    requestBodiesMap[string, Request Body Object ¦ Reference Object]An object to hold reusable Request Body Objects.
    headersMap[string, Header Object ¦ Reference Object]An object to hold reusable Header Objects.
    securitySchemesMap[string, Security Scheme Object ¦ Reference Object]An object to hold reusable Security Scheme Objects.
    linksMap[string, Link Object ¦ Reference Object]An object to hold reusable Link Objects.
    callbacksMap[string, Callback Object ¦ Reference Object]An object to hold reusable Callback Objects.
    -

    This object MAY be extended with Specification Extensions.

    -

    All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9\.\-_]+$.

    -

    Field Name Examples:

    -
    
    -User
    -User_1
    -User_Name
    -user-name
    -my.org.User
    -
    -
    Components Object Example
    -
    
    -"components": {
    -  "schemas": {
    -    "Category": {
    -      "type": "object",
    -      "properties": {
    -        "id": {
    -          "type": "integer",
    -          "format": "int64"
    -        },
    -        "name": {
    -          "type": "string"
    -        }
    -      }
    -    },
    -    "Tag": {
    -      "type": "object",
    -      "properties": {
    -        "id": {
    -          "type": "integer",
    -          "format": "int64"
    -        },
    -        "name": {
    -          "type": "string"
    -        }
    -      }
    -    }
    -  },
    -  "parameters": {
    -    "skipParam": {
    -      "name": "skip",
    -      "in": "query",
    -      "description": "number of items to skip",
    -      "required": true,
    -      "schema": {
    -        "type": "integer",
    -        "format": "int32"
    -      }
    -    },
    -    "limitParam": {
    -      "name": "limit",
    -      "in": "query",
    -      "description": "max records to return",
    -      "required": true,
    -      "schema" : {
    -        "type": "integer",
    -        "format": "int32"
    -      }
    -    }
    -  },
    -  "responses": {
    -    "NotFound": {
    -      "description": "Entity not found."
    -    },
    -    "IllegalInput": {
    -      "description": "Illegal input for operation."
    -    },
    -    "GeneralError": {
    -      "description": "General Error",
    -      "content": {
    -        "application/json": {
    -          "schema": {
    -            "$ref": "#/components/schemas/GeneralError"
    -          }
    -        }
    -      }
    -    }
    -  },
    -  "securitySchemes": {
    -    "api_key": {
    -      "type": "apiKey",
    -      "name": "api_key",
    -      "in": "header"
    -    },
    -    "petstore_auth": {
    -      "type": "oauth2",
    -      "flows": {
    -        "implicit": {
    -          "authorizationUrl": "http://example.org/api/oauth/dialog",
    -          "scopes": {
    -            "write:pets": "modify pets in your account",
    -            "read:pets": "read your pets"
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -components:
    -  schemas:
    -    Category:
    -      type: object
    -      properties:
    -        id:
    -          type: integer
    -          format: int64
    -        name:
    -          type: string
    -    Tag:
    -      type: object
    -      properties:
    -        id:
    -          type: integer
    -          format: int64
    -        name:
    -          type: string
    -  parameters:
    -    skipParam:
    -      name: skip
    -      in: query
    -      description: number of items to skip
    -      required: true
    -      schema:
    -        type: integer
    -        format: int32
    -    limitParam:
    -      name: limit
    -      in: query
    -      description: max records to return
    -      required: true
    -      schema:
    -        type: integer
    -        format: int32
    -  responses:
    -    NotFound:
    -      description: Entity not found.
    -    IllegalInput:
    -      description: Illegal input for operation.
    -    GeneralError:
    -      description: General Error
    -      content:
    -        application/json:
    -          schema:
    -            $ref: '#/components/schemas/GeneralError'
    -  securitySchemes:
    -    api_key:
    -      type: apiKey
    -      name: api_key
    -      in: header
    -    petstore_auth:
    -      type: oauth2
    -      flows: 
    -        implicit:
    -          authorizationUrl: http://example.org/api/oauth/dialog
    -          scopes:
    -            write:pets: modify pets in your account
    -            read:pets: read your pets
    -
    -

    Paths Object

    -

    Holds the relative paths to the individual endpoints and their operations. -The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    /{path}Path Item ObjectA relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended (no relative URL resolution) to the expanded URL from the Server Object's url field in order to construct the full URL. Path templating is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it’s up to the tooling to decide which one to use.
    -

    This object MAY be extended with Specification Extensions.

    -
    Path Templating Matching
    -

    Assuming the following paths, the concrete definition, /pets/mine, will be matched first if used:

    -
    
    -  /pets/{petId}
    -  /pets/mine
    -
    -

    The following paths are considered identical and invalid:

    -
    
    -  /pets/{petId}
    -  /pets/{name}
    -
    -

    The following may lead to ambiguous resolution:

    -
    
    -  /{entity}/me
    -  /books/{id}
    -
    -
    Paths Object Example
    -
    
    -{
    -  "/pets": {
    -    "get": {
    -      "description": "Returns all pets from the system that the user has access to",
    -      "responses": {
    -        "200": {          
    -          "description": "A list of pets.",
    -          "content": {
    -            "application/json": {
    -              "schema": {
    -                "type": "array",
    -                "items": {
    -                  "$ref": "#/components/schemas/pet"
    -                }
    -              }
    -            }
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -/pets:
    -  get:
    -    description: Returns all pets from the system that the user has access to
    -    responses:
    -      '200':
    -        description: A list of pets.
    -        content:
    -          application/json:
    -            schema:
    -              type: array
    -              items:
    -                $ref: '#/components/schemas/pet'
    -
    -

    Path Item Object

    -

    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.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    $refstringAllows 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.
    summarystringAn optional, string summary, intended to apply to all operations in this path.
    descriptionstringAn optional, string description, intended to apply to all operations in this path. CommonMark syntax MAY be used for rich text representation.
    getOperation ObjectA definition of a GET operation on this path.
    putOperation ObjectA definition of a PUT operation on this path.
    postOperation ObjectA definition of a POST operation on this path.
    deleteOperation ObjectA definition of a DELETE operation on this path.
    optionsOperation ObjectA definition of a OPTIONS operation on this path.
    headOperation ObjectA definition of a HEAD operation on this path.
    patchOperation ObjectA definition of a PATCH operation on this path.
    traceOperation ObjectA definition of a TRACE operation on this path.
    servers[Server Object]An alternative server array to service all operations in this path.
    parameters[Parameter Object ¦ Reference Object]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 OpenAPI Object’s components/parameters.
    -

    This object MAY be extended with Specification Extensions.

    -
    Path Item Object Example
    -
    
    -{
    -  "get": {
    -    "description": "Returns pets based on ID",
    -    "summary": "Find pets by ID",
    -    "operationId": "getPetsById",
    -    "responses": {
    -      "200": {
    -        "description": "pet response",
    -        "content": {
    -          "*/*": {
    -            "schema": {
    -              "type": "array",
    -              "items": {
    -                "$ref": "#/components/schemas/Pet"
    -              }
    -            }
    -          }
    -        }
    -      },
    -      "default": {
    -        "description": "error payload",
    -        "content": {
    -          "text/html": {
    -            "schema": {
    -              "$ref": "#/components/schemas/ErrorModel"
    -            }
    -          }
    -        }
    -      }
    -    }
    -  },
    -  "parameters": [
    -    {
    -      "name": "id",
    -      "in": "path",
    -      "description": "ID of pet to use",
    -      "required": true,
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "type": "string"
    -        }
    -      },
    -      "style": "simple"
    -    }
    -  ]
    -}
    -
    -
    
    -get:
    -  description: Returns pets based on ID
    -  summary: Find pets by ID
    -  operationId: getPetsById
    -  responses:
    -    '200':
    -      description: pet response
    -      content:
    -        '*/*' :
    -          schema:
    -            type: array
    -            items:
    -              $ref: '#/components/schemas/Pet'
    -    default:
    -      description: error payload
    -      content:
    -        'text/html':
    -          schema:
    -            $ref: '#/components/schemas/ErrorModel'
    -parameters:
    -- name: id
    -  in: path
    -  description: ID of pet to use
    -  required: true
    -  schema:
    -    type: array
    -    style: simple
    -    items:
    -      type: string  
    -
    -

    Operation Object

    -

    Describes a single API operation on a path.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    tags[string]A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
    summarystringA short summary of what the operation does.
    descriptionstringA verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation.
    externalDocsExternal Documentation ObjectAdditional external documentation for this operation.
    operationIdstringUnique 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[Parameter Object ¦ Reference Object]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 OpenAPI Object’s components/parameters.
    requestBodyRequest Body Object ¦ Reference ObjectThe request body applicable for this operation. The requestBody is only supported in HTTP methods where the HTTP 1.1 specification [[!rfc7231]]section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers.
    responsesResponses ObjectREQUIRED. The list of possible responses as they are returned from executing this operation.
    callbacksMap[string, Callback Object ¦ Reference Object]A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
    deprecatedbooleanDeclares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is false.
    security[Security Requirement Object]A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used.
    servers[Server Object]An alternative server array to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value.
    -

    This object MAY be extended with Specification Extensions.

    -
    Operation Object Example
    -
    
    -{
    -  "tags": [
    -    "pet"
    -  ],
    -  "summary": "Updates a pet in the store with form data",
    -  "operationId": "updatePetWithForm",
    -  "parameters": [
    -    {
    -      "name": "petId",
    -      "in": "path",
    -      "description": "ID of pet that needs to be updated",
    -      "required": true,
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  ],
    -  "requestBody": {
    -    "content": {
    -      "application/x-www-form-urlencoded": {
    -        "schema": {
    -          "type": "object",
    -           "properties": {
    -              "name": { 
    -                "description": "Updated name of the pet",
    -                "type": "string"
    -              },
    -              "status": {
    -                "description": "Updated status of the pet",
    -                "type": "string"
    -             }
    -           },
    -        "required": ["status"] 
    -        }
    -      }
    -    }
    -  },
    -  "responses": {
    -    "200": {
    -      "description": "Pet updated.",
    -      "content": {
    -        "application/json": {},
    -        "application/xml": {}
    -      }
    -    },
    -    "405": {
    -      "description": "Invalid input",
    -      "content": {
    -        "application/json": {},
    -        "application/xml": {}
    -      }
    -    }
    -  },
    -  "security": [
    -    {
    -      "petstore_auth": [
    -        "write:pets",
    -        "read:pets"
    -      ]
    -    }
    -  ]
    -}
    -
    -
    
    -tags:
    -- pet
    -summary: Updates a pet in the store with form data
    -operationId: updatePetWithForm
    -parameters:
    -- name: petId
    -  in: path
    -  description: ID of pet that needs to be updated
    -  required: true
    -  schema:
    -    type: string
    -requestBody:
    -  content:
    -    'application/x-www-form-urlencoded':
    -      schema:
    -       properties:
    -          name: 
    -            description: Updated name of the pet
    -            type: string
    -          status:
    -            description: Updated status of the pet
    -            type: string
    -       required:
    -         - status
    -responses:
    -  '200':
    -    description: Pet updated.
    -    content: 
    -      'application/json': {}
    -      'application/xml': {}
    -  '405':
    -    description: Invalid input
    -    content: 
    -      'application/json': {}
    -      'application/xml': {}
    -security:
    -- petstore_auth:
    -  - write:pets
    -  - read:pets
    -
    -

    External Documentation Object

    -

    Allows referencing an external resource for extended documentation.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringA short description of the target documentation. CommonMark syntax MAY be used for rich text representation.
    urlstringREQUIRED. The URL for the target documentation. Value MUST be in the format of a URL.
    -

    This object MAY be extended with Specification Extensions.

    -
    External Documentation Object Example
    -
    
    -{
    -  "description": "Find more info here",
    -  "url": "https://example.com"
    -}
    -
    -
    
    -description: Find more info here
    -url: https://example.com
    -
    -

    Parameter Object

    -

    Describes a single operation parameter.

    -

    A unique parameter is defined by a combination of a name and location.

    -
    Parameter Locations
    -

    There are four possible parameter locations specified by the in field:

    -
      -
    • path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId.
    • -
    • query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id.
    • -
    • header - Custom headers that are expected as part of the request. Note that [[!rfc7230]]page-22) states header names are case insensitive.
    • -
    • cookie - Used to pass a specific cookie value to the API.
    • -
    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringREQUIRED. 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.
    • If in is "header" and the name field is "Accept", "Content-Type" or "Authorization", the parameter definition SHALL be ignored.
    • For all other cases, the name corresponds to the parameter name used by the in property.
    instringREQUIRED. The location of the parameter. Possible values are “query”, “header”, “path” or “cookie”.
    descriptionstringA brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
    requiredbooleanDetermines whether this parameter is mandatory. If the parameter location is “path”, this property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and its default value is false.
    deprecatedbooleanSpecifies that a parameter is deprecated and SHOULD be transitioned out of usage.
    allowEmptyValuebooleanSets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored.
    -

    The rules for serialization of the parameter are specified in one of two ways. -For simpler scenarios, a schema and style can describe the structure and syntax of the parameter.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    stylestringDescribes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form.
    explodebooleanWhen this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false.
    allowReservedbooleanDetermines whether the parameter value SHOULD allow reserved characters, as defined by [[!rfc3986]]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false.
    schemaSchema Object ¦ Reference ObjectThe schema defining the type used for the parameter.
    exampleAnyExample of the media type. The example SHOULD match the specified schema and encoding properties if present. The example field is mutually exclusive of the examples field. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.
    examplesMap[ string, Example Object ¦ Reference Object]Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The examples field is mutually exclusive of the example field. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema.
    -

    For more complex scenarios, the content property can define the media type and schema of the parameter. -A parameter MUST contain either a schema property, or a content property, but not both. -When example or examples are provided in conjunction with the schema object, the example MUST follow the prescribed serialization strategy for the parameter.

    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    contentMap[string, Media Type Object]A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.
    -
    Style Values
    -

    In order to support common ways of serializing simple parameters, a set of style values are defined.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    styletypeinComments
    matrixprimitive, array, objectpathPath-style parameters defined by [[!rfc6570]]section-3.2.7)
    labelprimitive, array, objectpathLabel style parameters defined by [[!rfc6570]]section-3.2.5)
    formprimitive, array, objectquery, cookieForm style parameters defined by [[!rfc6570]]section-3.2.8). This option replaces collectionFormat with a csv (when explode is false) or multi (when explode is true) value from OpenAPI 2.0.
    simplearraypath, headerSimple style parameters defined by [[!rfc6570]]section-3.2.2). This option replaces collectionFormat with a csv value from OpenAPI 2.0.
    spaceDelimitedarrayquerySpace separated array values. This option replaces collectionFormat equal to ssv from OpenAPI 2.0.
    pipeDelimitedarrayqueryPipe separated array values. This option replaces collectionFormat equal to pipes from OpenAPI 2.0.
    deepObjectobjectqueryProvides a simple way of rendering nested objects using form parameters.
    -
    Style Examples
    -

    Assume a parameter named color has one of the following values:

    -
    
    -   string -> "blue"
    -   array -> ["blue","black","brown"]
    -   object -> { "R": 100, "G": 200, "B": 150 }
    -
    -

    The following table shows examples of rendering differences for each value.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    styleexplodeemptystringarrayobject
    matrixfalse;color;color=blue;color=blue,black,brown;color=R,100,G,200,B,150
    matrixtrue;color;color=blue;color=blue;color=black;color=brown;R=100;G=200;B=150
    labelfalse..blue.blue.black.brown.R.100.G.200.B.150
    labeltrue..blue.blue.black.brown.R=100.G=200.B=150
    formfalsecolor=color=bluecolor=blue,black,browncolor=R,100,G,200,B,150
    formtruecolor=color=bluecolor=blue&color=black&color=brownR=100&G=200&B=150
    simplefalsen/ablueblue,black,brownR,100,G,200,B,150
    simpletruen/ablueblue,black,brownR=100,G=200,B=150
    spaceDelimitedfalsen/an/ablue%20black%20brownR%20100%20G%20200%20B%20150
    pipeDelimitedfalsen/an/ablue¦black¦brownR¦100¦G¦200
    deepObjecttruen/an/an/acolor\R=100&color\G=200&color\B=150
    -

    This object MAY be extended with Specification Extensions.

    -
    Parameter Object Examples
    -

    A header parameter with an array of 64 bit integer numbers:

    -
    
    -{
    -  "name": "token",
    -  "in": "header",
    -  "description": "token to be passed as a header",
    -  "required": true,
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "type": "integer",
    -      "format": "int64"
    -    }
    -  },
    -  "style": "simple"
    -}
    -
    -
    
    -name: token
    -in: header
    -description: token to be passed as a header
    -required: true
    -schema:
    -  type: array
    -  items:
    -    type: integer
    -    format: int64
    -style: simple
    -
    -

    A path parameter of a string value:

    -
    
    -{
    -  "name": "username",
    -  "in": "path",
    -  "description": "username to fetch",
    -  "required": true,
    -  "schema": {
    -    "type": "string"
    -  }
    -}
    -
    -
    
    -name: username
    -in: path
    -description: username to fetch
    -required: true
    -schema:
    -  type: string
    -
    -

    An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

    -
    
    -{
    -  "name": "id",
    -  "in": "query",
    -  "description": "ID of the object to fetch",
    -  "required": false,
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    }
    -  },
    -  "style": "form",
    -  "explode": true
    -}
    -
    -
    
    -name: id
    -in: query
    -description: ID of the object to fetch
    -required: false
    -schema:
    -  type: array
    -  items:
    -    type: string
    -style: form
    -explode: true
    -
    -

    A free-form query parameter, allowing undefined parameters of a specific type:

    -
    
    -{
    -  "in": "query",
    -  "name": "freeForm",
    -  "schema": {
    -    "type": "object",
    -    "additionalProperties": {
    -      "type": "integer"
    -    },
    -  },
    -  "style": "form"
    -}
    -
    -
    
    -in: query
    -name: freeForm
    -schema:
    -  type: object
    -  additionalProperties:
    -    type: integer
    -style: form
    -
    -

    A complex parameter using content to define serialization:

    -
    
    -{
    -  "in": "query",
    -  "name": "coordinates",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "type": "object",
    -        "required": [
    -          "lat",
    -          "long"
    -        ],
    -        "properties": {
    -          "lat": {
    -            "type": "number"
    -          },
    -          "long": {
    -            "type": "number"
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -in: query
    -name: coordinates
    -content:
    -  application/json:
    -    schema:
    -      type: object
    -      required:
    -        - lat
    -        - long
    -      properties:
    -        lat:
    -          type: number
    -        long:
    -          type: number
    -
    -

    Request Body Object

    -

    Describes a single request body.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringA brief description of the request body. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
    contentMap[string, Media Type Object]REQUIRED. The content of the request body. The key is a media type or [media type range]appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
    requiredbooleanDetermines if the request body is required in the request. Defaults to false.
    -

    This object MAY be extended with Specification Extensions.

    -
    Request Body Examples
    -

    A request body with a referenced model definition.

    -
    
    -{
    -  "description": "user to add to the system",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "$ref": "#/components/schemas/User"
    -      },
    -      "examples": {
    -          "user" : {
    -            "summary": "User Example", 
    -            "externalValue": "http://foo.bar/examples/user-example.json"
    -          } 
    -        }
    -    },
    -    "application/xml": {
    -      "schema": {
    -        "$ref": "#/components/schemas/User"
    -      },
    -      "examples": {
    -          "user" : {
    -            "summary": "User example in XML",
    -            "externalValue": "http://foo.bar/examples/user-example.xml"
    -          }
    -        }
    -    },
    -    "text/plain": {
    -      "examples": {
    -        "user" : {
    -            "summary": "User example in Plain text",
    -            "externalValue": "http://foo.bar/examples/user-example.txt" 
    -        }
    -      } 
    -    },
    -    "*/*": {
    -      "examples": {
    -        "user" : {
    -            "summary": "User example in other format",
    -            "externalValue": "http://foo.bar/examples/user-example.whatever"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -description: user to add to the system
    -content: 
    -  'application/json':
    -    schema:
    -      $ref: '#/components/schemas/User'
    -    examples:
    -      user:
    -        summary: User Example
    -        externalValue: 'http://foo.bar/examples/user-example.json'
    -  'application/xml':
    -    schema:
    -      $ref: '#/components/schemas/User'
    -    examples:
    -      user:
    -        summary: User Example in XML
    -        externalValue: 'http://foo.bar/examples/user-example.xml'
    -  'text/plain':
    -    examples:
    -      user:
    -        summary: User example in text plain format
    -        externalValue: 'http://foo.bar/examples/user-example.txt'
    -  '*/*':
    -    examples:
    -      user: 
    -        summary: User example in other format
    -        externalValue: 'http://foo.bar/examples/user-example.whatever'
    -
    -

    A body parameter that is an array of string values:

    -
    
    -{
    -  "description": "user to add to the system",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "type": "string"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -description: user to add to the system
    -required: true
    -content:
    -  text/plain:
    -    schema:
    -      type: array
    -      items:
    -        type: string
    -
    -

    Media Type Object

    -

    Each Media Type Object provides schema and examples for the media type identified by its key.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    schemaSchema Object ¦ Reference ObjectThe schema defining the type used for the request body.
    exampleAnyExample of the media type. The example object SHOULD be in the correct format as specified by the media type. The example field is mutually exclusive of the examples field. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema.
    examplesMap[ string, Example Object ¦ Reference Object]Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The examples field is mutually exclusive of the example field. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema.
    encodingMap[string, Encoding Object]A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded.
    -

    This object MAY be extended with Specification Extensions.

    -
    Media Type Examples
    -
    
    -{
    -  "application/json": {
    -    "schema": {
    -         "$ref": "#/components/schemas/Pet"
    -    },
    -    "examples": {
    -      "cat" : {
    -        "summary": "An example of a cat",
    -        "value": 
    -          {
    -            "name": "Fluffy",
    -            "petType": "Cat",
    -            "color": "White",
    -            "gender": "male",
    -            "breed": "Persian"
    -          }
    -      },
    -      "dog": {
    -        "summary": "An example of a dog with a cat's name",
    -        "value" :  { 
    -          "name": "Puma",
    -          "petType": "Dog",
    -          "color": "Black",
    -          "gender": "Female",
    -          "breed": "Mixed"
    -        },
    -      "frog": {
    -          "$ref": "#/components/examples/frog-example"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -application/json: 
    -  schema:
    -    $ref: "#/components/schemas/Pet"
    -  examples:
    -    cat:
    -      summary: An example of a cat
    -      value:
    -        name: Fluffy
    -        petType: Cat
    -        color: White
    -        gender: male
    -        breed: Persian
    -    dog:
    -      summary: An example of a dog with a cat's name
    -      value:
    -        name: Puma
    -        petType: Dog
    -        color: Black
    -        gender: Female
    -        breed: Mixed
    -    frog:
    -      $ref: "#/components/examples/frog-example"
    -
    -
    Considerations for File Uploads
    -

    In contrast with the 2.0 specification, file input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically:

    -
    
    -# content transferred with base64 encoding
    -schema:
    -  type: string
    -  format: base64
    -
    -
    
    -# content transferred in binary (octet-stream):
    -schema:
    -  type: string
    -  format: binary
    -
    -

    These examples apply to either input payloads of file uploads or response payloads.

    -

    A requestBody for submitting a file in a POST operation may look like the following example:

    -
    
    -requestBody:
    -  content:
    -    application/octet-stream:
    -      # any media type is accepted, functionally equivalent to `*/*`
    -      schema:
    -        # a binary file of any type
    -        type: string
    -        format: binary
    -
    -

    In addition, specific media types MAY be specified:

    -
    
    -# multiple, specific media types may be specified:
    -requestBody:
    -  content:
    -      # a binary file of type png or jpeg
    -    'image/jpeg':
    -      schema:
    -        type: string
    -        format: binary
    -    'image/png':
    -      schema:
    -        type: string
    -        format: binary        
    -
    -

    To upload multiple files, a multipart media type MUST be used:

    -
    
    -requestBody:
    -  content:
    -    multipart/form-data:
    -      schema:
    -        properties:
    -          # The property name 'file' will be used for all files.
    -          file:
    -            type: array
    -            items:
    -              type: string
    -              format: binary
    -
    -
    -
    Support for x-www-form-urlencoded Request Bodies
    -

    To submit content using form url encoding via [[!rfc1866]], the following -definition may be used:

    -
    
    -requestBody:
    -  content:
    -    application/x-www-form-urlencoded:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            type: string
    -            format: uuid
    -          address:
    -            # complex types are stringified to support RFC 1866
    -            type: object
    -            properties: {}
    -
    -

    In this example, the contents in the requestBody MUST be stringified per [[!rfc1866]]) when passed to the server. In addition, the address field complex object will be stringified.

    -

    When passing complex objects in the application/x-www-form-urlencoded content type, the default serialization strategy of such properties is described in the Encoding Object's style property as form.

    -
    Special Considerations for multipart Content
    -

    It is common to use multipart/form-data as a Content-Type when transferring request bodies to operations. In contrast to 2.0, a schema is REQUIRED to define the input parameters to the operation when using multipart content. This supports complex structures as well as supporting mechanisms for multiple file uploads.

    -

    When passing in multipart types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default Content-Types are defined for multipart:

    -
      -
    • If the property is a primitive, or an array of primitive values, the default Content-Type is text/plain
    • -
    • If the property is complex, or an array of complex values, the default Content-Type is application/json
    • -
    • If the property is a type: string with format: binary or format: base64 (aka a file object), the default Content-Type is application/octet-stream
    • -
    -

    Examples:

    -
    
    -requestBody:
    -  content:
    -    multipart/form-data:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            type: string
    -            format: uuid
    -          address:
    -            # default Content-Type for objects is `application/json`
    -            type: object
    -            properties: {}
    -          profileImage:
    -            # default Content-Type for string/binary is `application/octet-stream`
    -            type: string
    -            format: binary
    -          children:
    -            # default Content-Type for arrays is based on the `inner` type (text/plain here)
    -            type: array
    -            items:
    -              type: string
    -          addresses:
    -            # default Content-Type for arrays is based on the `inner` type (object shown, so `application/json` in this example)
    -            type: array
    -            items:
    -              type: '#/components/schemas/Address'
    -
    -

    An encoding attribute is introduced to give you control over the serialization of parts of multipart request bodies. This attribute is only applicable to multipart and application/x-www-form-urlencoded request bodies.

    -

    Encoding Object

    -

    A single encoding definition applied to a single schema property.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    contentTypestringThe Content-Type for encoding a specific property. Default value depends on the property type: for string with format being binaryapplication/octet-stream; for other primitive types – text/plain; for object - application/json; for array – the default is defined based on the inner type. The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types.
    headersMap[string, Header Object ¦ Reference Object]A map allowing additional information to be provided as headers, for example Content-Disposition. Content-Type is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a multipart.
    stylestringDescribes how a specific property value will be serialized depending on its type. See Parameter Object for details on the style property. The behavior follows the same values as query parameters, including default values. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
    explodebooleanWhen this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
    allowReservedbooleanDetermines whether the parameter value SHOULD allow reserved characters, as defined by [[!rfc3986]]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
    -

    This object MAY be extended with Specification Extensions.

    -
    Encoding Object Example
    -
    
    -requestBody:
    -  content:
    -    multipart/mixed:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            # default is text/plain
    -            type: string
    -            format: uuid
    -          address:
    -            # default is application/json
    -            type: object
    -            properties: {}
    -          historyMetadata:
    -            # need to declare XML format!
    -            description: metadata in XML format
    -            type: object
    -            properties: {}
    -          profileImage:
    -            # default is application/octet-stream, need to declare an image type only!
    -            type: string
    -            format: binary
    -      encoding:
    -        historyMetadata:
    -          # require XML Content-Type in utf-8 encoding
    -          contentType: application/xml; charset=utf-8
    -        profileImage:
    -          # only accept png/jpeg
    -          contentType: image/png, image/jpeg
    -          headers:
    -            X-Rate-Limit-Limit:
    -              description: The number of allowed requests in the current period
    -              schema:
    -                type: integer
    -
    -

    Responses Object

    -

    A container for the expected responses of an operation. -The container maps a HTTP response code to the expected response.

    -

    The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. -However, documentation is expected to cover a successful operation response and any known errors.

    -

    The default MAY be used as a default response object for all HTTP codes -that are not covered individually by the specification.

    -

    The Responses Object MUST contain at least one response code, and it -SHOULD be the response for a successful operation call.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    defaultResponse Object ¦ Reference ObjectThe documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. A Reference Object can link to a response that the OpenAPI Object’s components/responses section defines.
    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    HTTP Status CodeResponse Object ¦ Reference ObjectAny HTTP status code can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A Reference Object can link to a response that is defined in the OpenAPI Object’s components/responses section. This field MUST be enclosed in quotation marks (for example, “200”) for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character X. For example, 2XX represents all response codes between [200-299]. The following range definitions are allowed: 1XX, 2XX, 3XX, 4XX, and 5XX. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code.
    -

    This object MAY be extended with Specification Extensions.

    -
    Responses Object Example
    -

    A 200 response for a successful operation and a default response for others (implying an error):

    -
    
    -{
    -  "200": {
    -    "description": "a pet to be returned",
    -    "content": {
    -      "application/json": {
    -        "schema": {
    -          "$ref": "#/components/schemas/Pet"
    -        }
    -      }
    -    }
    -  },
    -  "default": {
    -    "description": "Unexpected error",
    -    "content": {
    -      "application/json": {
    -        "schema": {
    -          "$ref": "#/components/schemas/ErrorModel"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -'200':
    -  description: a pet to be returned
    -  content: 
    -    application/json:
    -      schema:
    -        $ref: '#/components/schemas/Pet'
    -default:
    -  description: Unexpected error
    -  content:
    -    application/json:
    -      schema:
    -        $ref: '#/components/schemas/ErrorModel'
    -
    -

    Response Object

    -

    Describes a single response from an API Operation, including design-time, static -links to operations based on the response.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    descriptionstringREQUIRED. A short description of the response. CommonMark syntax MAY be used for rich text representation.
    headersMap[string, Header Object ¦ Reference Object]Maps a header name to its definition. [[!rfc7230]]page-22) states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored.
    contentMap[string, Media Type Object]A map containing descriptions of potential response payloads. The key is a media type or [media type range]appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
    linksMap[string, Link Object ¦ Reference Object]A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for Component Objects.
    -

    This object MAY be extended with Specification Extensions.

    -
    Response Object Examples
    -

    Response of an array of a complex type:

    -
    
    -{
    -  "description": "A complex object array response",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "$ref": "#/components/schemas/VeryComplexType"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -description: A complex object array response
    -content: 
    -  application/json:
    -    schema: 
    -      type: array
    -      items:
    -        $ref: '#/components/schemas/VeryComplexType'
    -
    -

    Response with a string type:

    -
    
    -{
    -  "description": "A simple string response",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  }
    -
    -}
    -
    -
    
    -description: A simple string response
    -content:
    -  text/plain:
    -    schema:
    -      type: string
    -
    -

    Plain text response with headers:

    -
    
    -{
    -  "description": "A simple string response",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  },
    -  "headers": {
    -    "X-Rate-Limit-Limit": {
    -      "description": "The number of allowed requests in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    },
    -    "X-Rate-Limit-Remaining": {
    -      "description": "The number of remaining requests in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    },
    -    "X-Rate-Limit-Reset": {
    -      "description": "The number of seconds left in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -description: A simple string response
    -content:
    -  text/plain:
    -    schema:
    -      type: string
    -    example: 'whoa!'
    -headers:
    -  X-Rate-Limit-Limit:
    -    description: The number of allowed requests in the current period
    -    schema:
    -      type: integer
    -  X-Rate-Limit-Remaining:
    -    description: The number of remaining requests in the current period
    -    schema:
    -      type: integer
    -  X-Rate-Limit-Reset:
    -    description: The number of seconds left in the current period
    -    schema:
    -      type: integer
    -
    -

    Response with no return value:

    -
    
    -{
    -  "description": "object created"
    -}
    -
    -
    
    -description: object created
    -
    -

    Callback Object

    -

    A map of possible out-of band callbacks related to the parent operation. -Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. -The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {expression}Path Item ObjectA Path Item Object used to define a callback request and expected responses. A complete example is available.
    -

    This object MAY be extended with Specification Extensions.

    -
    Key Expression
    -

    The key that identifies the Path Item Object is a runtime expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. -A simple example might be $request.body#/url. -However, using a runtime expression the complete HTTP message can be accessed. -This includes accessing any part of a body that a JSON Pointer [[!rfc6901]] can reference.

    -

    For example, given the following HTTP request:

    -
    
    -POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1
    -Host: example.org
    -Content-Type: application/json
    -Content-Length: 187
    -
    -{
    -  "failedUrl" : "http://clientdomain.com/failed",
    -  "successUrls" : [
    -    "http://clientdomain.com/fast",
    -    "http://clientdomain.com/medium",
    -    "http://clientdomain.com/slow"
    -  ] 
    -}
    -
    -201 Created
    -Location: http://example.org/subscription/1
    -
    -

    The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named eventType and a query parameter named queryUrl.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ExpressionValue
    $urlhttp://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning
    $methodPOST
    $request.path.eventTypemyevent
    $request.query.queryUrlhttp://clientdomain.com/stillrunning
    $request.header.content-Typeapplication/json
    $request.body#/failedUrlhttp://clientdomain.com/stillrunning
    $request.body#/successUrls/2http://clientdomain.com/medium
    $response.header.Locationhttp://example.org/subscription/1
    -
    Callback Object Example
    -

    The following example shows a callback to the URL specified by the id and email property in the request body.

    -
    
    -myWebhook:
    -  'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
    -    post:
    -      requestBody:
    -        description: Callback payload
    -        content: 
    -          'application/json':
    -            schema:
    -              $ref: '#/components/schemas/SomePayload'
    -      responses:
    -        '200':
    -          description: webhook successfully processed and no retries will be performed
    -
    -

    Example Object

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    summarystringShort description for the example.
    descriptionstringLong description for the example. CommonMark syntax MAY be used for rich text representation.
    valueAnyEmbedded literal example. The value field and externalValue field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary.
    externalValuestringA URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The value field and externalValue field are mutually exclusive.
    -

    This object MAY be extended with Specification Extensions.

    -

    In all cases, the example value is expected to be compatible with the type schema -of its associated value. Tooling implementations MAY choose to -validate compatibility automatically, and reject the example value(s) if incompatible.

    -
    Example Object Example
    -
    
    -# in a model
    -schemas:
    -  properties:
    -    name:
    -      type: string
    -      examples:
    -        name:
    -          $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example
    -
    -# in a request body:
    -  requestBody:
    -    content:
    -      'application/json':
    -        schema:
    -          $ref: '#/components/schemas/Address'
    -        examples: 
    -          foo:
    -            summary: A foo example
    -            value: {"foo": "bar"}
    -          bar:
    -            summary: A bar example
    -            value: {"bar": "baz"}
    -      'application/xml':
    -        examples: 
    -          xmlExample:
    -            summary: This is an example in XML
    -            externalValue: 'http://example.org/examples/address-example.xml'
    -      'text/plain':
    -        examples:
    -          textExample: 
    -            summary: This is a text example
    -            externalValue: 'http://foo.bar/examples/address-example.txt' 
    -
    -
    -# in a parameter
    -  parameters:
    -    - name: 'zipCode'
    -      in: 'query'
    -      schema:
    -        type: 'string'
    -        format: 'zip-code'
    -        examples:
    -          zip-example: 
    -            $ref: '#/components/examples/zip-example'
    -
    -# in a response
    -  responses:
    -    '200':
    -      description: your car appointment has been booked
    -      content: 
    -        application/json:
    -          schema:
    -            $ref: '#/components/schemas/SuccessResponse'
    -          examples:
    -            confirmation-success:
    -              $ref: '#/components/examples/confirmation-success'
    -
    -

    Link Object

    -

    The Link object represents a possible design-time link for a response. -The presence of a link does not guarantee the caller’s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.

    -

    Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.

    -

    For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    operationRefstringA relative or absolute reference to an OAS operation. This field is mutually exclusive of the operationId field, and MUST point to an Operation Object. Relative operationRef values MAY be used to locate an existing Operation Object in the OpenAPI definition.
    operationIdstringThe name of an existing, resolvable OAS operation, as defined with a unique operationId. This field is mutually exclusive of the operationRef field.
    parametersMap[string, Any ¦ {expression}]A map representing parameters to pass to an operation as specified with operationId or identified via operationRef. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id).
    requestBodyAny ¦ {expression}A literal value or {expression} to use as a request body when calling the target operation.
    descriptionstringA description of the link. CommonMark syntax MAY be used for rich text representation.
    serverServer ObjectA server object to be used by the target operation.
    -

    This object MAY be extended with Specification Extensions.

    -

    A linked operation MUST be identified using either an operationRef or operationId. -In the case of an operationId, it MUST be unique and resolved in the scope of the OAS document. -Because of the potential for name clashes, the operationRef syntax is preferred -for specifications with external references.

    -
    Examples
    -

    Computing a link from a request operation where the $request.path.id is used to pass a request parameter to the linked operation.

    -
    
    -paths:
    -  /users/{id}:
    -    parameters:
    -    - name: id
    -      in: path
    -      required: true
    -      description: the user identifier, as userId 
    -      schema:
    -        type: string
    -    get:
    -      responses:
    -        '200':
    -          description: the user being returned
    -          content:
    -            application/json:
    -              schema:
    -                type: object
    -                properties:
    -                  uuid: # the unique user id
    -                    type: string
    -                    format: uuid
    -          links:
    -            address:
    -              # the target link operationId
    -              operationId: getUserAddress
    -              parameters:
    -                # get the `id` field from the request path parameter named `id`
    -                userId: $request.path.id
    -  # the path item of the linked operation
    -  /users/{userid}/address:
    -    parameters:
    -    - name: userid
    -      in: path
    -      required: true
    -      description: the user identifier, as userId 
    -      schema:
    -        type: string
    -    # linked operation
    -    get:
    -      operationId: getUserAddress
    -      responses:
    -        '200':
    -          description: the user's address
    -
    -

    When a runtime expression fails to evaluate, no parameter value is passed to the target operation.

    -

    Values from the response body can be used to drive a linked operation.

    -
    
    -links:
    -  address:
    -    operationId: getUserAddressByUUID
    -    parameters:
    -      # get the `uuid` field from the `uuid` field in the response body
    -      userUuid: $response.body#/uuid
    -
    -

    Clients follow all links at their discretion. -Neither permissions, nor the capability to make a successful call to that link, is guaranteed -solely by the existence of a relationship.

    -
    OperationRef Examples
    -

    As references to operationId MAY NOT be possible (the operationId is an optional -value), references MAY also be made through a relative operationRef:

    -
    
    -links:
    -  UserRepositories:
    -    # returns array of '#/components/schemas/repository'
    -    operationRef: '#/paths/~12.0~1repositories~1{username}/get'
    -    parameters:
    -      username: $response.body#/username
    -
    -

    or an absolute operationRef:

    -
    
    -links:
    -  UserRepositories:
    -    # returns array of '#/components/schemas/repository'
    -    operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get'
    -    parameters:
    -      username: $response.body#/username
    -
    -

    Note that in the use of operationRef, the escaped forward-slash is necessary when -using JSON references.

    -
    Runtime Expressions
    -

    Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. -This mechanism is used by Link Objects and Callback Objects.

    -

    The runtime expression is defined by the following [Augmented Backus-Naur Form] syntax

    -
    
    -      expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source )
    -      source = ( header-reference | query-reference | path-reference | body-reference )  
    -      header-reference = "header." token
    -      query-reference = "query." name  
    -      path-reference = "path." name
    -      body-reference = "body" ["#" fragment]
    -      fragment = a JSON Pointer [[!rfc6901]]  
    -      name = *( char )
    -      char = as per RFC [7159]section-7)
    -      token = as per RFC [7230]section-3.2.6)
    -
    -

    The name identifier is case-sensitive, whereas token is not.

    -

    The table below provides examples of runtime expressions and examples of their use in a value:

    -
    Examples
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Source Locationexample expressionnotes
    HTTP Method$methodThe allowable values for the $method will be those for the HTTP operation.
    Requested media type$request.header.accept
    Request parameter$request.path.idRequest parameters MUST be declared in the parameters section of the parent operation or they cannot be evaluated. This includes request headers.
    Request body property$request.body#/user/uuidIn operations which accept payloads, references may be made to portions of the requestBody or the entire body.
    Request URL$url
    Response value$response.body#/statusIn operations which return payloads, references may be made to portions of the response body or the entire body.
    Response header$response.header.ServerSingle header values only are available
    -

    Runtime expressions preserve the type of the referenced value. -Expressions can be embedded into string values by surrounding the expression with {} curly braces.

    -

    Header Object

    -

    The Header Object follows the structure of the Parameter Object with the following changes:

    -
      -
    1. name MUST NOT be specified, it is given in the corresponding headers map.
    2. -
    3. in MUST NOT be specified, it is implicitly in header.
    4. -
    5. All traits that are affected by the location MUST be applicable to a location of header (for example, style).
    6. -
    -
    Header Object Example
    -

    A simple header of type integer:

    -
    
    -{
    -  "description": "The number of allowed requests in the current period",
    -  "schema": {
    -    "type": "integer"
    -  }
    -}
    -
    -
    
    -description: The number of allowed requests in the current period
    -schema:
    -  type: integer
    -
    -

    Tag Object

    -

    Adds metadata to a single tag that is used by the Operation Object. -It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringREQUIRED. The name of the tag.
    descriptionstringA short description for the tag. CommonMark syntax MAY be used for rich text representation.
    externalDocsExternal Documentation ObjectAdditional external documentation for this tag.
    -

    This object MAY be extended with Specification Extensions.

    -
    Tag Object Example
    -
    
    -{
    -	"name": "pet",
    -	"description": "Pets operations"
    -}
    -
    -
    
    -name: pet
    -description: Pets operations
    -
    -

    Reference Object

    -

    A simple object to allow referencing other components in the specification, internally and externally.

    -

    The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.

    -

    For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    $refstringREQUIRED. The reference string.
    -

    This object cannot be extended with additional properties and any properties added SHALL be ignored.

    -
    Reference Object Example
    -
    
    -{
    -	"$ref": "#/components/schemas/Pet"
    -}
    -
    -
    
    -$ref: '#/components/schemas/Pet'
    -
    -
    Relative Schema Document Example
    -
    
    -{
    -  "$ref": "Pet.json"
    -}
    -
    -
    
    -$ref: Pet.yaml
    -
    -
    Relative Documents With Embedded Schema Example
    -
    
    -{
    -  "$ref": "definitions.json#/Pet"
    -}
    -
    -
    
    -$ref: definitions.yaml#/Pet
    -
    -

    Schema Object

    -

    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 an extended subset of the JSON Schema Specification Wright Draft 00.

    -

    For more information about the properties, see JSON Schema Core and JSON Schema Validation. -Unless stated otherwise, the property definitions follow the JSON Schema.

    -
    Properties
    -

    The following properties are taken directly from the JSON Schema definition and follow the same specifications:

    -
      -
    • title
    • -
    • multipleOf
    • -
    • maximum
    • -
    • exclusiveMaximum
    • -
    • minimum
    • -
    • exclusiveMinimum
    • -
    • maxLength
    • -
    • minLength
    • -
    • pattern (This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect)
    • -
    • maxItems
    • -
    • minItems
    • -
    • uniqueItems
    • -
    • maxProperties
    • -
    • minProperties
    • -
    • required
    • -
    • enum
    • -
    -

    The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification.

    -
      -
    • type - Value MUST be a string. Multiple types via an array are not supported.
    • -
    • allOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • oneOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • anyOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • not - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. items MUST be present if the type is array.
    • -
    • properties - Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced).
    • -
    • additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
    • -
    • description - CommonMark syntax MAY be used for rich text representation.
    • -
    • format - See Data Type Formats for further details. While relying on JSON Schema’s defined formats, the OAS offers a few additional predefined formats.
    • -
    • default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if type is string, then default can be "foo" but cannot be 1.
    • -
    -

    Alternatively, any time a Schema Object can be used, a Reference Object can be used in its place. This allows referencing definitions instead of defining them inline.

    -

    Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported.

    -

    Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation:

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    nullablebooleanAllows sending a null value for the defined schema. Default value is false.
    discriminatorDiscriminator ObjectAdds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See Composition and Inheritance for more details.
    readOnlybooleanRelevant only for Schema "properties" definitions. Declares the property as “read only”. This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.
    writeOnlybooleanRelevant only for Schema "properties" definitions. Declares the property as “write only”. Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as writeOnly being true and is in the required list, the required will take effect on the request only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.
    xmlXML ObjectThis MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property.
    externalDocsExternal Documentation ObjectAdditional external documentation for this schema.
    exampleAnyA free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary.
    deprecatedbooleanSpecifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false.
    -

    This object MAY be extended with Specification Extensions.

    -
    Composition and Inheritance (Polymorphism)
    -

    The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. -allOf takes an array of object definitions that are validated independently but together compose a single object.

    -

    While composition offers model extensibility, it does not imply a hierarchy between the models. -To support polymorphism, the OpenAPI Specification adds the discriminator field. -When used, the discriminator will be the name of the property that decides which schema definition validates the structure of the model. -As such, the discriminator field MUST be a required field. -There are two ways to define the value of a discriminator for an inheriting instance.

    -
      -
    • Use the schema name.
    • -
    • Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name. -As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism.
    • -
    -
    XML Modeling
    -

    The xml property allows extra definitions when translating the JSON definition to XML. -The XML Object contains additional information about the available options.

    -
    Schema Object Examples
    -
    Primitive Sample
    -
    
    -{
    -  "type": "string",
    -  "format": "email"
    -}
    -
    -
    
    -type: string
    -format: email
    -
    -
    Simple Model
    -
    
    -{
    -  "type": "object",
    -  "required": [
    -    "name"
    -  ],
    -  "properties": {
    -    "name": {
    -      "type": "string"
    -    },
    -    "address": {
    -      "$ref": "#/components/schemas/Address"
    -    },
    -    "age": {
    -      "type": "integer",
    -      "format": "int32",
    -      "minimum": 0
    -    }
    -  }
    -}
    -
    -
    
    -type: object
    -required:
    -- name
    -properties:
    -  name:
    -    type: string
    -  address:
    -    $ref: '#/components/schemas/Address'
    -  age:
    -    type: integer
    -    format: int32
    -    minimum: 0
    -
    -
    Model with Map/Dictionary Properties
    -

    For a simple string to string mapping:

    -
    
    -{
    -  "type": "object",
    -  "additionalProperties": {
    -    "type": "string"
    -  }
    -}
    -
    -
    
    -type: object
    -additionalProperties:
    -  type: string
    -
    -

    For a string to model mapping:

    -
    
    -{
    -  "type": "object",
    -  "additionalProperties": {
    -    "$ref": "#/components/schemas/ComplexModel"
    -  }
    -}
    -
    -
    
    -type: object
    -additionalProperties:
    -  $ref: '#/components/schemas/ComplexModel'
    -
    -
    Model with Example
    -
    
    -{
    -  "type": "object",
    -  "properties": {
    -    "id": {
    -      "type": "integer",
    -      "format": "int64"
    -    },
    -    "name": {
    -      "type": "string"
    -    }
    -  },
    -  "required": [
    -    "name"
    -  ],
    -  "example": {
    -    "name": "Puma",
    -    "id": 1
    -  }
    -}
    -
    -
    
    -type: object
    -properties:
    -  id:
    -    type: integer
    -    format: int64
    -  name:
    -    type: string
    -required:
    -- name
    -example:
    -  name: Puma
    -  id: 1
    -
    -
    Models with Composition
    -
    
    -{
    -  "components": {
    -    "schemas": {
    -      "ErrorModel": {
    -        "type": "object",
    -        "required": [
    -          "message",
    -          "code"
    -        ],
    -        "properties": {
    -          "message": {
    -            "type": "string"
    -          },
    -          "code": {
    -            "type": "integer",
    -            "minimum": 100,
    -            "maximum": 600
    -          }
    -        }
    -      },
    -      "ExtendedErrorModel": {
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/ErrorModel"
    -          },
    -          {
    -            "type": "object",
    -            "required": [
    -              "rootCause"
    -            ],
    -            "properties": {
    -              "rootCause": {
    -                "type": "string"
    -              }
    -            }
    -          }
    -        ]
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -components:
    -  schemas:
    -    ErrorModel:
    -      type: object
    -      required:
    -      - message
    -      - code
    -      properties:
    -        message:
    -          type: string
    -        code:
    -          type: integer
    -          minimum: 100
    -          maximum: 600
    -    ExtendedErrorModel:
    -      allOf:
    -      - $ref: '#/components/schemas/ErrorModel'
    -      - type: object
    -        required:
    -        - rootCause
    -        properties:
    -          rootCause:
    -            type: string
    -
    -
    Models with Polymorphism Support
    -
    
    -{
    -  "components": {
    -    "schemas": {
    -      "Pet": {
    -        "type": "object",
    -        "discriminator": {
    -          "propertyName": "petType"
    -        },
    -        "properties": {
    -          "name": {
    -            "type": "string"
    -          },
    -          "petType": {
    -            "type": "string"
    -          }
    -        },
    -        "required": [
    -          "name",
    -          "petType"
    -        ]
    -      },
    -      "Cat": {
    -        "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.",
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/Pet"
    -          },
    -          {
    -            "type": "object",
    -            "properties": {
    -              "huntingSkill": {
    -                "type": "string",
    -                "description": "The measured skill for hunting",
    -                "default": "lazy",
    -                "enum": [
    -                  "clueless",
    -                  "lazy",
    -                  "adventurous",
    -                  "aggressive"
    -                ]
    -              }
    -            },
    -            "required": [
    -              "huntingSkill"
    -            ]
    -          }
    -        ]
    -      },
    -      "Dog": {
    -        "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.",
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/Pet"
    -          },
    -          {
    -            "type": "object",
    -            "properties": {
    -              "packSize": {
    -                "type": "integer",
    -                "format": "int32",
    -                "description": "the size of the pack the dog is from",
    -                "default": 0,
    -                "minimum": 0
    -              }
    -            },
    -            "required": [
    -              "packSize"
    -            ]
    -          }
    -        ]
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -components:
    -  schemas:
    -    Pet:
    -      type: object
    -      discriminator:
    -        propertyName: petType
    -      properties:
    -        name:
    -          type: string
    -        petType:
    -          type: string
    -      required:
    -      - name
    -      - petType
    -    Cat:  ## "Cat" will be used as the discriminator value
    -      description: A representation of a cat
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        properties:
    -          huntingSkill:
    -            type: string
    -            description: The measured skill for hunting
    -            enum:
    -            - clueless
    -            - lazy
    -            - adventurous
    -            - aggressive
    -        required:
    -        - huntingSkill
    -    Dog:  ## "Dog" will be used as the discriminator value
    -      description: A representation of a dog
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        properties:
    -          packSize:
    -            type: integer
    -            format: int32
    -            description: the size of the pack the dog is from
    -            default: 0
    -            minimum: 0
    -        required:
    -        - packSize
    -
    -

    Discriminator Object

    -

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    -

    When using the discriminator, inline schemas will not be considered.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    propertyNamestringREQUIRED. The name of the property in the payload that will hold the discriminator value.
    mappingMap[string, string]An object to hold mappings between payload values and schema names or references.
    -

    The discriminator attribute is legal only when using one of the composite keywords oneOf, anyOf, allOf.

    -

    In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:

    -
    
    -MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -
    -

    which means the payload MUST, by validation, match exactly one of the schemas described by Cat, Dog, or Lizard. In this case, a discriminator MAY act as a “hint” to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use:

    -
    
    -MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -  discriminator:
    -    propertyName: pet_type
    -
    -

    The expectation now is that a property with name pet_type MUST be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload:

    -
    
    -{
    -  "id": 12345,
    -  "pet_type": "Cat"
    -}
    -
    -

    Will indicate that the Cat schema be used in conjunction with this payload.

    -

    In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional mapping definition MAY be used:

    -
    
    -MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -  - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json'
    -  discriminator:
    -    propertyName: pet_type
    -    mapping:
    -      dog: '#/components/schemas/Dog'
    -      monster: 'https://gigantic-server.com/schemas/Monster/schema.json'
    -
    -

    Here the discriminator value of dog will map to the schema #/components/schemas/Dog, rather than the default (implicit) value of Dog. If the discriminator value does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison.

    -

    When used in conjunction with the anyOf construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload.

    -

    In both the oneOf and anyOf use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an allOf construct may be used as an alternate schema.

    -

    For example:

    -
    
    -components:
    -  schemas:
    -    Pet:
    -      type: object
    -      required:
    -      - pet_type
    -      properties:
    -        pet_type:
    -          type: string
    -      discriminator:
    -        propertyName: pet_type
    -        mapping:
    -          cachorro: Dog
    -    Cat:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a `Cat`
    -        properties:
    -          name:
    -            type: string
    -    Dog:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a `Dog`
    -        properties:
    -          bark:
    -            type: string
    -    Lizard:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a `Lizard`
    -        properties:
    -          lovesRocks:
    -            type: boolean
    -
    -

    a payload like this:

    -
    
    -{
    -  "pet_type": "Cat",
    -  "name": "misty"
    -}
    -
    -

    will indicate that the Cat schema be used. Likewise this schema:

    -
    
    -{
    -  "pet_type": "cachorro",
    -  "bark": "soft"
    -}
    -
    -

    will map to Dog because of the definition in the mappings element.

    -

    XML Object

    -

    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.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    namestringReplaces the name of the element/attribute used for the described schema property. When defined within 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.
    namespacestringThe URI of the namespace definition. Value MUST be in the form of an absolute URI.
    prefixstringThe prefix to be used for the name.
    attributebooleanDeclares whether the property definition translates to an attribute instead of an element. Default value is false.
    wrappedbooleanMAY 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).
    -

    This object MAY be extended with Specification Extensions.

    -
    XML Object Examples
    -

    The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

    -
    No XML Element
    -

    Basic string property:

    -
    
    -{
    -    "animals": {
    -        "type": "string"
    -    }
    -}
    -
    -
    
    -animals:
    -  type: string
    -
    -
    
    -<animals>...</animals>
    -
    -

    Basic string array property (wrapped is false by default):

    -
    
    -{
    -    "animals": {
    -        "type": "array",
    -        "items": {
    -            "type": "string"
    -        }
    -    }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -
    -
    
    -<animals>...</animals>
    -<animals>...</animals>
    -<animals>...</animals>
    -
    -
    XML Name Replacement
    -
    
    -{
    -  "animals": {
    -    "type": "string",
    -    "xml": {
    -      "name": "animal"
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: string
    -  xml:
    -    name: animal
    -
    -
    
    -<animal>...</animal>
    -
    -
    XML Attribute, Prefix and Namespace
    -

    In this example, a full model definition is shown.

    -
    
    -{
    -  "Person": {
    -    "type": "object",
    -    "properties": {
    -      "id": {
    -        "type": "integer",
    -        "format": "int32",
    -        "xml": {
    -          "attribute": true
    -        }
    -      },
    -      "name": {
    -        "type": "string",
    -        "xml": {
    -          "namespace": "http://example.com/schema/sample",
    -          "prefix": "sample"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -Person:
    -  type: object
    -  properties:
    -    id:
    -      type: integer
    -      format: int32
    -      xml:
    -        attribute: true
    -    name:
    -      type: string
    -      xml:
    -        namespace: http://example.com/schema/sample
    -        prefix: sample
    -
    -
    
    -<Person id="123">
    -    <sample:name xmlns:sample="http://example.com/schema/sample">example</sample:name>
    -</Person>
    -
    -
    XML Arrays
    -

    Changing the element names:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -
    -
    
    -<animal>value</animal>
    -<animal>value</animal>
    -
    -

    The external name property has no effect on the XML:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens"
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -
    -
    
    -<animal>value</animal>
    -<animal>value</animal>
    -
    -

    Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    wrapped: true
    -
    -
    
    -<animals>
    -  <animals>value</animals>
    -  <animals>value</animals>
    -</animals>
    -
    -

    To overcome the naming problem in the example above, the following definition can be used:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    wrapped: true
    -
    -
    
    -<animals>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</animals>
    -
    -

    Affecting both internal and external names:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    
    -<aliens>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</aliens>
    -
    -

    If we change the external element but not the internal ones:

    -
    
    -{
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    
    -animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    
    -<aliens>
    -  <aliens>value</aliens>
    -  <aliens>value</aliens>
    -</aliens>
    -
    -

    Security Scheme Object

    -

    Defines a security scheme that can be used by the operations. -Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [[!rfc6749]], and OpenID Connect Discovery.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeApplies ToDescription
    typestringAnyREQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "oauth2", "openIdConnect".
    descriptionstringAnyA short description for security scheme. CommonMark syntax MAY be used for rich text representation.
    namestringapiKeyREQUIRED. The name of the header, query or cookie parameter to be used.
    instringapiKeyREQUIRED. The location of the API key. Valid values are "query", "header" or "cookie".
    schemestringhttpREQUIRED. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235]section-5.1).
    bearerFormatstringhttp ("bearer")A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes.
    flowsOAuth Flows Objectoauth2REQUIRED. An object containing configuration information for the flow types supported.
    openIdConnectUrlstringopenIdConnectREQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL.
    -

    This object MAY be extended with Specification Extensions.

    -
    Security Scheme Object Example
    -
    Basic Authentication Sample
    -
    
    -{
    -  "type": "http",
    -  "scheme": "basic"
    -}
    -
    -
    
    -type: http
    -scheme: basic
    -
    -
    API Key Sample
    -
    
    -{
    -  "type": "apiKey",
    -  "name": "api_key",
    -  "in": "header"
    -}
    -
    -
    
    -type: apiKey
    -name: api_key
    -in: header
    -
    -
    JWT Bearer Sample
    -
    
    -{
    -  "type": "http",
    -  "scheme": "bearer",
    -  "bearerFormat": "JWT",
    -}
    -
    -
    
    -type: http
    -scheme: bearer
    -bearerFormat: JWT
    -
    -
    Implicit OAuth2 Sample
    -
    
    -{
    -  "type": "oauth2",
    -  "flows": {
    -    "implicit": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -type: oauth2
    -flows: 
    -  implicit:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets
    -
    -

    OAuth Flows Object

    -

    Allows configuration of the supported OAuth Flows.

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeDescription
    implicitOAuth Flow ObjectConfiguration for the OAuth Implicit flow
    passwordOAuth Flow ObjectConfiguration for the OAuth Resource Owner Password flow
    clientCredentialsOAuth Flow ObjectConfiguration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0.
    authorizationCodeOAuth Flow ObjectConfiguration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.
    -

    This object MAY be extended with Specification Extensions.

    -

    OAuth Flow Object

    -

    Configuration details for a supported OAuth Flow

    -
    Fixed Fields
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Field NameTypeApplies ToDescription
    authorizationUrlstringoauth2 ("implicit", "authorizationCode")REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL.
    tokenUrlstringoauth2 ("password", "clientCredentials", "authorizationCode")REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL.
    refreshUrlstringoauth2The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.
    scopesMap[string, string]oauth2REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it.
    -

    This object MAY be extended with Specification Extensions.

    -
    OAuth Flow Object Examples
    -
    
    -{
    -  "type": "oauth2",
    -  "flows": {
    -    "implicit": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    },
    -    "authorizationCode": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "tokenUrl": "https://example.com/api/oauth/token",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    }
    -  }
    -}
    -
    -
    
    -type: oauth2
    -flows: 
    -  implicit:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets
    -  authorizationCode:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    tokenUrl: https://example.com/api/oauth/token
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets 
    -
    -

    Security Requirement Object

    -

    Lists the required security schemes to execute this operation. -The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.

    -

    Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. -This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.

    -

    When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.

    -
    Patterned Fields
    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    {name}[string]Each name MUST correspond to a security scheme which is declared in the Security Schemes under the Components Object. If the security scheme is of type "oauth2" or "openIdConnect", then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty.
    -
    Security Requirement Object Examples
    -
    Non-OAuth2 Security Requirement
    -
    
    -{
    -  "api_key": []
    -}
    -
    -
    
    -api_key: []
    -
    -
    OAuth2 Security Requirement
    -
    
    -{
    -  "petstore_auth": [
    -    "write:pets",
    -    "read:pets"
    -  ]
    -}
    -
    -
    
    -petstore_auth:
    -- write:pets
    -- read:pets
    -
    -

    Specification Extensions

    -

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    -

    The extensions properties are implemented as patterned fields that are always prefixed by "x-".

    - - - - - - - - - - - - - - - -
    Field PatternTypeDescription
    ^x-AnyAllows extensions to the OpenAPI Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. 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).

    -

    Security Filtering

    -

    Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.

    -

    The reasoning is to allow an additional layer of access control over the documentation. -While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.

    -

    Two examples of this:

    -
      -
    1. The Paths Object MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication.
    2. -
    3. The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object, so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see.
    4. -
    -

    Appendix A: Revision History

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    VersionDateNotes
    3.0.12017-12-06Patch release of the OpenAPI Specification 3.0.1
    3.0.02017-07-26Release of the OpenAPI Specification 3.0.0
    3.0.0-rc22017-06-16rc2 of the 3.0 specification
    3.0.0-rc12017-04-27rc1 of the 3.0 specification
    3.0.0-rc02017-02-28Implementer’s Draft of the 3.0 specification
    2.02015-12-31Donation of Swagger 2.0 to the Open API Initiative
    2.02014-09-08Release of Swagger 2.0
    1.22014-03-14Initial release of the formal document.
    1.12012-08-22Release of Swagger 1.1
    1.02011-08-10First release of the Swagger Specification
    - diff --git a/scripts/md2html/v3/h3.0.0.bs b/scripts/md2html/v3/h3.0.0.bs deleted file mode 100644 index 46e20f8f8d..0000000000 --- a/scripts/md2html/v3/h3.0.0.bs +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - -Open API Initiative logo diff --git a/scripts/md2html/v3/h3.0.1.bs b/scripts/md2html/v3/h3.0.1.bs deleted file mode 100644 index e2e2564fee..0000000000 --- a/scripts/md2html/v3/h3.0.1.bs +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - -Open API Initiative logo diff --git a/scripts/md2html/v3/oas_3.0.0.html b/scripts/md2html/v3/oas_3.0.0.html deleted file mode 100644 index fa7f01328c..0000000000 --- a/scripts/md2html/v3/oas_3.0.0.html +++ /dev/null @@ -1,5428 +0,0 @@ - - - - OpenAPI Specification - - - - - - - - - - - - - -
    -

    -

    OpenAPI Specification

    -

    Living Standard,

    -
    -
    -
    This version: -
    https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md -
    Issue Tracking: -
    GitHub -
    Editors: -
    Darrel Miller -
    Jeremy Whitlock -
    Marsh Gardiner -
    Ron Ratovsky -
    Former Editors: -
    Jason Harmon -
    Tony Tam -
    -
    -
    - -
    -
    -
    -

    Abstract

    -

    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    -
    -
    - -
    - - - -

    Open API Initiative logo

    - OpenAPI Specification -

    OpenAPI Specification

    -

    Version 3.0.0

    -

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [rfc2119] [rfc8174] when, and only when, they appear in all capitals, as shown here.

    -

    This document is licensed under The Apache License, Version 2.0.

    -

    1. Introduction

    -

    The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.

    -

    An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.

    -

    2. Definitions

    -

    OpenAPI Document

    -

    A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification.

    -
    2.1. Path Templating
    -

    Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters.

    -
    2.2. Media Types
    -

    Media type definitions are spread across several resources. -The media type definitions SHOULD be in compliance with [rfc6838].

    -

    Some examples of possible media type definitions:

    -
    text/plain; charset=utf-8
    -application/json
    -application/vnd.github+json
    -application/vnd.github.v3+json
    -application/vnd.github.v3.raw+json
    -application/vnd.github.v3.text+json
    -application/vnd.github.v3.html+json
    -application/vnd.github.v3.full+json
    -application/vnd.github.v3.diff
    -application/vnd.github.v3.patch
    -
    -
    2.3. HTTP Status Codes
    -

    The HTTP Status Codes are used to indicate the status of the executed operation. -The available status codes are defined by [rfc7231]section-6) and registered status codes are listed in the IANA Status Code Registry.

    -

    3. Specification

    -

    3.1. Versions

    -

    The OpenAPI Specification is versioned using Semantic Versioning 2.0.0 (semver) and follows the semver specification.

    -

    The major.minor portion of the semver (for example 3.0) SHALL designate the OAS feature set. Typically, .patch versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between 3.0.0 and 3.0.1 for example.

    -

    Subsequent minor version releases of the OpenAPI Specification (incrementing the minor version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical 3.1.0 specification SHOULD be usable with tooling designed for 3.0.0.

    -

    An OpenAPI document compatible with OAS 3.. contains a required openapi field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named swagger and value "2.0".)

    -

    3.2. Format

    -

    An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format.

    -

    For example, if a field has an array value, the JSON array representation will be used:

    -
    {
    -   "field": [ 1, 2, 3 ]
    -}
    -
    -

    All field names in the specification are case sensitive.

    -

    The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name.

    -

    Patterned fields MUST have unique names within the containing object.

    -

    In order to preserve the ability to round-trip between YAML and JSON formats, YAML version 1.2 is RECOMMENDED along with some additional constraints:

    - -

    Note: While APIs may be defined by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML.

    -

    3.2.1. Document Structure

    -

    An OpenAPI document MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the user. In the latter case, $ref fields MUST be used in the specification to reference those parts as follows from the JSON Schema definitions.

    -

    It is RECOMMENDED that the root OpenAPI document be named: openapi.json or openapi.yaml.

    -

    3.3. Data Types

    -

    Primitive data types in the OAS are based on the types supported by the JSON Schema Specification Wright Draft 00. -Note that integer as a type is also supported and is defined as a JSON number without a fraction or exponent part. null is not supported as a type (see nullable for an alternative solution). -Models are defined using the Schema Object, which is an extended subset of JSON Schema Specification Wright Draft 00.

    -

    Primitives have an optional modifier property: format. -OAS uses several known formats to define in fine detail the data type being used. -However, to support documentation needs, the format property is an open string-valued property, and can have any value. -Formats such as "email", "uuid", and so on, MAY be used even though undefined by this specification. -Types that are not accompanied by a format property follow the type definition in the JSON Schema. Tools that do not recognize a specific format MAY default back to the type alone, as if the format is not specified.

    -

    The formats defined by the OAS are:

    - - - - - - - - - - - - - - - -
    Common Name - type - format - Comments -
    integer - integer - int32 - signed 32 bits -
    long - integer - int64 - signed 64 bits -
    float - number - float - -
    double - number - double - -
    string - string - - -
    byte - string - byte - base64 encoded characters -
    binary - string - binary - any sequence of octets -
    boolean - boolean - - -
    date - string - date - As defined by full-date - [!rfc3339] -
    dateTime - string - date-time - As defined by date-time - [!rfc3339] -
    password - string - password - A hint to UIs to obscure input. -
    -

    3.4. Rich Text Formatting

    -

    Throughout the specification description fields are noted as supporting CommonMark markdown formatting. -Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by CommonMark 0.27. Tooling MAY choose to ignore some CommonMark features to address security concerns.

    -

    3.5. Relative References in URLs

    -

    Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [rfc3986]section-4.2). -Relative references are resolved using the URLs defined in the Server Object as a Base URI.

    -

    Relative references used in $ref are processed as per JSON Reference, using the URL of the current document as the base URI. See also the Reference Object.

    -

    3.6. Schema

    -

    In the following description, if a field is not explicitly REQUIRED or described with a MUST or SHALL, it can be considered OPTIONAL.

    -

    3.6.1. OpenAPI Object

    -

    This is the root document object of the OpenAPI document.

    -
    3.6.1.1. Fixed Fields
    - - - - - - - - - - - - -
    Field Name - Type - Description -
    openapi - string - REQUIRED. This string MUST be the semantic version number of the OpenAPI Specification version that the OpenAPI document uses. The openapi field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is not related to the API info.version string. -
    info - Info Object - REQUIRED. Provides metadata about the API. The metadata MAY be used by tooling as required. -
    servers - [Server Object] - An array of Server Objects, which provide connectivity information to a target server. If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url value of /. -
    paths - Paths Object - REQUIRED. The available paths and operations for the API. -
    components - Components Object - An element to hold various schemas for the specification. -
    security - [Security Requirement Object] - A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. -
    tags - [Tag Object] - 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. -
    externalDocs - External Documentation Object - Additional external documentation. -
    -

    This object MAY be extended with Specification Extensions.

    -

    3.6.2. Info Object

    -

    The object provides metadata about the API. -The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.

    -
    3.6.2.1. Fixed Fields
    - - - - - - - - - - -
    Field Name - Type - Description -
    title - string - REQUIRED. The title of the application. -
    description - string - A short description of the application. CommonMark syntax MAY be used for rich text representation. -
    termsOfService - string - A URL to the Terms of Service for the API. MUST be in the format of a URL. -
    contact - Contact Object - The contact information for the exposed API. -
    license - License Object - The license information for the exposed API. -
    version - string - REQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version). -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.2.2. Info Object Example:
    -
    {
    -  "title": "Sample Pet Store App",
    -  "description": "This is a sample server for a pet store.",
    -  "termsOfService": "http://example.com/terms/",
    -  "contact": {
    -    "name": "API Support",
    -    "url": "http://www.example.com/support",
    -    "email": "support@example.com"
    -  },
    -  "license": {
    -    "name": "Apache 2.0",
    -    "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    -  },
    -  "version": "1.0.1"
    -}
    -
    -
    title: Sample Pet Store App
    -description: This is a sample server for a pet store.
    -termsOfService: http://example.com/terms/
    -contact:
    -  name: API Support
    -  url: http://www.example.com/support
    -  email: support@example.com
    -license:
    -  name: Apache 2.0
    -  url: http://www.apache.org/licenses/LICENSE-2.0.html
    -version: 1.0.1
    -
    -

    3.6.3. Contact Object

    -

    Contact information for the exposed API.

    -
    3.6.3.1. Fixed Fields
    - - - - - - - -
    Field Name - Type - Description -
    name - string - The identifying name of the contact person/organization. -
    url - string - The URL pointing to the contact information. MUST be in the format of a URL. -
    email - string - The email address of the contact person/organization. MUST be in the format of an email address. -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.3.2. Contact Object Example:
    -
    {
    -  "name": "API Support",
    -  "url": "http://www.example.com/support",
    -  "email": "support@example.com"
    -}
    -
    -
    name: API Support
    -url: http://www.example.com/support
    -email: support@example.com
    -
    -

    3.6.4. License Object

    -

    License information for the exposed API.

    -
    3.6.4.1. Fixed Fields
    - - - - - - -
    Field Name - Type - Description -
    name - string - REQUIRED. The license name used for the API. -
    url - string - A URL to the license used for the API. MUST be in the format of a URL. -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.4.2. License Object Example:
    -
    {
    -  "name": "Apache 2.0",
    -  "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    -}
    -
    -
    name: Apache 2.0
    -url: http://www.apache.org/licenses/LICENSE-2.0.html
    -
    -

    3.6.5. Server Object

    -

    An object representing a Server.

    -
    3.6.5.1. Fixed Fields
    - - - - - - - -
    Field Name - Type - Description -
    url - string - REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in {brackets}. -
    description - string - An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation. -
    variables - Map[string, Server Variable Object] - A map between a variable name and its value. The value is used for substitution in the server’s URL template. -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.5.2. Server Object Example
    -

    A single server would be described as:

    -
    {
    -  "url": "https://development.gigantic-server.com/v1",
    -  "description": "Development server"
    -}
    -
    -
    url: https://development.gigantic-server.com/v1
    -description: Development server
    -
    -

    The following shows how multiple servers can be described, for example, at the OpenAPI Object’s servers:

    -
    {
    -  "servers": [
    -    {
    -      "url": "https://development.gigantic-server.com/v1",
    -      "description": "Development server"
    -    },
    -    {
    -      "url": "https://staging.gigantic-server.com/v1",
    -      "description": "Staging server"
    -    },
    -    {
    -      "url": "https://api.gigantic-server.com/v1",
    -      "description": "Production server"
    -    }
    -  ]
    -}
    -
    -
    servers:
    -- url: https://development.gigantic-server.com/v1
    -  description: Development server
    -- url: https://staging.gigantic-server.com/v1
    -  description: Staging server
    -- url: https://api.gigantic-server.com/v1
    -  description: Production server
    -
    -

    The following shows how variables can be used for a server configuration:

    -
    {
    -  "servers": [
    -    {
    -      "url": "https://{username}.gigantic-server.com:{port}/{basePath}",
    -      "description": "The production API server",
    -      "variables": {
    -        "username": {
    -          "default": "demo",
    -          "description": "this value is assigned by the service provider, in this example gigantic-server.com"
    -        },
    -        "port": {
    -          "enum": [
    -            "8443",
    -            "443"
    -          ],
    -          "default": "8443"
    -        },
    -        "basePath": {
    -          "default": "v2"
    -        }
    -      }
    -    }
    -  ]
    -}
    -
    -
    servers:
    -- url: https://{username}.gigantic-server.com:{port}/{basePath}
    -  description: The production API server
    -  variables:
    -    username:
    -      # note! no enum here means it is an open value
    -      default: demo
    -      description: this value is assigned by the service provider, in this example gigantic-server.com
    -    port:
    -      enum:
    -        - '8443'
    -        - '443'
    -      default: '8443'
    -    basePath:
    -      # open meaning there is the opportunity to use special base paths as assigned by the provider, default is v2
    -      default: v2
    -
    -

    3.6.6. Server Variable Object

    -

    An object representing a Server Variable for server URL template substitution.

    -
    3.6.6.1. Fixed Fields
    - - - - - - - -
    Field Name - Type - Description -
    enum - [string] - An enumeration of string values to be used if the substitution options are from a limited set. -
    default - string - REQUIRED. The default value to use for substitution, and to send, if an alternate value is not supplied. Unlike the Schema Object’s default, this value MUST be provided by the consumer. -
    description - string - An optional description for the server variable. CommonMark syntax MAY be used for rich text representation. -
    -

    This object MAY be extended with Specification Extensions.

    -

    3.6.7. Components Object

    -

    Holds a set of reusable objects for different aspects of the OAS. -All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.

    -
    3.6.7.1. Fixed Fields
    - - - - - - - - - - - - - -
    Field Name - Type - Description -
    schemas - Map[string, Schema Object ¦ Reference Object] - An object to hold reusable Schema Objects. -
    responses - Map[string, Response Object ¦ Reference Object] - An object to hold reusable Response Objects. -
    parameters - Map[string, Parameter Object ¦ Reference Object] - An object to hold reusable Parameter Objects. -
    examples - Map[string, Example Object ¦ Reference Object] - An object to hold reusable Example Objects. -
    requestBodies - Map[string, Request Body Object ¦ Reference Object] - An object to hold reusable Request Body Objects. -
    headers - Map[string, Header Object ¦ Reference Object] - An object to hold reusable Header Objects. -
    securitySchemes - Map[string, Security Scheme Object ¦ Reference Object] - An object to hold reusable Security Scheme Objects. -
    links - Map[string, Link Object ¦ Reference Object] - An object to hold reusable Link Objects. -
    callbacks - Map[string, Callback Object ¦ Reference Object] - An object to hold reusable Callback Objects. -
    -

    This object MAY be extended with Specification Extensions.

    -

    All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9\.\-_]+$.

    -

    Field Name Examples:

    -
    User
    -User_1
    -User_Name
    -user-name
    -my.org.User
    -
    -
    3.6.7.2. Components Object Example
    -
    "components": {
    -  "schemas": {
    -    "Category": {
    -      "type": "object",
    -      "properties": {
    -        "id": {
    -          "type": "integer",
    -          "format": "int64"
    -        },
    -        "name": {
    -          "type": "string"
    -        }
    -      }
    -    },
    -    "Tag": {
    -      "type": "object",
    -      "properties": {
    -        "id": {
    -          "type": "integer",
    -          "format": "int64"
    -        },
    -        "name": {
    -          "type": "string"
    -        }
    -      }
    -    }
    -  },
    -  "parameters": {
    -    "skipParam": {
    -      "name": "skip",
    -      "in": "query",
    -      "description": "number of items to skip",
    -      "required": true,
    -      "schema": {
    -        "type": "integer",
    -        "format": "int32"
    -      }
    -    },
    -    "limitParam": {
    -      "name": "limit",
    -      "in": "query",
    -      "description": "max records to return",
    -      "required": true,
    -      "schema" : {
    -        "type": "integer",
    -        "format": "int32"
    -      }
    -    }
    -  },
    -  "responses": {
    -    "NotFound": {
    -      "description": "Entity not found."
    -    },
    -    "IllegalInput": {
    -      "description": "Illegal input for operation."
    -    },
    -    "GeneralError": {
    -      "description": "General Error",
    -      "content": {
    -        "application/json": {
    -          "schema": {
    -            "$ref": "#/components/schemas/GeneralError"
    -          }
    -        }
    -      }
    -    }
    -  },
    -  "securitySchemes": {
    -    "api_key": {
    -      "type": "apiKey",
    -      "name": "api_key",
    -      "in": "header"
    -    },
    -    "petstore_auth": {
    -      "type": "oauth2",
    -      "flows": {
    -        "implicit": {
    -          "authorizationUrl": "http://example.org/api/oauth/dialog",
    -          "scopes": {
    -            "write:pets": "modify pets in your account",
    -            "read:pets": "read your pets"
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    components:
    -  schemas:
    -    Category:
    -      type: object
    -      properties:
    -        id:
    -          type: integer
    -          format: int64
    -        name:
    -          type: string
    -    Tag:
    -      type: object
    -      properties:
    -        id:
    -          type: integer
    -          format: int64
    -        name:
    -          type: string
    -  parameters:
    -    skipParam:
    -      name: skip
    -      in: query
    -      description: number of items to skip
    -      required: true
    -      schema:
    -        type: integer
    -        format: int32
    -    limitParam:
    -      name: limit
    -      in: query
    -      description: max records to return
    -      required: true
    -      schema:
    -        type: integer
    -        format: int32
    -  responses:
    -    NotFound:
    -      description: Entity not found.
    -    IllegalInput:
    -      description: Illegal input for operation.
    -    GeneralError:
    -      description: General Error
    -      content:
    -        application/json:
    -          schema:
    -            $ref: '#/components/schemas/GeneralError'
    -  securitySchemes:
    -    api_key:
    -      type: apiKey
    -      name: api_key
    -      in: header
    -    petstore_auth:
    -      type: oauth2
    -      flows: 
    -        implicit:
    -          authorizationUrl: http://example.org/api/oauth/dialog
    -          scopes:
    -            write:pets: modify pets in your account
    -            read:pets: read your pets
    -
    -

    3.6.8. Paths Object

    -

    Holds the relative paths to the individual endpoints and their operations. -The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.

    -
    3.6.8.1. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    /{path} - Path Item Object - A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended (no relative URL resolution) to the expanded URL from the Server Object’s url field in order to construct the full URL. Path templating is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it’s up to the tooling to decide which one to use. -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.8.2. Path Templating Matching
    -

    Assuming the following paths, the concrete definition, /pets/mine, will be matched first if used:

    -
    /pets/{petId}
    -/pets/mine
    -
    -

    The following paths are considered identical and invalid:

    -
    /pets/{petId}
    -/pets/{name}
    -
    -

    The following may lead to ambiguous resolution:

    -
    /{entity}/me
    -/books/{id}
    -
    -
    3.6.8.3. Paths Object Example
    -
    {
    -  "/pets": {
    -    "get": {
    -      "description": "Returns all pets from the system that the user has access to",
    -      "responses": {
    -        "200": {          
    -          "description": "A list of pets.",
    -          "content": {
    -            "application/json": {
    -              "schema": {
    -                "type": "array",
    -                "items": {
    -                  "$ref": "#/components/schemas/pet"
    -                }
    -              }
    -            }
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    /pets:
    -  get:
    -    description: Returns all pets from the system that the user has access to
    -    responses:
    -      '200':
    -        description: A list of pets.
    -        content:
    -          application/json:
    -            schema:
    -              type: array
    -              items:
    -                $ref: '#/components/schemas/pet'
    -
    -

    3.6.9. Path Item Object

    -

    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.

    -
    3.6.9.1. Fixed Fields
    - - - - - - - - - - - - - - - - - -
    Field Name - Type - Description -
    $ref - string - 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. -
    summary - string - An optional, string summary, intended to apply to all operations in this path. -
    description - string - An optional, string description, intended to apply to all operations in this path. CommonMark syntax MAY be used for rich text representation. -
    get - Operation Object - A definition of a GET operation on this path. -
    put - Operation Object - A definition of a PUT operation on this path. -
    post - Operation Object - A definition of a POST operation on this path. -
    delete - Operation Object - A definition of a DELETE operation on this path. -
    options - Operation Object - A definition of a OPTIONS operation on this path. -
    head - Operation Object - A definition of a HEAD operation on this path. -
    patch - Operation Object - A definition of a PATCH operation on this path. -
    trace - Operation Object - A definition of a TRACE operation on this path. -
    servers - [Server Object] - An alternative server array to service all operations in this path. -
    parameters - [Parameter Object ¦ Reference Object] - 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 OpenAPI Object’s components/parameters. -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.9.2. Path Item Object Example
    -
    {
    -  "get": {
    -    "description": "Returns pets based on ID",
    -    "summary": "Find pets by ID",
    -    "operationId": "getPetsById",
    -    "responses": {
    -      "200": {
    -        "description": "pet response",
    -        "content": {
    -          "*/*": {
    -            "schema": {
    -              "type": "array",
    -              "items": {
    -                "$ref": "#/components/schemas/Pet"
    -              }
    -            }
    -          }
    -        }
    -      },
    -      "default": {
    -        "description": "error payload",
    -        "content": {
    -          "text/html": {
    -            "schema": {
    -              "$ref": "#/components/schemas/ErrorModel"
    -            }
    -          }
    -        }
    -      }
    -    }
    -  },
    -  "parameters": [
    -    {
    -      "name": "id",
    -      "in": "path",
    -      "description": "ID of pet to use",
    -      "required": true,
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "type": "string"
    -        }
    -      },
    -      "style": "simple"
    -    }
    -  ]
    -}
    -
    -
    get:
    -  description: Returns pets based on ID
    -  summary: Find pets by ID
    -  operationId: getPetsById
    -  responses:
    -    '200':
    -      description: pet response
    -      content:
    -        '*/*' :
    -          schema:
    -            type: array
    -            items:
    -              $ref: '#/components/schemas/Pet'
    -    default:
    -      description: error payload
    -      content:
    -        'text/html':
    -          schema:
    -            $ref: '#/components/schemas/ErrorModel'
    -parameters:
    -- name: id
    -  in: path
    -  description: ID of pet to use
    -  required: true
    -  schema:
    -    type: array
    -    style: simple
    -    items:
    -      type: string  
    -
    -

    3.6.10. Operation Object

    -

    Describes a single API operation on a path.

    -
    3.6.10.1. Fixed Fields
    - - - - - - - - - - - - - - - - -
    Field Name - Type - Description -
    tags - [string] - A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. -
    summary - string - A short summary of what the operation does. -
    description - string - A verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation. -
    externalDocs - External Documentation Object - Additional external documentation for this operation. -
    operationId - string - 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 - [Parameter Object ¦ Reference Object] - 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 OpenAPI Object’s components/parameters. -
    requestBody - Request Body Object ¦ Reference Object - The request body applicable for this operation. The requestBody is only supported in HTTP methods where the HTTP 1.1 specification [rfc7231]section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers. -
    responses - Responses Object - REQUIRED. The list of possible responses as they are returned from executing this operation. -
    callbacks - Map[string, Callback Object ¦ Reference Object] - A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. -
    deprecated - boolean - Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is false. -
    security - [Security Requirement Object] - A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used. -
    servers - [Server Object] - An alternative server array to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value. -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.10.2. Operation Object Example
    -
    {
    -  "tags": [
    -    "pet"
    -  ],
    -  "summary": "Updates a pet in the store with form data",
    -  "operationId": "updatePetWithForm",
    -  "parameters": [
    -    {
    -      "name": "petId",
    -      "in": "path",
    -      "description": "ID of pet that needs to be updated",
    -      "required": true,
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  ],
    -  "requestBody": {
    -    "content": {
    -      "application/x-www-form-urlencoded": {
    -        "schema": {
    -          "type": "object",
    -           "properties": {
    -              "name": { 
    -                "description": "Updated name of the pet",
    -                "type": "string"
    -              },
    -              "status": {
    -                "description": "Updated status of the pet",
    -                "type": "string"
    -             }
    -           },
    -        "required": ["status"] 
    -        }
    -      }
    -    }
    -  },
    -  "responses": {
    -    "200": {
    -      "description": "Pet updated.",
    -      "content": {
    -        "application/json": {},
    -        "application/xml": {}
    -      }
    -    },
    -    "405": {
    -      "description": "Invalid input",
    -      "content": {
    -        "application/json": {},
    -        "application/xml": {}
    -      }
    -    }
    -  },
    -  "security": [
    -    {
    -      "petstore_auth": [
    -        "write:pets",
    -        "read:pets"
    -      ]
    -    }
    -  ]
    -}
    -
    -
    tags:
    -- pet
    -summary: Updates a pet in the store with form data
    -operationId: updatePetWithForm
    -parameters:
    -- name: petId
    -  in: path
    -  description: ID of pet that needs to be updated
    -  required: true
    -  schema:
    -    type: string
    -requestBody:
    -  content:
    -    'application/x-www-form-urlencoded':
    -      schema:
    -       properties:
    -          name: 
    -            description: Updated name of the pet
    -            type: string
    -          status:
    -            description: Updated status of the pet
    -            type: string
    -       required:
    -         - status
    -responses:
    -  '200':
    -    description: Pet updated.
    -    content: 
    -      'application/json': {}
    -      'application/xml': {}
    -  '405':
    -    description: Invalid input
    -    content: 
    -      'application/json': {}
    -      'application/xml': {}
    -security:
    -- petstore_auth:
    -  - write:pets
    -  - read:pets
    -
    -

    3.6.11. External Documentation Object

    -

    Allows referencing an external resource for extended documentation.

    -
    3.6.11.1. Fixed Fields
    - - - - - - -
    Field Name - Type - Description -
    description - string - A short description of the target documentation. CommonMark syntax MAY be used for rich text representation. -
    url - string - REQUIRED. The URL for the target documentation. Value MUST be in the format of a URL. -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.11.2. External Documentation Object Example
    -
    {
    -  "description": "Find more info here",
    -  "url": "https://example.com"
    -}
    -
    -
    description: Find more info here
    -url: https://example.com
    -
    -

    3.6.12. Parameter Object

    -

    Describes a single operation parameter.

    -

    A unique parameter is defined by a combination of a name and location.

    -
    3.6.12.1. Parameter Locations
    -

    There are four possible parameter locations specified by the in field:

    -
      -
    • path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId. -
    • query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id. -
    • header - Custom headers that are expected as part of the request. Note that [rfc7230]page-22) states header names are case insensitive. -
    • cookie - Used to pass a specific cookie value to the API. -
    -
    3.6.12.2. Fixed Fields
    - - - - - - - - - - -
    Field Name - Type - Description -
    name - string - - REQUIRED. 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. -
    • If in is "header" and the name field is "Accept", "Content-Type" or "Authorization", the parameter definition SHALL be ignored. -
    • For all other cases, the name corresponds to the parameter name used by the in property. -
    -
    in - string - REQUIRED. The location of the parameter. Possible values are “query”, “header”, “path” or “cookie”. -
    description - string - A brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation. -
    required - boolean - Determines whether this parameter is mandatory. If the parameter location is “path”, this property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and its default value is false. -
    deprecated - boolean - Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. -
    allowEmptyValue - boolean - Sets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored. -
    -

    The rules for serialization of the parameter are specified in one of two ways. -For simpler scenarios, a schema and style can describe the structure and syntax of the parameter.

    - - - - - - - - - - -
    Field Name - Type - Description -
    style - string - Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form. -
    explode - boolean - When this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. -
    allowReserved - boolean - Determines whether the parameter value SHOULD allow reserved characters, as defined by [rfc3986]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false. -
    schema - Schema Object ¦ Reference Object - The schema defining the type used for the parameter. -
    example - Any - Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The example object is mutually exclusive of the examples object. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary. -
    examples - Map[ string, Example Object ¦ Reference Object] - Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The examples object is mutually exclusive of the example object. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema. -
    -

    For more complex scenarios, the content property can define the media type and schema of the parameter. -A parameter MUST contain either a schema property, or a content property, but not both. -When example or examples are provided in conjunction with the schema object, the example MUST follow the prescribed serialization strategy for the parameter.

    - - - - - -
    Field Name - Type - Description -
    content - Map[string, Media Type Object] - A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry. -
    -
    3.6.12.3. Style Values
    -

    In order to support common ways of serializing simple parameters, a set of style values are defined.

    - - - - - - - - - - - -
    style - type - in - Comments -
    matrix - primitive, array, object - path - Path-style parameters defined by [rfc6570]section-3.2.7) -
    label - primitive, array, object - path - Label style parameters defined by [rfc6570]section-3.2.5) -
    form - primitive, array, object - query, cookie - Form style parameters defined by [rfc6570]section-3.2.8). This option replaces collectionFormat with a csv (when explode is false) or multi (when explode is true) value from OpenAPI 2.0. -
    simple - array - path, header - Simple style parameters defined by [rfc6570]section-3.2.2). This option replaces collectionFormat with a csv value from OpenAPI 2.0. -
    spaceDelimited - array - query - Space separated array values. This option replaces collectionFormat equal to ssv from OpenAPI 2.0. -
    pipeDelimited - array - query - Pipe separated array values. This option replaces collectionFormat equal to pipes from OpenAPI 2.0. -
    deepObject - object - query - Provides a simple way of rendering nested objects using form parameters. -
    -
    3.6.12.4. Style Examples
    -

    Assume a parameter named color has one of the following values:

    -
    string -> "blue"
    -array -> ["blue","black","brown"]
    -object -> { "R": 100, "G": 200, "B": 150 }
    -
    -

    The following table shows examples of rendering differences for each value.

    - - - - - - - - - - - - - - - -
    style - explode - empty - string - array - object -
    matrix - false - ;color - ;color=blue - ;color=blue,black,brown - ;color=R,100,G,200,B,150 -
    matrix - true - ;color - ;color=blue - ;color=blue;color=black;color=brown - ;R=100;G=200;B=150 -
    label - false - . - .blue - .blue.black.brown - .R.100.G.200.B.150 -
    label - true - . - .blue - .blue.black.brown - .R=100.G=200.B=150 -
    form - false - color= - color=blue - color=blue,black,brown - color=R,100,G,200,B,150 -
    form - true - color= - color=blue - color=blue&color=black&color=brown - R=100&G=200&B=150 -
    simple - false - n/a - blue - blue,black,brown - R,100,G,200,B,150 -
    simple - true - n/a - blue - blue,black,brown - R=100,G=200,B=150 -
    spaceDelimited - false - n/a - n/a - blue%20black%20brown - R%20100%20G%20200%20B%20150 -
    pipeDelimited - false - n/a - n/a - blue¦black¦brown - R¦100¦G¦200 -
    deepObject - true - n/a - n/a - n/a - color[R]=100&color[G]=200&color[B]=150 -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.12.5. Parameter Object Examples
    -

    A header parameter with an array of 64 bit integer numbers:

    -
    {
    -  "name": "token",
    -  "in": "header",
    -  "description": "token to be passed as a header",
    -  "required": true,
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "type": "integer",
    -      "format": "int64"
    -    }
    -  },
    -  "style": "simple"
    -}
    -
    -
    name: token
    -in: header
    -description: token to be passed as a header
    -required: true
    -schema:
    -  type: array
    -  items:
    -    type: integer
    -    format: int64
    -style: simple
    -
    -

    A path parameter of a string value:

    -
    {
    -  "name": "username",
    -  "in": "path",
    -  "description": "username to fetch",
    -  "required": true,
    -  "schema": {
    -    "type": "string"
    -  }
    -}
    -
    -
    name: username
    -in: path
    -description: username to fetch
    -required: true
    -schema:
    -  type: string
    -
    -

    An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

    -
    {
    -  "name": "id",
    -  "in": "query",
    -  "description": "ID of the object to fetch",
    -  "required": false,
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    }
    -  },
    -  "style": "form",
    -  "explode": true
    -}
    -
    -
    name: id
    -in: query
    -description: ID of the object to fetch
    -required: false
    -schema:
    -  type: array
    -  items:
    -    type: string
    -style: form
    -explode: true
    -
    -

    A free-form query parameter, allowing undefined parameters of a specific type:

    -
    {
    -  "in": "query",
    -  "name": "freeForm",
    -  "schema": {
    -    "type": "object",
    -    "additionalProperties": {
    -      "type": "integer"
    -    },
    -  },
    -  "style": "form"
    -}
    -
    -
    in: query
    -name: freeForm
    -schema:
    -  type: object
    -  additionalProperties:
    -    type: integer
    -style: form
    -
    -

    A complex parameter using content to define serialization:

    -
    {
    -  "in": "query",
    -  "name": "coordinates",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "type": "object",
    -        "required": [
    -          "lat",
    -          "long"
    -        ],
    -        "properties": {
    -          "lat": {
    -            "type": "number"
    -          },
    -          "long": {
    -            "type": "number"
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    in: query
    -name: coordinates
    -content:
    -  application/json:
    -    schema:
    -      type: object
    -      required:
    -        - lat
    -        - long
    -      properties:
    -        lat:
    -          type: number
    -        long:
    -          type: number
    -
    -

    3.6.13. Request Body Object

    -

    Describes a single request body.

    -
    3.6.13.1. Fixed Fields
    - - - - - - - -
    Field Name - Type - Description -
    description - string - A brief description of the request body. This could contain examples of use. CommonMark syntax MAY be used for rich text representation. -
    content - Map[string, Media Type Object] - REQUIRED. The content of the request body. The key is a media type or [media type range]appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* -
    required - boolean - Determines if the request body is required in the request. Defaults to false. -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.13.2. Request Body Examples
    -

    A request body with a referenced model definition.

    -
    {
    -  "description": "user to add to the system",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "$ref": "#/components/schemas/User"
    -      },
    -      "examples": {
    -          "user" : {
    -            "summary": "User Example", 
    -            "externalValue": "http://foo.bar/examples/user-example.json"
    -          } 
    -        }
    -    },
    -    "application/xml": {
    -      "schema": {
    -        "$ref": "#/components/schemas/User"
    -      },
    -      "examples": {
    -          "user" : {
    -            "summary": "User example in XML",
    -            "externalValue": "http://foo.bar/examples/user-example.xml"
    -          }
    -        }
    -    },
    -    "text/plain": {
    -      "examples": {
    -        "user" : {
    -            "summary": "User example in Plain text",
    -            "externalValue": "http://foo.bar/examples/user-example.txt" 
    -        }
    -      } 
    -    },
    -    "*/*": {
    -      "examples": {
    -        "user" : {
    -            "summary": "User example in other format",
    -            "externalValue": "http://foo.bar/examples/user-example.whatever"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    description: user to add to the system
    -content: 
    -  'application/json':
    -    schema:
    -      $ref: '#/components/schemas/User'
    -    examples:
    -      user:
    -        summary: User Example
    -        externalValue: 'http://foo.bar/examples/user-example.json'
    -  'application/xml':
    -    schema:
    -      $ref: '#/components/schemas/User'
    -    examples:
    -      user:
    -        summary: User Example in XML
    -        externalValue: 'http://foo.bar/examples/user-example.xml'
    -  'text/plain':
    -    examples:
    -      user:
    -        summary: User example in text plain format
    -        externalValue: 'http://foo.bar/examples/user-example.txt'
    -  '*/*':
    -    examples:
    -      user: 
    -        summary: User example in other format
    -        externalValue: 'http://foo.bar/examples/user-example.whatever'
    -
    -

    A body parameter that is an array of string values:

    -
    {
    -  "description": "user to add to the system",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "type": "string"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    description: user to add to the system
    -required: true
    -content:
    -  text/plain:
    -    schema:
    -      type: array
    -      items:
    -        type: string
    -
    -

    3.6.14. Media Type Object

    -

    Each Media Type Object provides schema and examples for the media type identified by its key.

    -
    3.6.14.1. Fixed Fields
    - - - - - - - - -
    Field Name - Type - Description -
    schema - Schema Object ¦ Reference Object - The schema defining the type used for the request body. -
    example - Any - Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The example object is mutually exclusive of the examples object. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema. -
    examples - Map[ string, Example Object ¦ Reference Object] - Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The examples object is mutually exclusive of the example object. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema. -
    encoding - Map[string, Encoding Object] - A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded. -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.14.2. Media Type Examples
    -
    {
    -  "application/json": {
    -    "schema": {
    -         "$ref": "#/components/schemas/Pet"
    -    },
    -    "examples": {
    -      "cat" : {
    -        "summary": "An example of a cat",
    -        "value": 
    -          {
    -            "name": "Fluffy",
    -            "petType": "Cat",
    -            "color": "White",
    -            "gender": "male",
    -            "breed": "Persian"
    -          }
    -      },
    -      "dog": {
    -        "summary": "An example of a dog with a cat’s name",
    -        "value" :  { 
    -          "name": "Puma",
    -          "petType": "Dog",
    -          "color": "Black",
    -          "gender": "Female",
    -          "breed": "Mixed"
    -        },
    -      "frog": {
    -          "$ref": "#/components/examples/frog-example"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    application/json: 
    -  schema:
    -    $ref: "#/components/schemas/Pet"
    -  examples:
    -    cat:
    -      summary: An example of a cat
    -      value:
    -        name: Fluffy
    -        petType: Cat
    -        color: White
    -        gender: male
    -        breed: Persian
    -    dog:
    -      summary: An example of a dog with a cat’s name
    -      value:
    -        name: Puma
    -        petType: Dog
    -        color: Black
    -        gender: Female
    -        breed: Mixed
    -    frog:
    -      $ref: "#/components/examples/frog-example"
    -
    -
    3.6.14.3. Considerations for File Uploads
    -

    In contrast with the 2.0 specification, file input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically:

    -
    # content transferred with base64 encoding
    -schema:
    -  type: string
    -  format: base64
    -
    -
    # content transferred in binary (octet-stream):
    -schema:
    -  type: string
    -  format: binary
    -
    -

    These examples apply to either input payloads of file uploads or response payloads.

    -

    A requestBody for submitting a file in a POST operation may look like the following example:

    -
    requestBody:
    -  content:
    -    application/octet-stream:
    -      # any media type is accepted, functionally equivalent to */*
    -      schema:
    -        # a binary file of any type
    -        type: string
    -        format: binary
    -
    -

    In addition, specific media types MAY be specified:

    -
    # multiple, specific media types may be specified:
    -requestBody:
    -  content:
    -      # a binary file of type png or jpeg
    -    'image/jpeg':
    -      schema:
    -        type: string
    -        format: binary
    -    'image/png':
    -      schema:
    -        type: string
    -        format: binary        
    -
    -

    To upload multiple files, a multipart media type MUST be used:

    -
    requestBody:
    -  content:
    -    multipart/form-data:
    -      schema:
    -        properties:
    -          # The property name 'file' will be used for all files.
    -          file:
    -            type: array
    -            items:
    -              type: string
    -              format: binary
    -
    -
    -
    3.6.14.4. Support for x-www-form-urlencoded Request Bodies
    -

    To submit content using form url encoding via [rfc1866], the following -definition may be used:

    -
    requestBody:
    -  content:
    -    application/x-www-form-urlencoded:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            type: string
    -            format: uuid
    -          address:
    -            # complex types are stringified to support RFC 1866
    -            type: object
    -            properties: {}
    -
    -

    In this example, the contents in the requestBody MUST be stringified per [rfc1866]) when passed to the server. In addition, the address field complex object will be stringified.

    -

    When passing complex objects in the application/x-www-form-urlencoded content type, the default serialization strategy of such properties is described in the Encoding Object’s style property as form.

    -
    3.6.14.5. Special Considerations for multipart Content
    -

    It is common to use multipart/form-data as a Content-Type when transferring request bodies to operations. In contrast to 2.0, a schema is REQUIRED to define the input parameters to the operation when using multipart content. This supports complex structures as well as supporting mechanisms for multiple file uploads.

    -

    When passing in multipart types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default Content-Types are defined for multipart:

    -
      -
    • If the property is a primitive, or an array of primitive values, the default Content-Type is text/plain -
    • If the property is complex, or an array of complex values, the default Content-Type is application/json -
    • If the property is a type: string with format: binary or format: base64 (aka a file object), the default Content-Type is application/octet-stream -
    -

    Examples:

    -
    requestBody:
    -  content:
    -    multipart/form-data:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            type: string
    -            format: uuid
    -          address:
    -            # default Content-Type for objects is application/json
    -            type: object
    -            properties: {}
    -          profileImage:
    -            # default Content-Type for string/binary is application/octet-stream
    -            type: string
    -            format: binary
    -          children:
    -            # default Content-Type for arrays is based on the inner type (text/plain here)
    -            type: array
    -            items:
    -              type: string
    -          addresses:
    -            # default Content-Type for arrays is based on the inner type (object shown, so application/json in this example)
    -            type: array
    -            items:
    -              type: '#/components/schemas/Address'
    -
    -

    An encoding attribute is introduced to give you control over the serialization of parts of multipart request bodies. This attribute is only applicable to multipart and application/x-www-form-urlencoded request bodies.

    -

    3.6.15. Encoding Object

    -

    A single encoding definition applied to a single schema property.

    -
    3.6.15.1. Fixed Fields
    - - - - - - - - - -
    Field Name - Type - Description -
    contentType - string - The Content-Type for encoding a specific property. Default value depends on the property type: for string with format being binaryapplication/octet-stream; for other primitive types – text/plain; for object - application/json; for array – the default is defined based on the inner type. The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types. -
    headers - Map[string, Header Object ¦ Reference Object] - A map allowing additional information to be provided as headers, for example Content-Disposition. Content-Type is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a multipart. -
    style - string - Describes how a specific property value will be serialized depending on its type. See Parameter Object for details on the style property. The behavior follows the same values as query parameters, including default values. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded. -
    explode - boolean - When this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded. -
    allowReserved - boolean - Determines whether the parameter value SHOULD allow reserved characters, as defined by [rfc3986]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded. -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.15.2. Encoding Object Example
    -
    requestBody:
    -  content:
    -    multipart/mixed:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            # default is text/plain
    -            type: string
    -            format: uuid
    -          address:
    -            # default is application/json
    -            type: object
    -            properties: {}
    -          historyMetadata:
    -            # need to declare XML format!
    -            description: metadata in XML format
    -            type: object
    -            properties: {}
    -          profileImage:
    -            # default is application/octet-stream, need to declare an image type only!
    -            type: string
    -            format: binary
    -      encoding:
    -        historyMetadata:
    -          # require XML Content-Type in utf-8 encoding
    -          contentType: application/xml; charset=utf-8
    -        profileImage:
    -          # only accept png/jpeg
    -          contentType: image/png, image/jpeg
    -          headers:
    -            X-Rate-Limit-Limit:
    -              description: The number of allowed requests in the current period
    -              schema:
    -                type: integer
    -
    -

    3.6.16. Responses Object

    -

    A container for the expected responses of an operation. -The container maps a HTTP response code to the expected response.

    -

    The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. -However, documentation is expected to cover a successful operation response and any known errors.

    -

    The default MAY be used as a default response object for all HTTP codes -that are not covered individually by the specification.

    -

    The Responses Object MUST contain at least one response code, and it -SHOULD be the response for a successful operation call.

    -
    3.6.16.1. Fixed Fields
    - - - - - -
    Field Name - Type - Description -
    default - Response Object ¦ Reference Object - The documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. A Reference Object can link to a response that the OpenAPI Object’s components/responses section defines. -
    -
    3.6.16.2. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    HTTP Status Code - Response Object ¦ Reference Object - Any HTTP status code can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A Reference Object can link to a response that is defined in the OpenAPI Object’s components/responses section. This field MUST be enclosed in quotation marks (for example, “200”) for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character X. For example, 2XX represents all response codes between [200-299]. The following range definitions are allowed: 1XX, 2XX, 3XX, 4XX, and 5XX. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code. -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.16.3. Responses Object Example
    -

    A 200 response for a successful operation and a default response for others (implying an error):

    -
    {
    -  "200": {
    -    "description": "a pet to be returned",
    -    "content": {
    -      "application/json": {
    -        "schema": {
    -          "$ref": "#/components/schemas/Pet"
    -        }
    -      }
    -    }
    -  },
    -  "default": {
    -    "description": "Unexpected error",
    -    "content": {
    -      "application/json": {
    -        "schema": {
    -          "$ref": "#/components/schemas/ErrorModel"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    '200':
    -  description: a pet to be returned
    -  content: 
    -    application/json:
    -      schema:
    -        $ref: '#/components/schemas/Pet'
    -default:
    -  description: Unexpected error
    -  content:
    -    application/json:
    -      schema:
    -        $ref: '#/components/schemas/ErrorModel'
    -
    -

    3.6.17. Response Object

    -

    Describes a single response from an API Operation, including design-time, static links to operations based on the response.

    -
    3.6.17.1. Fixed Fields
    - - - - - - - - -
    Field Name - Type - Description -
    description - string - REQUIRED. A short description of the response. CommonMark syntax MAY be used for rich text representation. -
    headers - Map[string, Header Object ¦ Reference Object] - Maps a header name to its definition. [rfc7230]page-22) states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored. -
    content - Map[string, Media Type Object] - A map containing descriptions of potential response payloads. The key is a media type or [media type range]appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* -
    links - Map[string, Link Object ¦ Reference Object] - A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for Component Objects. -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.17.2. Response Object Examples
    -

    Response of an array of a complex type:

    -
    {
    -  "description": "A complex object array response",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "$ref": "#/components/schemas/VeryComplexType"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    description: A complex object array response
    -content: 
    -  application/json:
    -    schema: 
    -      type: array
    -      items:
    -        $ref: '#/components/schemas/VeryComplexType'
    -
    -

    Response with a string type:

    -
    {
    -  "description": "A simple string response",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  }
    -
    -}
    -
    -
    description: A simple string response
    -representations:
    -  text/plain:
    -    schema:
    -      type: string
    -
    -

    Plain text response with headers:

    -
    {
    -  "description": "A simple string response",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  },
    -  "headers": {
    -    "X-Rate-Limit-Limit": {
    -      "description": "The number of allowed requests in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    },
    -    "X-Rate-Limit-Remaining": {
    -      "description": "The number of remaining requests in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    },
    -    "X-Rate-Limit-Reset": {
    -      "description": "The number of seconds left in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    }
    -  }
    -}
    -
    -
    description: A simple string response
    -content:
    -  text/plain:
    -    schema:
    -      type: string
    -    example: 'whoa!'
    -headers:
    -  X-Rate-Limit-Limit:
    -    description: The number of allowed requests in the current period
    -    schema:
    -      type: integer
    -  X-Rate-Limit-Remaining:
    -    description: The number of remaining requests in the current period
    -    schema:
    -      type: integer
    -  X-Rate-Limit-Reset:
    -    description: The number of seconds left in the current period
    -    schema:
    -      type: integer
    -
    -

    Response with no return value:

    -
    {
    -  "description": "object created"
    -}
    -
    -
    description: object created
    -
    -

    3.6.18. Callback Object

    -

    A map of possible out-of band callbacks related to the parent operation. -Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. -The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

    -
    3.6.18.1. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    {expression} - Path Item Object - A Path Item Object used to define a callback request and expected responses. A complete example is available. -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.18.2. Key Expression
    -

    The key that identifies the Path Item Object is a runtime expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. -A simple example might be $request.body#/url. -However, using a runtime expression the complete HTTP message can be accessed. -This includes accessing any part of a body that a JSON Pointer [rfc6901] can reference.

    -

    For example, given the following HTTP request:

    -
    POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1
    -Host: example.org
    -Content-Type: application/json
    -Content-Length: 187
    -
    -{
    -  "failedUrl" : "http://clientdomain.com/failed",
    -  "successUrls" : [
    -    "http://clientdomain.com/fast",
    -    "http://clientdomain.com/medium",
    -    "http://clientdomain.com/slow"
    -  ] 
    -}
    -
    -201 Created
    -Location: http://example.org/subscription/1
    -
    -

    The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named eventType and a query parameter named queryUrl.

    - - - - - - - - - - - - -
    Expression - Value -
    $url - http://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning -
    $method - POST -
    $request.path.eventType - myevent -
    $request.query.queryUrl - http://clientdomain.com/stillrunning -
    $request.header.content-Type - application/json -
    $request.body#/failedUrl - http://clientdomain.com/stillrunning -
    $request.body#/successUrls/2 - http://clientdomain.com/medium -
    $response.header.Location - http://example.org/subscription/1 -
    -
    3.6.18.3. Callback Object Example
    -

    The following example shows a callback to the URL specified by the id and email property in the request body.

    -
    myWebhook:
    -  'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
    -    post:
    -      requestBody:
    -        description: Callback payload
    -        content: 
    -          'application/json':
    -            schema:
    -              $ref: '#/components/schemas/SomePayload'
    -      responses:
    -        '200':
    -          description: webhook successfully processed and no retries will be performed
    -
    -

    3.6.19. Example Object

    -
    3.6.19.1. Fixed Fields
    - - - - - - - - -
    Field Name - Type - Description -
    summary - string - Short description for the example. -
    description - string - Long description for the example. CommonMark syntax MAY be used for rich text representation. -
    value - Any - Embedded literal example. The value field and externalValue field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary. -
    externalValue - string - A URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The value field and externalValue field are mutually exclusive. -
    -

    This object MAY be extended with Specification Extensions.

    -

    In all cases, the example value is expected to be compatible with the type schema -of its associated value. Tooling implementations MAY choose to -validate compatibility automatically, and reject the example value(s) if incompatible.

    -
    3.6.19.2. Example Object Example
    -
    # in a model
    -schemas:
    -  properties:
    -    name:
    -      type: string
    -      examples:
    -        name:
    -          $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example
    -
    -# in a request body:
    -  requestBody:
    -    content:
    -      'application/json':
    -        schema:
    -          $ref: '#/components/schemas/Address'
    -        examples: 
    -          foo:
    -            summary: A foo example
    -            value: {"foo": "bar"}
    -          bar:
    -            summary: A bar example
    -            value: {"bar": "baz"}
    -      'application/xml':
    -        examples: 
    -          xmlExample:
    -            summary: This is an example in XML
    -            externalValue: 'http://example.org/examples/address-example.xml'
    -      'text/plain':
    -        examples:
    -          textExample: 
    -            summary: This is a text example
    -            externalValue: 'http://foo.bar/examples/address-example.txt' 
    -
    -
    -# in a parameter
    -  parameters:
    -    - name: 'zipCode'
    -      in: 'query'
    -      schema:
    -        type: 'string'
    -        format: 'zip-code'
    -        examples:
    -          zip-example: 
    -            $ref: '#/components/examples/zip-example'
    -
    -# in a response
    -  responses:
    -    '200':
    -      description: your car appointment has been booked
    -      content: 
    -        application/json:
    -          schema:
    -            $ref: '#/components/schemas/SuccessResponse'
    -          examples:
    -            confirmation-success:
    -              $ref: '#/components/examples/confirmation-success'
    -
    - -

    The Link object represents a possible design-time link for a response. -The presence of a link does not guarantee the caller’s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.

    -

    Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.

    -

    For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.

    -
    3.6.20.1. Fixed Fields
    - - - - - - - - - - -
    Field Name - Type - Description -
    operationRef - string - A relative or absolute reference to an OAS operation. This field is mutually exclusive of the operationId field, and MUST point to an Operation Object. Relative operationRef values MAY be used to locate an existing Operation Object in the OpenAPI definition. -
    operationId - string - The name of an existing, resolvable OAS operation, as defined with a unique operationId. This field is mutually exclusive of the operationRef field. -
    parameters - Map[string, Any ¦ {expression}] - A map representing parameters to pass to an operation as specified with operationId or identified via operationRef. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id). -
    requestBody - Any ¦ {expression} - A literal value or {expression} to use as a request body when calling the target operation. -
    description - string - A description of the link. CommonMark syntax MAY be used for rich text representation. -
    server - Server Object - A server object to be used by the target operation. -
    -

    This object MAY be extended with Specification Extensions.

    -

    A linked operation MUST be identified using either an operationRef or operationId. -In the case of an operationId, it MUST be unique and resolved in the scope of the OAS document. -Because of the potential for name clashes, the operationRef syntax is preferred -for specifications with external references.

    -
    3.6.20.2. Examples
    -

    Computing a link from a request operation where the $request.path.id is used to pass a request parameter to the linked operation.

    -
    paths:
    -  /users/{id}:
    -    parameters:
    -    - name: id
    -      in: path
    -      required: true
    -      description: the user identifier, as userId 
    -      schema:
    -        type: string
    -    get:
    -      responses:
    -        '200':
    -          description: the user being returned
    -          content:
    -            application/json:
    -              schema:
    -                type: object
    -                properties:
    -                  uuid: # the unique user id
    -                    type: string
    -                    format: uuid
    -        links:
    -          address:
    -            # the target link operationId
    -            operationId: getUserAddress
    -            parameters:
    -              # get the id field from the request path parameter named id
    -              userId: $request.path.id
    -  # the path item of the linked operation
    -  /users/{userid}/address:
    -    parameters:
    -    - name: userid
    -      in: path
    -      required: true
    -      description: the user identifier, as userId 
    -      schema:
    -        type: string
    -      # linked operation
    -      get:
    -        operationId: getUserAddress
    -        responses:
    -          '200':
    -            description: the user’s address
    -
    -

    When a runtime expression fails to evaluate, no parameter value is passed to the target operation.

    -

    Values from the response body can be used to drive a linked operation.

    -
    links:
    -  address:
    -    operationId: getUserAddressByUUID
    -    parameters:
    -      # get the id field from the request path parameter named id
    -      userUuid: $response.body#/uuid
    -
    -

    Clients follow all links at their discretion. -Neither permissions, nor the capability to make a successful call to that link, is guaranteed -solely by the existence of a relationship.

    -
    3.6.20.3. OperationRef Examples
    -

    As references to operationId MAY NOT be possible (the operationId is an optional -value), references MAY also be made through a relative operationRef:

    -
    links:
    -  UserRepositories:
    -    # returns array of '#/components/schemas/repository'
    -    operationRef: '#/paths/~12.0~1repositories~1{username}/get'
    -    parameters:
    -      username: $response.body#/username
    -
    -

    or an absolute operationRef:

    -
    links:
    -  UserRepositories:
    -    # returns array of '#/components/schemas/repository'
    -    operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get'
    -    parameters:
    -      username: $response.body#/username
    -
    -

    Note that in the use of operationRef, the escaped forward-slash is necessary when -using JSON references.

    -
    3.6.20.4. Runtime Expressions
    -

    Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. -This mechanism is used by Link Objects and Callback Objects.

    -

    The runtime expression is defined by the following [Augmented Backus-Naur Form] syntax

    -
    expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source )
    -source = ( header-reference | query-reference | path-reference | body-reference )  
    -header-reference = "header." token
    -query-reference = "query." name  
    -path-reference = "path." name
    -body-reference = "body" ["#" fragment]
    -fragment = a JSON Pointer [[!rfc6901]]  
    -name = *( char )
    -char = as per RFC [7159]section-7)
    -token = as per RFC [7230]section-3.2.6)
    -
    -

    The name identifier is case-sensitive, whereas token is not.

    -

    The table below provides examples of runtime expressions and examples of their use in a value:

    -
    3.6.20.5. Examples
    - - - - - - - - - - - -
    Source Location - example expression - notes -
    HTTP Method - $method - The allowable values for the $method will be those for the HTTP operation. -
    Requested media type - $request.header.accept - -
    Request parameter - $request.path.id - Request parameters MUST be declared in the parameters section of the parent operation or they cannot be evaluated. This includes request headers. -
    Request body property - $request.body#/user/uuid - In operations which accept payloads, references may be made to portions of the requestBody or the entire body. -
    Request URL - $url - -
    Response value - $response.body#/status - In operations which return payloads, references may be made to portions of the response body or the entire body. -
    Response header - $response.header.Server - Single header values only are available -
    -

    Runtime expressions preserve the type of the referenced value. -Expressions can be embedded into string values by surrounding the expression with {} curly braces.

    -

    3.6.21. Header Object

    -

    The Header Object follows the structure of the Parameter Object with the following changes:

    -
      -
    1. name MUST NOT be specified, it is given in the corresponding headers map. -
    2. in MUST NOT be specified, it is implicitly in header. -
    3. All traits that are affected by the location MUST be applicable to a location of header (for example, style). -
    -
    3.6.21.1. Header Object Example
    -

    A simple header of type integer:

    -
    {
    -  "description": "The number of allowed requests in the current period",
    -  "schema": {
    -    "type": "integer"
    -  }
    -}
    -
    -
    description: The number of allowed requests in the current period
    -schema:
    -  type: integer
    -
    -

    3.6.22. Tag Object

    -

    Adds metadata to a single tag that is used by the Operation Object. -It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

    -
    3.6.22.1. Fixed Fields
    - - - - - - - -
    Field Name - Type - Description -
    name - string - REQUIRED. The name of the tag. -
    description - string - A short description for the tag. CommonMark syntax MAY be used for rich text representation. -
    externalDocs - External Documentation Object - Additional external documentation for this tag. -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.22.2. Tag Object Example
    -
    {
    -  "name": "pet",
    -  "description": "Pets operations"
    -}
    -
    -
    name: pet
    -description: Pets operations
    -
    -

    3.6.23. Examples Object

    -

    In an example, a JSON Reference MAY be used, with the -explicit restriction that examples having a JSON format with object named $ref are not allowed. Therefore, that example, structurally, can be -either a string primitive or an object, similar to additionalProperties.

    -

    In all cases, the payload is expected to be compatible with the type schema -for the associated value. Tooling implementations MAY choose to -validate compatibility automatically, and reject the example value(s) if they -are incompatible.

    -
    # in a model
    -schemas:
    -  properties:
    -    name:
    -      type: string
    -      example:
    -        $ref: http://foo.bar#/examples/name-example
    -
    -# in a request body, note the plural examples
    -  requestBody:
    -    content:
    -      'application/json':
    -        schema:
    -          $ref: '#/components/schemas/Address'
    -        examples:
    -          foo:
    -            value: {"foo": "bar"}
    -          bar:
    -            value: {"bar": "baz"}
    -      'application/xml':
    -        examples:
    -          xml:
    -            externalValue: 'http://foo.bar/examples/address-example.xml'
    -      'text/plain':
    -        examples:
    -          text:
    -            externalValue: 'http://foo.bar/examples/address-example.txt'
    -        
    -# in a parameter
    -  parameters:
    -    - name: 'zipCode'
    -      in: 'query'
    -      schema:
    -        type: 'string'
    -        format: 'zip-code'
    -        example: 
    -          $ref: 'http://foo.bar#/examples/zip-example'
    -
    -# in a response, note the singular example:
    -  responses:
    -    '200':
    -      description: your car appointment has been booked
    -      content: 
    -        application/json:
    -          schema:
    -            $ref: '#/components/schemas/SuccessResponse'
    -          example:
    -            $ref: http://foo.bar#/examples/address-example.json
    -
    -

    3.6.24. Reference Object

    -

    A simple object to allow referencing other components in the specification, internally and externally.

    -

    The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.

    -

    For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.

    -
    3.6.24.1. Fixed Fields
    - - - - - -
    Field Name - Type - Description -
    $ref - string - REQUIRED. The reference string. -
    -

    This object cannot be extended with additional properties and any properties added SHALL be ignored.

    -
    3.6.24.2. Reference Object Example
    -
    {
    -  "$ref": "#/components/schemas/Pet"
    -}
    -
    -
    $ref: '#/components/schemas/Pet'
    -
    -
    3.6.24.3. Relative Schema Document Example
    -
    {
    -  "$ref": "Pet.json"
    -}
    -
    -
    $ref: Pet.yaml
    -
    -
    3.6.24.4. Relative Documents With Embedded Schema Example
    -
    {
    -  "$ref": "definitions.json#/Pet"
    -}
    -
    -
    $ref: definitions.yaml#/Pet
    -
    -

    3.6.25. Schema Object

    -

    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 an extended subset of the JSON Schema Specification Wright Draft 00.

    -

    For more information about the properties, see JSON Schema Core and JSON Schema Validation. -Unless stated otherwise, the property definitions follow the JSON Schema.

    -
    3.6.25.1. Properties
    -

    The following properties are taken directly from the JSON Schema definition and follow the same specifications:

    -
      -
    • title -
    • multipleOf -
    • maximum -
    • exclusiveMaximum -
    • minimum -
    • exclusiveMinimum -
    • maxLength -
    • minLength -
    • pattern (This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect) -
    • maxItems -
    • minItems -
    • uniqueItems -
    • maxProperties -
    • minProperties -
    • required -
    • enum -
    -

    The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification.

    -
      -
    • type - Value MUST be a string. Multiple types via an array are not supported. -
    • allOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. -
    • oneOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. -
    • anyOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. -
    • not - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. -
    • items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. items MUST be present if the type is array. -
    • properties - Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced). -
    • additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. -
    • description - CommonMark syntax MAY be used for rich text representation. -
    • format - See Data Type Formats for further details. While relying on JSON Schema’s defined formats, the OAS offers a few additional predefined formats. -
    • default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if type is string, then default can be "foo" but cannot be 1. -
    -

    Alternatively, any time a Schema Object can be used, a Reference Object can be used in its place. This allows referencing definitions instead of defining them inline.

    -

    Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported.

    -

    Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation:

    -
    3.6.25.2. Fixed Fields
    - - - - - - - - - - - - -
    Field Name - Type - Description -
    nullable - boolean - Allows sending a null value for the defined schema. Default value is false. -
    discriminator - Discriminator Object - Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See Composition and Inheritance for more details. -
    readOnly - boolean - 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 SHOULD NOT be sent as part of the request. If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false. -
    writeOnly - boolean - Relevant only for Schema "properties" definitions. Declares the property as “write only”. Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as writeOnly being true and is in the required list, the required will take effect on the request only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false. -
    xml - XML Object - This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property. -
    externalDocs - External Documentation Object - Additional external documentation for this schema. -
    example - Any - A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. -
    deprecated - boolean - Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false. -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.25.3. Composition and Inheritance (Polymorphism)
    -

    The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. allOf takes an array of object definitions that are validated independently but together compose a single object.

    -

    While composition offers model extensibility, it does not imply a hierarchy between the models. -To support polymorphism, the OpenAPI Specification adds the discriminator field. -When used, the discriminator will be the name of the property that decides which schema definition validates the structure of the model. -As such, the discriminator field MUST be a required field. -There are are two ways to define the value of a discriminator for an inheriting instance.

    -
      -
    • Use the schema name. -
    • Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name. -As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism. -
    -
    3.6.25.3.1. XML Modeling
    -

    The xml property allows extra definitions when translating the JSON definition to XML. -The XML Object contains additional information about the available options.

    -
    3.6.25.4. Schema Object Examples
    -
    3.6.25.4.1. Primitive Sample
    -
    {
    -  "type": "string",
    -  "format": "email"
    -}
    -
    -
    type: string
    -format: email
    -
    -
    3.6.25.4.2. Simple Model
    -
    {
    -  "type": "object",
    -  "required": [
    -    "name"
    -  ],
    -  "properties": {
    -    "name": {
    -      "type": "string"
    -    },
    -    "address": {
    -      "$ref": "#/components/schemas/Address"
    -    },
    -    "age": {
    -      "type": "integer",
    -      "format": "int32",
    -      "minimum": 0
    -    }
    -  }
    -}
    -
    -
    type: object
    -required:
    -- name
    -properties:
    -  name:
    -    type: string
    -  address:
    -    $ref: '#/components/schemas/Address'
    -  age:
    -    type: integer
    -    format: int32
    -    minimum: 0
    -
    -
    3.6.25.4.3. Model with Map/Dictionary Properties
    -

    For a simple string to string mapping:

    -
    {
    -  "type": "object",
    -  "additionalProperties": {
    -    "type": "string"
    -  }
    -}
    -
    -
    type: object
    -additionalProperties:
    -  type: string
    -
    -

    For a string to model mapping:

    -
    {
    -  "type": "object",
    -  "additionalProperties": {
    -    "$ref": "#/components/schemas/ComplexModel"
    -  }
    -}
    -
    -
    type: object
    -additionalProperties:
    -  $ref: '#/components/schemas/ComplexModel'
    -
    -
    3.6.25.4.4. Model with Example
    -
    {
    -  "type": "object",
    -  "properties": {
    -    "id": {
    -      "type": "integer",
    -      "format": "int64"
    -    },
    -    "name": {
    -      "type": "string"
    -    }
    -  },
    -  "required": [
    -    "name"
    -  ],
    -  "example": {
    -    "name": "Puma",
    -    "id": 1
    -  }
    -}
    -
    -
    type: object
    -properties:
    -  id:
    -    type: integer
    -    format: int64
    -  name:
    -    type: string
    -required:
    -- name
    -example:
    -  name: Puma
    -  id: 1
    -
    -
    3.6.25.4.5. Models with Composition
    -
    {
    -  "components": {
    -    "schemas": {
    -      "ErrorModel": {
    -        "type": "object",
    -        "required": [
    -          "message",
    -          "code"
    -        ],
    -        "properties": {
    -          "message": {
    -            "type": "string"
    -          },
    -          "code": {
    -            "type": "integer",
    -            "minimum": 100,
    -            "maximum": 600
    -          }
    -        }
    -      },
    -      "ExtendedErrorModel": {
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/ErrorModel"
    -          },
    -          {
    -            "type": "object",
    -            "required": [
    -              "rootCause"
    -            ],
    -            "properties": {
    -              "rootCause": {
    -                "type": "string"
    -              }
    -            }
    -          }
    -        ]
    -      }
    -    }
    -  }
    -}
    -
    -
    components:
    -  schemas:
    -    ErrorModel:
    -      type: object
    -      required:
    -      - message
    -      - code
    -      properties:
    -        message:
    -          type: string
    -        code:
    -          type: integer
    -          minimum: 100
    -          maximum: 600
    -    ExtendedErrorModel:
    -      allOf:
    -      - $ref: '#/components/schemas/ErrorModel'
    -      - type: object
    -        required:
    -        - rootCause
    -        properties:
    -          rootCause:
    -            type: string
    -
    -
    3.6.25.4.6. Models with Polymorphism Support
    -
    {
    -  "components": {
    -    "schemas": {
    -      "Pet": {
    -        "type": "object",
    -        "discriminator": {
    -          "propertyName": "petType"
    -        },
    -        "properties": {
    -          "name": {
    -            "type": "string"
    -          },
    -          "petType": {
    -            "type": "string"
    -          }
    -        },
    -        "required": [
    -          "name",
    -          "petType"
    -        ]
    -      },
    -      "Cat": {
    -        "description": "A representation of a cat. Note that Cat will be used as the discriminator value.",
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/Pet"
    -          },
    -          {
    -            "type": "object",
    -            "properties": {
    -              "huntingSkill": {
    -                "type": "string",
    -                "description": "The measured skill for hunting",
    -                "default": "lazy",
    -                "enum": [
    -                  "clueless",
    -                  "lazy",
    -                  "adventurous",
    -                  "aggressive"
    -                ]
    -              }
    -            },
    -            "required": [
    -              "huntingSkill"
    -            ]
    -          }
    -        ]
    -      },
    -      "Dog": {
    -        "description": "A representation of a dog. Note that Dog will be used as the discriminator value.",
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/Pet"
    -          },
    -          {
    -            "type": "object",
    -            "properties": {
    -              "packSize": {
    -                "type": "integer",
    -                "format": "int32",
    -                "description": "the size of the pack the dog is from",
    -                "default": 0,
    -                "minimum": 0
    -              }
    -            },
    -            "required": [
    -              "packSize"
    -            ]
    -          }
    -        ]
    -      }
    -    }
    -  }
    -}
    -
    -
    components:
    -  schemas:
    -    Pet:
    -      type: object
    -      discriminator:
    -        propertyName: petType
    -      properties:
    -        name:
    -          type: string
    -        petType:
    -          type: string
    -      required:
    -      - name
    -      - petType
    -    Cat:  ## "Cat" will be used as the discriminator value
    -      description: A representation of a cat
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        properties:
    -          huntingSkill:
    -            type: string
    -            description: The measured skill for hunting
    -            enum:
    -            - clueless
    -            - lazy
    -            - adventurous
    -            - aggressive
    -        required:
    -        - huntingSkill
    -    Dog:  ## "Dog" will be used as the discriminator value
    -      description: A representation of a dog
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        properties:
    -          packSize:
    -            type: integer
    -            format: int32
    -            description: the size of the pack the dog is from
    -            default: 0
    -            minimum: 0
    -        required:
    -        - packSize
    -
    -
    3.6.25.5. Discriminator Object
    -

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    -

    When using the discriminator, inline schemas will not be considered.

    -
    3.6.25.6. Fixed Fields
    - - - - - - -
    Field Name - Type - Description -
    propertyName - string - REQUIRED. The name of the property in the payload that will hold the discriminator value. -
    mapping - Map[string, string] - An object to hold mappings between payload values and schema names or references. -
    -

    The discriminator attribute is legal only when using one of the composite keywords oneOf, anyOf, allOf.

    -

    In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:

    -
    MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -
    -

    which means the payload MUST, by validation, match exactly one of the schemas described by Cat, Dog, or Lizard. In this case, a discriminator MAY act as a “hint” to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use:

    -
    MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -  discriminator:
    -    propertyName: pet_type
    -
    -

    The expectation now is that a property with name pet_type MUST be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload:

    -
    {
    -  "id": 12345,
    -  "pet_type": "Cat"
    -}
    -
    -

    Will indicate that the Cat schema be used in conjunction with this payload.

    -

    In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional mapping definition MAY be used:

    -
    MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -  - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json'
    -  discriminator:
    -    propertyName: pet_type
    -    mapping:
    -      dog: '#/components/schemas/Dog'
    -      monster: 'https://gigantic-server.com/schemas/Monster/schema.json'
    -
    -

    Here the discriminator value of dog will map to the schema #/components/schemas/Dog, rather than the default (implicit) value of Dog. If the discriminator value does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison.

    -

    When used in conjunction with the anyOf construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload.

    -

    In both the oneOf and anyOf use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an allOf construct may be used as an alternate schema.

    -

    For example:

    -
    components:
    -  schemas:
    -    Pet:
    -      type: object
    -      required:
    -      - pet_type
    -      properties:
    -        pet_type:
    -          type: string
    -      discriminator:
    -        propertyName: pet_type
    -        mapping:
    -          cachorro: Dog
    -    Cat:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a Cat
    -        properties:
    -          name:
    -            type: string
    -    Dog:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a Dog
    -        properties:
    -          bark:
    -            type: string
    -    Lizard:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a Lizard
    -        properties:
    -          lovesRocks:
    -            type: boolean
    -
    -

    a payload like this:

    -
    {
    -  "pet_type": "Cat",
    -  "name": "misty"
    -}
    -
    -

    will indicate that the Cat schema be used. Likewise this schema:

    -
    {
    -  "pet_type": "cachorro",
    -  "bark": "soft"
    -}
    -
    -

    will map to Dog because of the definition in the mappings element.

    -

    3.6.26. XML Object

    -

    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.

    -
    3.6.26.1. Fixed Fields
    - - - - - - - - - -
    Field Name - Type - Description -
    name - string - Replaces the name of the element/attribute used for the described schema property. When defined within 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. -
    namespace - string - The URI of the namespace definition. Value MUST be in the form of an absolute URI. -
    prefix - string - The prefix to be used for the name. -
    attribute - boolean - Declares whether the property definition translates to an attribute instead of an element. Default value is false. -
    wrapped - 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). -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.26.2. XML Object Examples
    -

    The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

    -
    3.6.26.2.1. No XML Element
    -

    Basic string property:

    -
    {
    -    "animals": {
    -        "type": "string"
    -    }
    -}
    -
    -
    animals:
    -  type: string
    -
    -
    <animals>...</animals>
    -
    -

    Basic string array property (wrapped is false by default):

    -
    {
    -    "animals": {
    -        "type": "array",
    -        "items": {
    -            "type": "string"
    -        }
    -    }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -
    -
    <animals>...</animals>
    -<animals>...</animals>
    -<animals>...</animals>
    -
    -
    3.6.26.2.2. XML Name Replacement
    -
    {
    -  "animals": {
    -    "type": "string",
    -    "xml": {
    -      "name": "animal"
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: string
    -  xml:
    -    name: animal
    -
    -
    <animal>...</animal>
    -
    -
    3.6.26.2.3. XML Attribute, Prefix and Namespace
    -

    In this example, a full model definition is shown.

    -
    {
    -  "Person": {
    -    "type": "object",
    -    "properties": {
    -      "id": {
    -        "type": "integer",
    -        "format": "int32",
    -        "xml": {
    -          "attribute": true
    -        }
    -      },
    -      "name": {
    -        "type": "string",
    -        "xml": {
    -          "namespace": "http://example.com/schema/sample",
    -          "prefix": "sample"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    Person:
    -  type: object
    -  properties:
    -    id:
    -      type: integer
    -      format: int32
    -      xml:
    -        attribute: true
    -    name:
    -      type: string
    -      xml:
    -        namespace: http://example.com/schema/sample
    -        prefix: sample
    -
    -
    <Person id="123">
    -    <sample:name xmlns:sample="http://example.com/schema/sample">example</sample:name>
    -</Person>
    -
    -
    3.6.26.2.4. XML Arrays
    -

    Changing the element names:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -
    -
    <animal>value</animal>
    -<animal>value</animal>
    -
    -

    The external name property has no effect on the XML:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens"
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -
    -
    <animal>value</animal>
    -<animal>value</animal>
    -
    -

    Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    wrapped: true
    -
    -
    <animals>
    -  <animals>value</animals>
    -  <animals>value</animals>
    -</animals>
    -
    -

    To overcome the naming problem in the example above, the following definition can be used:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    wrapped: true
    -
    -
    <animals>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</animals>
    -
    -

    Affecting both internal and external names:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    <aliens>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</aliens>
    -
    -

    If we change the external element but not the internal ones:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    <aliens>
    -  <aliens>value</aliens>
    -  <aliens>value</aliens>
    -</aliens>
    -
    -

    3.6.27. Security Scheme Object

    -

    Defines a security scheme that can be used by the operations. -Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [rfc6749], and OpenID Connect Discovery.

    -
    3.6.27.1. Fixed Fields
    - - - - - - - - - - - - -
    Field Name - Type - Applies To - Description -
    type - string - Any - REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "oauth2", "openIdConnect". -
    description - string - Any - A short description for security scheme. CommonMark syntax MAY be used for rich text representation. -
    name - string - apiKey - REQUIRED. The name of the header, query or cookie parameter to be used. -
    in - string - apiKey - REQUIRED. The location of the API key. Valid values are "query", "header" or "cookie". -
    scheme - string - http - REQUIRED. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235]section-5.1). -
    bearerFormat - string - http ("bearer") - A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. -
    flows - OAuth Flows Object - oauth2 - REQUIRED. An object containing configuration information for the flow types supported. -
    openIdConnectUrl - string - openIdConnect - REQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.27.2. Security Scheme Object Example
    -
    3.6.27.2.1. Basic Authentication Sample
    -
    {
    -  "type": "http",
    -  "scheme": "basic"
    -}
    -
    -
    type: http
    -scheme: basic
    -
    -
    3.6.27.2.2. API Key Sample
    -
    {
    -  "type": "apiKey",
    -  "name": "api_key",
    -  "in": "header"
    -}
    -
    -
    type: apiKey
    -name: api_key
    -in: header
    -
    -
    3.6.27.2.3. JWT Bearer Sample
    -
    {
    -  "type": "http",
    -  "scheme": "bearer",
    -  "bearerFormat": "JWT",
    -}
    -
    -
    type: http
    -scheme: bearer
    -bearerFormat: JWT
    -
    -
    3.6.27.2.4. Implicit OAuth2 Sample
    -
    {
    -  "type": "oauth2",
    -  "flows": {
    -    "implicit": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    }
    -  }
    -}
    -
    -
    type: oauth2
    -flows: 
    -  implicit:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets
    -
    -

    3.6.28. OAuth Flows Object

    -

    Allows configuration of the supported OAuth Flows.

    -
    3.6.28.1. Fixed Fields
    - - - - - - - - -
    Field Name - Type - Description -
    implicit - OAuth Flow Object - Configuration for the OAuth Implicit flow -
    password - OAuth Flow Object - Configuration for the OAuth Resource Owner Password flow -
    clientCredentials - OAuth Flow Object - Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0. -
    authorizationCode - OAuth Flow Object - Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0. -
    -

    This object MAY be extended with Specification Extensions.

    -

    3.6.29. OAuth Flow Object

    -

    Configuration details for a supported OAuth Flow

    -
    3.6.29.1. Fixed Fields
    - - - - - - - - -
    Field Name - Type - Applies To - Description -
    authorizationUrl - string - oauth2 ("implicit", "authorizationCode") - REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL. -
    tokenUrl - string - oauth2 ("password", "clientCredentials", "authorizationCode") - REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL. -
    refreshUrl - string - oauth2 - The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. -
    scopes - Map[string, string] - oauth2 - REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. -
    -

    This object MAY be extended with Specification Extensions.

    -
    3.6.29.2. OAuth Flow Object Examples
    -
    {
    -  "type": "oauth2",
    -  "flows": {
    -    "implicit": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    },
    -    "authorizationCode": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "tokenUrl": "https://example.com/api/oauth/token",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    }
    -  }
    -}
    -
    -
    type: oauth2
    -flows: 
    -  implicit:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets
    -  authorizationCode:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    tokenUrl: https://example.com/api/oauth/token
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets 
    -
    -

    3.6.30. Security Requirement Object

    -

    Lists the required security schemes to execute this operation. -The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.

    -

    Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. -This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.

    -

    When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.

    -
    3.6.30.1. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    {name} - [string] - Each name MUST correspond to a security scheme which is declared in the Security Schemes under the Components Object. If the security scheme is of type "oauth2" or "openIdConnect", then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty. -
    -
    3.6.30.2. Security Requirement Object Examples
    -
    3.6.30.2.1. Non-OAuth2 Security Requirement
    -
    {
    -  "api_key": []
    -}
    -
    -
    api_key: []
    -
    -
    3.6.30.2.2. OAuth2 Security Requirement
    -
    {
    -  "petstore_auth": [
    -    "write:pets",
    -    "read:pets"
    -  ]
    -}
    -
    -
    petstore_auth:
    -- write:pets
    -- read:pets
    -
    -

    3.7. Specification Extensions

    -

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    -

    The extensions properties are implemented as patterned fields that are always prefixed by "x-".

    - - - - - -
    Field Pattern - Type - Description -
    ^x- - Any - Allows extensions to the OpenAPI Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. 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).

    -

    3.8. Security Filtering

    -

    Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.

    -

    The reasoning is to allow an additional layer of access control over the documentation. -While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.

    -

    Two examples of this:

    -
      -
    1. The Paths Object MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication. -
    2. The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object, so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see. -
    -

    Appendix A: Revision History

    - - - - - - - - - - - - - -
    Version - Date - Notes -
    3.0.0 - 2017-07-26 - Release of the OpenAPI Specification 3.0.0 -
    3.0.0-rc2 - 2017-06-16 - rc2 of the 3.0 specification -
    3.0.0-rc1 - 2017-04-27 - rc1 of the 3.0 specification -
    3.0.0-rc0 - 2017-02-28 - Implementer’s Draft of the 3.0 specification -
    2.0 - 2015-12-31 - Donation of Swagger 2.0 to the Open API Initiative -
    2.0 - 2014-09-08 - Release of Swagger 2.0 -
    1.2 - 2014-03-14 - Initial release of the formal document. -
    1.1 - 2012-08-22 - Release of Swagger 1.1 -
    1.0 - 2011-08-10 - First release of the Swagger Specification -
    -
    -
    -

    Conformance

    -

    Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. - The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” - in the normative parts of this document - are to be interpreted as described in RFC 2119. - However, for readability, - these words do not appear in all uppercase letters in this specification.

    -

    All of the text of this specification is normative - except sections explicitly marked as non-normative, examples, and notes. [RFC2119]

    -

    Examples in this specification are introduced with the words “for example” - or are set apart from the normative text with class="example", like this:

    -
    This is an example of an informative example.
    -

    Informative notes begin with the word “Note” - and are set apart from the normative text with class="note", like this:

    -

    Note, this is an informative note.

    -
    - -

    Index

    -

    Terms defined by this specification

    - -

    References

    -

    Normative References

    -
    -
    [RFC1866] -
    D. Connolly; L. Masinter. The 'text/html' Media Type. June 2000. Informational. URL: https://tools.ietf.org/html/rfc2854 -
    [RFC2119] -
    S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119 -
    [RFC3986] -
    T. Berners-Lee; R. Fielding; L. Masinter. Uniform Resource Identifier (URI): Generic Syntax. January 2005. Internet Standard. URL: https://tools.ietf.org/html/rfc3986 -
    [RFC6570] -
    J. Gregorio; et al. URI Template. March 2012. Proposed Standard. URL: https://tools.ietf.org/html/rfc6570 -
    [RFC6749] -
    D. Hardt, Ed.. The OAuth 2.0 Authorization Framework. October 2012. Proposed Standard. URL: https://tools.ietf.org/html/rfc6749 -
    [RFC6838] -
    N. Freed; J. Klensin; T. Hansen. Media Type Specifications and Registration Procedures. January 2013. Best Current Practice. URL: https://tools.ietf.org/html/rfc6838 -
    [RFC6901] -
    P. Bryan, Ed.; K. Zyp; M. Nottingham, Ed.. JavaScript Object Notation (JSON) Pointer. April 2013. Proposed Standard. URL: https://tools.ietf.org/html/rfc6901 -
    [RFC7230] -
    R. Fielding, Ed.; J. Reschke, Ed.. Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing. June 2014. Proposed Standard. URL: https://tools.ietf.org/html/rfc7230 -
    [RFC7231] -
    R. Fielding, Ed.; J. Reschke, Ed.. Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content. June 2014. Proposed Standard. URL: https://tools.ietf.org/html/rfc7231 -
    [RFC8174] -
    B. Leiba. Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words. May 2017. Best Current Practice. URL: https://tools.ietf.org/html/rfc8174 -
    - - - - - \ No newline at end of file diff --git a/scripts/md2html/v3/oas_3.0.1.html b/scripts/md2html/v3/oas_3.0.1.html deleted file mode 100644 index 0f00f77fa4..0000000000 --- a/scripts/md2html/v3/oas_3.0.1.html +++ /dev/null @@ -1,5644 +0,0 @@ - - - - OpenAPI Specification - - - - - - - - - - - - - -
    -

    -

    OpenAPI Specification

    -

    Living Standard,

    -
    -
    -
    This version: -
    https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md -
    Issue Tracking: -
    GitHub -
    Editors: -
    Darrel Miller -
    Jeremy Whitlock -
    Marsh Gardiner -
    Mike Ralphson -
    Ron Ratovsky -
    Uri Sarid -
    Former Editors: -
    Jason Harmon -
    Tony Tam -
    -
    -
    - -
    -
    -
    -

    Abstract

    -

    The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for REST APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

    -
    -
    - -
    - - - -

    Open API Initiative logo

    - OpenAPI Specification -

    1. OpenAPI Specification

    -

    1.1. Version 3.0.1

    -

    The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 [rfc2119] [rfc8174] when, and only when, they appear in all capitals, as shown here.

    -

    This document is licensed under The Apache License, Version 2.0.

    -

    2. Introduction

    -

    The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.

    -

    An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.

    -

    3. Definitions

    -

    3.1. OpenAPI Document

    -

    A document (or set of documents) that defines or describes an API. An OpenAPI definition uses and conforms to the OpenAPI Specification.

    -

    3.2. Path Templating

    -

    Path templating refers to the usage of curly braces ({}) to mark a section of a URL path as replaceable using path parameters.

    -

    3.3. Media Types

    -

    Media type definitions are spread across several resources. -The media type definitions SHOULD be in compliance with [rfc6838].

    -

    Some examples of possible media type definitions:

    -
    text/plain; charset=utf-8
    -application/json
    -application/vnd.github+json
    -application/vnd.github.v3+json
    -application/vnd.github.v3.raw+json
    -application/vnd.github.v3.text+json
    -application/vnd.github.v3.html+json
    -application/vnd.github.v3.full+json
    -application/vnd.github.v3.diff
    -application/vnd.github.v3.patch
    -
    -

    3.4. HTTP Status Codes

    -

    The HTTP Status Codes are used to indicate the status of the executed operation. -The available status codes are defined by [rfc7231]section-6) and registered status codes are listed in the IANA Status Code Registry.

    -

    4. Specification

    -

    4.1. Versions

    -

    The OpenAPI Specification is versioned using Semantic Versioning 2.0.0 (semver) and follows the semver specification.

    -

    The major.minor portion of the semver (for example 3.0) SHALL designate the OAS feature set. Typically, .patch versions address errors in this document, not the feature set. Tooling which supports OAS 3.0 SHOULD be compatible with all OAS 3.0.* versions. The patch version SHOULD NOT be considered by tooling, making no distinction between 3.0.0 and 3.0.1 for example.

    -

    Subsequent minor version releases of the OpenAPI Specification (incrementing the minor version number) SHOULD NOT interfere with tooling developed to a lower minor version and same major version. Thus a hypothetical 3.1.0 specification SHOULD be usable with tooling designed for 3.0.0.

    -

    An OpenAPI document compatible with OAS 3.. contains a required openapi field which designates the semantic version of the OAS that it uses. (OAS 2.0 documents contain a top-level version field named swagger and value "2.0".)

    -

    4.2. Format

    -

    An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format.

    -

    For example, if a field has an array value, the JSON array representation will be used:

    -
    {
    -   "field": [ 1, 2, 3 ]
    -}
    -
    -

    All field names in the specification are case sensitive.

    -

    The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for the field name.

    -

    Patterned fields MUST have unique names within the containing object.

    -

    In order to preserve the ability to round-trip between YAML and JSON formats, YAML version 1.2 is RECOMMENDED along with some additional constraints:

    - -

    Note: While APIs may be defined by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML.

    -

    4.3. Document Structure

    -

    An OpenAPI document MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the user. In the latter case, $ref fields MUST be used in the specification to reference those parts as follows from the JSON Schema definitions.

    -

    It is RECOMMENDED that the root OpenAPI document be named: openapi.json or openapi.yaml.

    -

    4.4. Data Types

    -

    Primitive data types in the OAS are based on the types supported by the JSON Schema Specification Wright Draft 00. -Note that integer as a type is also supported and is defined as a JSON number without a fraction or exponent part. null is not supported as a type (see nullable for an alternative solution). -Models are defined using the Schema Object, which is an extended subset of JSON Schema Specification Wright Draft 00.

    -

    Primitives have an optional modifier property: format. -OAS uses several known formats to define in fine detail the data type being used. -However, to support documentation needs, the format property is an open string-valued property, and can have any value. -Formats such as "email", "uuid", and so on, MAY be used even though undefined by this specification. -Types that are not accompanied by a format property follow the type definition in the JSON Schema. Tools that do not recognize a specific format MAY default back to the type alone, as if the format is not specified.

    -

    The formats defined by the OAS are:

    - - - - - - - - - - - - - - - -
    Common Name - type - format - Comments -
    integer - integer - int32 - signed 32 bits -
    long - integer - int64 - signed 64 bits -
    float - number - float - -
    double - number - double - -
    string - string - - -
    byte - string - byte - base64 encoded characters -
    binary - string - binary - any sequence of octets -
    boolean - boolean - - -
    date - string - date - As defined by full-date - [!rfc3339] -
    dateTime - string - date-time - As defined by date-time - [!rfc3339] -
    password - string - password - A hint to UIs to obscure input. -
    -

    4.5. Rich Text Formatting

    -

    Throughout the specification description fields are noted as supporting CommonMark markdown formatting. -Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by CommonMark 0.27. Tooling MAY choose to ignore some CommonMark features to address security concerns.

    -

    4.6. Relative References in URLs

    -

    Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [rfc3986]section-4.2). -Relative references are resolved using the URLs defined in the Server Object as a Base URI.

    -

    Relative references used in $ref are processed as per JSON Reference, using the URL of the current document as the base URI. See also the Reference Object.

    -

    4.7. Schema

    -

    In the following description, if a field is not explicitly REQUIRED or described with a MUST or SHALL, it can be considered OPTIONAL.

    -

    4.7.1. OpenAPI Object

    -

    This is the root document object of the OpenAPI document.

    -
    4.7.1.1. Fixed Fields
    - - - - - - - - - - - - -
    Field Name - Type - Description -
    openapi - string - REQUIRED. This string MUST be the semantic version number of the OpenAPI Specification version that the OpenAPI document uses. The openapi field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. This is not related to the API info.version string. -
    info - Info Object - REQUIRED. Provides metadata about the API. The metadata MAY be used by tooling as required. -
    servers - [Server Object] - An array of Server Objects, which provide connectivity information to a target server. If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url value of /. -
    paths - Paths Object - REQUIRED. The available paths and operations for the API. -
    components - Components Object - An element to hold various schemas for the specification. -
    security - [Security Requirement Object] - A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. -
    tags - [Tag Object] - 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. -
    externalDocs - External Documentation Object - Additional external documentation. -
    -

    This object MAY be extended with Specification Extensions.

    -

    4.7.2. Info Object

    -

    The object provides metadata about the API. -The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.

    -
    4.7.2.1. Fixed Fields
    - - - - - - - - - - -
    Field Name - Type - Description -
    title - string - REQUIRED. The title of the application. -
    description - string - A short description of the application. CommonMark syntax MAY be used for rich text representation. -
    termsOfService - string - A URL to the Terms of Service for the API. MUST be in the format of a URL. -
    contact - Contact Object - The contact information for the exposed API. -
    license - License Object - The license information for the exposed API. -
    version - string - REQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version). -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.2.2. Info Object Example:
    -
    {
    -  "title": "Sample Pet Store App",
    -  "description": "This is a sample server for a pet store.",
    -  "termsOfService": "http://example.com/terms/",
    -  "contact": {
    -    "name": "API Support",
    -    "url": "http://www.example.com/support",
    -    "email": "support@example.com"
    -  },
    -  "license": {
    -    "name": "Apache 2.0",
    -    "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    -  },
    -  "version": "1.0.1"
    -}
    -
    -
    title: Sample Pet Store App
    -description: This is a sample server for a pet store.
    -termsOfService: http://example.com/terms/
    -contact:
    -  name: API Support
    -  url: http://www.example.com/support
    -  email: support@example.com
    -license:
    -  name: Apache 2.0
    -  url: https://www.apache.org/licenses/LICENSE-2.0.html
    -version: 1.0.1
    -
    -

    4.7.3. Contact Object

    -

    Contact information for the exposed API.

    -
    4.7.3.1. Fixed Fields
    - - - - - - - -
    Field Name - Type - Description -
    name - string - The identifying name of the contact person/organization. -
    url - string - The URL pointing to the contact information. MUST be in the format of a URL. -
    email - string - The email address of the contact person/organization. MUST be in the format of an email address. -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.3.2. Contact Object Example:
    -
    {
    -  "name": "API Support",
    -  "url": "http://www.example.com/support",
    -  "email": "support@example.com"
    -}
    -
    -
    name: API Support
    -url: http://www.example.com/support
    -email: support@example.com
    -
    -

    4.7.4. License Object

    -

    License information for the exposed API.

    -
    4.7.4.1. Fixed Fields
    - - - - - - -
    Field Name - Type - Description -
    name - string - REQUIRED. The license name used for the API. -
    url - string - A URL to the license used for the API. MUST be in the format of a URL. -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.4.2. License Object Example:
    -
    {
    -  "name": "Apache 2.0",
    -  "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    -}
    -
    -
    name: Apache 2.0
    -url: https://www.apache.org/licenses/LICENSE-2.0.html
    -
    -

    4.7.5. Server Object

    -

    An object representing a Server.

    -
    4.7.5.1. Fixed Fields
    - - - - - - - -
    Field Name - Type - Description -
    url - string - REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in {brackets}. -
    description - string - An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation. -
    variables - Map[string, Server Variable Object] - A map between a variable name and its value. The value is used for substitution in the server’s URL template. -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.5.2. Server Object Example
    -

    A single server would be described as:

    -
    {
    -  "url": "https://development.gigantic-server.com/v1",
    -  "description": "Development server"
    -}
    -
    -
    url: https://development.gigantic-server.com/v1
    -description: Development server
    -
    -

    The following shows how multiple servers can be described, for example, at the OpenAPI Object’s servers:

    -
    {
    -  "servers": [
    -    {
    -      "url": "https://development.gigantic-server.com/v1",
    -      "description": "Development server"
    -    },
    -    {
    -      "url": "https://staging.gigantic-server.com/v1",
    -      "description": "Staging server"
    -    },
    -    {
    -      "url": "https://api.gigantic-server.com/v1",
    -      "description": "Production server"
    -    }
    -  ]
    -}
    -
    -
    servers:
    -- url: https://development.gigantic-server.com/v1
    -  description: Development server
    -- url: https://staging.gigantic-server.com/v1
    -  description: Staging server
    -- url: https://api.gigantic-server.com/v1
    -  description: Production server
    -
    -

    The following shows how variables can be used for a server configuration:

    -
    {
    -  "servers": [
    -    {
    -      "url": "https://{username}.gigantic-server.com:{port}/{basePath}",
    -      "description": "The production API server",
    -      "variables": {
    -        "username": {
    -          "default": "demo",
    -          "description": "this value is assigned by the service provider, in this example gigantic-server.com"
    -        },
    -        "port": {
    -          "enum": [
    -            "8443",
    -            "443"
    -          ],
    -          "default": "8443"
    -        },
    -        "basePath": {
    -          "default": "v2"
    -        }
    -      }
    -    }
    -  ]
    -}
    -
    -
    servers:
    -- url: https://{username}.gigantic-server.com:{port}/{basePath}
    -  description: The production API server
    -  variables:
    -    username:
    -      # note! no enum here means it is an open value
    -      default: demo
    -      description: this value is assigned by the service provider, in this example gigantic-server.com
    -    port:
    -      enum:
    -        - '8443'
    -        - '443'
    -      default: '8443'
    -    basePath:
    -      # open meaning there is the opportunity to use special base paths as assigned by the provider, default is v2
    -      default: v2
    -
    -

    4.7.6. Server Variable Object

    -

    An object representing a Server Variable for server URL template substitution.

    -
    4.7.6.1. Fixed Fields
    - - - - - - - -
    Field Name - Type - Description -
    enum - [string] - An enumeration of string values to be used if the substitution options are from a limited set. -
    default - string - REQUIRED. The default value to use for substitution, and to send, if an alternate value is not supplied. Unlike the Schema Object’s default, this value MUST be provided by the consumer. -
    description - string - An optional description for the server variable. CommonMark syntax MAY be used for rich text representation. -
    -

    This object MAY be extended with Specification Extensions.

    -

    4.7.7. Components Object

    -

    Holds a set of reusable objects for different aspects of the OAS. -All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.

    -
    4.7.7.1. Fixed Fields
    - - - - - - - - - - - - - -
    Field Name - Type - Description -
    schemas - Map[string, Schema Object ¦ Reference Object] - An object to hold reusable Schema Objects. -
    responses - Map[string, Response Object ¦ Reference Object] - An object to hold reusable Response Objects. -
    parameters - Map[string, Parameter Object ¦ Reference Object] - An object to hold reusable Parameter Objects. -
    examples - Map[string, Example Object ¦ Reference Object] - An object to hold reusable Example Objects. -
    requestBodies - Map[string, Request Body Object ¦ Reference Object] - An object to hold reusable Request Body Objects. -
    headers - Map[string, Header Object ¦ Reference Object] - An object to hold reusable Header Objects. -
    securitySchemes - Map[string, Security Scheme Object ¦ Reference Object] - An object to hold reusable Security Scheme Objects. -
    links - Map[string, Link Object ¦ Reference Object] - An object to hold reusable Link Objects. -
    callbacks - Map[string, Callback Object ¦ Reference Object] - An object to hold reusable Callback Objects. -
    -

    This object MAY be extended with Specification Extensions.

    -

    All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9\.\-_]+$.

    -

    Field Name Examples:

    -
    User
    -User_1
    -User_Name
    -user-name
    -my.org.User
    -
    -
    4.7.7.2. Components Object Example
    -
    "components": {
    -  "schemas": {
    -    "Category": {
    -      "type": "object",
    -      "properties": {
    -        "id": {
    -          "type": "integer",
    -          "format": "int64"
    -        },
    -        "name": {
    -          "type": "string"
    -        }
    -      }
    -    },
    -    "Tag": {
    -      "type": "object",
    -      "properties": {
    -        "id": {
    -          "type": "integer",
    -          "format": "int64"
    -        },
    -        "name": {
    -          "type": "string"
    -        }
    -      }
    -    }
    -  },
    -  "parameters": {
    -    "skipParam": {
    -      "name": "skip",
    -      "in": "query",
    -      "description": "number of items to skip",
    -      "required": true,
    -      "schema": {
    -        "type": "integer",
    -        "format": "int32"
    -      }
    -    },
    -    "limitParam": {
    -      "name": "limit",
    -      "in": "query",
    -      "description": "max records to return",
    -      "required": true,
    -      "schema" : {
    -        "type": "integer",
    -        "format": "int32"
    -      }
    -    }
    -  },
    -  "responses": {
    -    "NotFound": {
    -      "description": "Entity not found."
    -    },
    -    "IllegalInput": {
    -      "description": "Illegal input for operation."
    -    },
    -    "GeneralError": {
    -      "description": "General Error",
    -      "content": {
    -        "application/json": {
    -          "schema": {
    -            "$ref": "#/components/schemas/GeneralError"
    -          }
    -        }
    -      }
    -    }
    -  },
    -  "securitySchemes": {
    -    "api_key": {
    -      "type": "apiKey",
    -      "name": "api_key",
    -      "in": "header"
    -    },
    -    "petstore_auth": {
    -      "type": "oauth2",
    -      "flows": {
    -        "implicit": {
    -          "authorizationUrl": "http://example.org/api/oauth/dialog",
    -          "scopes": {
    -            "write:pets": "modify pets in your account",
    -            "read:pets": "read your pets"
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    components:
    -  schemas:
    -    Category:
    -      type: object
    -      properties:
    -        id:
    -          type: integer
    -          format: int64
    -        name:
    -          type: string
    -    Tag:
    -      type: object
    -      properties:
    -        id:
    -          type: integer
    -          format: int64
    -        name:
    -          type: string
    -  parameters:
    -    skipParam:
    -      name: skip
    -      in: query
    -      description: number of items to skip
    -      required: true
    -      schema:
    -        type: integer
    -        format: int32
    -    limitParam:
    -      name: limit
    -      in: query
    -      description: max records to return
    -      required: true
    -      schema:
    -        type: integer
    -        format: int32
    -  responses:
    -    NotFound:
    -      description: Entity not found.
    -    IllegalInput:
    -      description: Illegal input for operation.
    -    GeneralError:
    -      description: General Error
    -      content:
    -        application/json:
    -          schema:
    -            $ref: '#/components/schemas/GeneralError'
    -  securitySchemes:
    -    api_key:
    -      type: apiKey
    -      name: api_key
    -      in: header
    -    petstore_auth:
    -      type: oauth2
    -      flows: 
    -        implicit:
    -          authorizationUrl: http://example.org/api/oauth/dialog
    -          scopes:
    -            write:pets: modify pets in your account
    -            read:pets: read your pets
    -
    -

    4.7.8. Paths Object

    -

    Holds the relative paths to the individual endpoints and their operations. -The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.

    -
    4.7.8.1. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    /{path} - Path Item Object - A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended (no relative URL resolution) to the expanded URL from the Server Object’s url field in order to construct the full URL. Path templating is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it’s up to the tooling to decide which one to use. -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.8.2. Path Templating Matching
    -

    Assuming the following paths, the concrete definition, /pets/mine, will be matched first if used:

    -
    /pets/{petId}
    -/pets/mine
    -
    -

    The following paths are considered identical and invalid:

    -
    /pets/{petId}
    -/pets/{name}
    -
    -

    The following may lead to ambiguous resolution:

    -
    /{entity}/me
    -/books/{id}
    -
    -
    4.7.8.3. Paths Object Example
    -
    {
    -  "/pets": {
    -    "get": {
    -      "description": "Returns all pets from the system that the user has access to",
    -      "responses": {
    -        "200": {          
    -          "description": "A list of pets.",
    -          "content": {
    -            "application/json": {
    -              "schema": {
    -                "type": "array",
    -                "items": {
    -                  "$ref": "#/components/schemas/pet"
    -                }
    -              }
    -            }
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    /pets:
    -  get:
    -    description: Returns all pets from the system that the user has access to
    -    responses:
    -      '200':
    -        description: A list of pets.
    -        content:
    -          application/json:
    -            schema:
    -              type: array
    -              items:
    -                $ref: '#/components/schemas/pet'
    -
    -

    4.7.9. Path Item Object

    -

    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.

    -
    4.7.9.1. Fixed Fields
    - - - - - - - - - - - - - - - - - -
    Field Name - Type - Description -
    $ref - string - 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. -
    summary - string - An optional, string summary, intended to apply to all operations in this path. -
    description - string - An optional, string description, intended to apply to all operations in this path. CommonMark syntax MAY be used for rich text representation. -
    get - Operation Object - A definition of a GET operation on this path. -
    put - Operation Object - A definition of a PUT operation on this path. -
    post - Operation Object - A definition of a POST operation on this path. -
    delete - Operation Object - A definition of a DELETE operation on this path. -
    options - Operation Object - A definition of a OPTIONS operation on this path. -
    head - Operation Object - A definition of a HEAD operation on this path. -
    patch - Operation Object - A definition of a PATCH operation on this path. -
    trace - Operation Object - A definition of a TRACE operation on this path. -
    servers - [Server Object] - An alternative server array to service all operations in this path. -
    parameters - [Parameter Object ¦ Reference Object] - 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 OpenAPI Object’s components/parameters. -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.9.2. Path Item Object Example
    -
    {
    -  "get": {
    -    "description": "Returns pets based on ID",
    -    "summary": "Find pets by ID",
    -    "operationId": "getPetsById",
    -    "responses": {
    -      "200": {
    -        "description": "pet response",
    -        "content": {
    -          "*/*": {
    -            "schema": {
    -              "type": "array",
    -              "items": {
    -                "$ref": "#/components/schemas/Pet"
    -              }
    -            }
    -          }
    -        }
    -      },
    -      "default": {
    -        "description": "error payload",
    -        "content": {
    -          "text/html": {
    -            "schema": {
    -              "$ref": "#/components/schemas/ErrorModel"
    -            }
    -          }
    -        }
    -      }
    -    }
    -  },
    -  "parameters": [
    -    {
    -      "name": "id",
    -      "in": "path",
    -      "description": "ID of pet to use",
    -      "required": true,
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "type": "string"
    -        }
    -      },
    -      "style": "simple"
    -    }
    -  ]
    -}
    -
    -
    get:
    -  description: Returns pets based on ID
    -  summary: Find pets by ID
    -  operationId: getPetsById
    -  responses:
    -    '200':
    -      description: pet response
    -      content:
    -        '*/*' :
    -          schema:
    -            type: array
    -            items:
    -              $ref: '#/components/schemas/Pet'
    -    default:
    -      description: error payload
    -      content:
    -        'text/html':
    -          schema:
    -            $ref: '#/components/schemas/ErrorModel'
    -parameters:
    -- name: id
    -  in: path
    -  description: ID of pet to use
    -  required: true
    -  schema:
    -    type: array
    -    style: simple
    -    items:
    -      type: string  
    -
    -

    4.7.10. Operation Object

    -

    Describes a single API operation on a path.

    -
    4.7.10.1. Fixed Fields
    - - - - - - - - - - - - - - - - -
    Field Name - Type - Description -
    tags - [string] - A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. -
    summary - string - A short summary of what the operation does. -
    description - string - A verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation. -
    externalDocs - External Documentation Object - Additional external documentation for this operation. -
    operationId - string - 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 - [Parameter Object ¦ Reference Object] - 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 OpenAPI Object’s components/parameters. -
    requestBody - Request Body Object ¦ Reference Object - The request body applicable for this operation. The requestBody is only supported in HTTP methods where the HTTP 1.1 specification [rfc7231]section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers. -
    responses - Responses Object - REQUIRED. The list of possible responses as they are returned from executing this operation. -
    callbacks - Map[string, Callback Object ¦ Reference Object] - A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. -
    deprecated - boolean - Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is false. -
    security - [Security Requirement Object] - A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used. -
    servers - [Server Object] - An alternative server array to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value. -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.10.2. Operation Object Example
    -
    {
    -  "tags": [
    -    "pet"
    -  ],
    -  "summary": "Updates a pet in the store with form data",
    -  "operationId": "updatePetWithForm",
    -  "parameters": [
    -    {
    -      "name": "petId",
    -      "in": "path",
    -      "description": "ID of pet that needs to be updated",
    -      "required": true,
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  ],
    -  "requestBody": {
    -    "content": {
    -      "application/x-www-form-urlencoded": {
    -        "schema": {
    -          "type": "object",
    -           "properties": {
    -              "name": { 
    -                "description": "Updated name of the pet",
    -                "type": "string"
    -              },
    -              "status": {
    -                "description": "Updated status of the pet",
    -                "type": "string"
    -             }
    -           },
    -        "required": ["status"] 
    -        }
    -      }
    -    }
    -  },
    -  "responses": {
    -    "200": {
    -      "description": "Pet updated.",
    -      "content": {
    -        "application/json": {},
    -        "application/xml": {}
    -      }
    -    },
    -    "405": {
    -      "description": "Invalid input",
    -      "content": {
    -        "application/json": {},
    -        "application/xml": {}
    -      }
    -    }
    -  },
    -  "security": [
    -    {
    -      "petstore_auth": [
    -        "write:pets",
    -        "read:pets"
    -      ]
    -    }
    -  ]
    -}
    -
    -
    tags:
    -- pet
    -summary: Updates a pet in the store with form data
    -operationId: updatePetWithForm
    -parameters:
    -- name: petId
    -  in: path
    -  description: ID of pet that needs to be updated
    -  required: true
    -  schema:
    -    type: string
    -requestBody:
    -  content:
    -    'application/x-www-form-urlencoded':
    -      schema:
    -       properties:
    -          name: 
    -            description: Updated name of the pet
    -            type: string
    -          status:
    -            description: Updated status of the pet
    -            type: string
    -       required:
    -         - status
    -responses:
    -  '200':
    -    description: Pet updated.
    -    content: 
    -      'application/json': {}
    -      'application/xml': {}
    -  '405':
    -    description: Invalid input
    -    content: 
    -      'application/json': {}
    -      'application/xml': {}
    -security:
    -- petstore_auth:
    -  - write:pets
    -  - read:pets
    -
    -

    4.7.11. External Documentation Object

    -

    Allows referencing an external resource for extended documentation.

    -
    4.7.11.1. Fixed Fields
    - - - - - - -
    Field Name - Type - Description -
    description - string - A short description of the target documentation. CommonMark syntax MAY be used for rich text representation. -
    url - string - REQUIRED. The URL for the target documentation. Value MUST be in the format of a URL. -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.11.2. External Documentation Object Example
    -
    {
    -  "description": "Find more info here",
    -  "url": "https://example.com"
    -}
    -
    -
    description: Find more info here
    -url: https://example.com
    -
    -

    4.7.12. Parameter Object

    -

    Describes a single operation parameter.

    -

    A unique parameter is defined by a combination of a name and location.

    -
    4.7.12.1. Parameter Locations
    -

    There are four possible parameter locations specified by the in field:

    -
      -
    • path - Used together with Path Templating, where the parameter value is actually part of the operation’s URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId. -
    • query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id. -
    • header - Custom headers that are expected as part of the request. Note that [rfc7230]page-22) states header names are case insensitive. -
    • cookie - Used to pass a specific cookie value to the API. -
    -
    4.7.12.2. Fixed Fields
    - - - - - - - - - - -
    Field Name - Type - Description -
    name - string - - REQUIRED. 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. -
    • If in is "header" and the name field is "Accept", "Content-Type" or "Authorization", the parameter definition SHALL be ignored. -
    • For all other cases, the name corresponds to the parameter name used by the in property. -
    -
    in - string - REQUIRED. The location of the parameter. Possible values are “query”, “header”, “path” or “cookie”. -
    description - string - A brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation. -
    required - boolean - Determines whether this parameter is mandatory. If the parameter location is “path”, this property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and its default value is false. -
    deprecated - boolean - Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. -
    allowEmptyValue - boolean - Sets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored. -
    -

    The rules for serialization of the parameter are specified in one of two ways. -For simpler scenarios, a schema and style can describe the structure and syntax of the parameter.

    - - - - - - - - - - -
    Field Name - Type - Description -
    style - string - Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form. -
    explode - boolean - When this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. -
    allowReserved - boolean - Determines whether the parameter value SHOULD allow reserved characters, as defined by [rfc3986]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. This property only applies to parameters with an in value of query. The default value is false. -
    schema - Schema Object ¦ Reference Object - The schema defining the type used for the parameter. -
    example - Any - Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The example field is mutually exclusive of the examples field. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary. -
    examples - Map[ string, Example Object ¦ Reference Object] - Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The examples field is mutually exclusive of the example field. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema. -
    -

    For more complex scenarios, the content property can define the media type and schema of the parameter. -A parameter MUST contain either a schema property, or a content property, but not both. -When example or examples are provided in conjunction with the schema object, the example MUST follow the prescribed serialization strategy for the parameter.

    - - - - - -
    Field Name - Type - Description -
    content - Map[string, Media Type Object] - A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry. -
    -
    4.7.12.3. Style Values
    -

    In order to support common ways of serializing simple parameters, a set of style values are defined.

    - - - - - - - - - - - -
    style - type - in - Comments -
    matrix - primitive, array, object - path - Path-style parameters defined by [rfc6570]section-3.2.7) -
    label - primitive, array, object - path - Label style parameters defined by [rfc6570]section-3.2.5) -
    form - primitive, array, object - query, cookie - Form style parameters defined by [rfc6570]section-3.2.8). This option replaces collectionFormat with a csv (when explode is false) or multi (when explode is true) value from OpenAPI 2.0. -
    simple - array - path, header - Simple style parameters defined by [rfc6570]section-3.2.2). This option replaces collectionFormat with a csv value from OpenAPI 2.0. -
    spaceDelimited - array - query - Space separated array values. This option replaces collectionFormat equal to ssv from OpenAPI 2.0. -
    pipeDelimited - array - query - Pipe separated array values. This option replaces collectionFormat equal to pipes from OpenAPI 2.0. -
    deepObject - object - query - Provides a simple way of rendering nested objects using form parameters. -
    -
    4.7.12.4. Style Examples
    -

    Assume a parameter named color has one of the following values:

    -
    string -> "blue"
    -array -> ["blue","black","brown"]
    -object -> { "R": 100, "G": 200, "B": 150 }
    -
    -

    The following table shows examples of rendering differences for each value.

    - - - - - - - - - - - - - - - -
    style - explode - empty - string - array - object -
    matrix - false - ;color - ;color=blue - ;color=blue,black,brown - ;color=R,100,G,200,B,150 -
    matrix - true - ;color - ;color=blue - ;color=blue;color=black;color=brown - ;R=100;G=200;B=150 -
    label - false - . - .blue - .blue.black.brown - .R.100.G.200.B.150 -
    label - true - . - .blue - .blue.black.brown - .R=100.G=200.B=150 -
    form - false - color= - color=blue - color=blue,black,brown - color=R,100,G,200,B,150 -
    form - true - color= - color=blue - color=blue&color=black&color=brown - R=100&G=200&B=150 -
    simple - false - n/a - blue - blue,black,brown - R,100,G,200,B,150 -
    simple - true - n/a - blue - blue,black,brown - R=100,G=200,B=150 -
    spaceDelimited - false - n/a - n/a - blue%20black%20brown - R%20100%20G%20200%20B%20150 -
    pipeDelimited - false - n/a - n/a - blue¦black¦brown - R¦100¦G¦200 -
    deepObject - true - n/a - n/a - n/a - color\R=100&color\G=200&color\B=150 -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.12.5. Parameter Object Examples
    -

    A header parameter with an array of 64 bit integer numbers:

    -
    {
    -  "name": "token",
    -  "in": "header",
    -  "description": "token to be passed as a header",
    -  "required": true,
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "type": "integer",
    -      "format": "int64"
    -    }
    -  },
    -  "style": "simple"
    -}
    -
    -
    name: token
    -in: header
    -description: token to be passed as a header
    -required: true
    -schema:
    -  type: array
    -  items:
    -    type: integer
    -    format: int64
    -style: simple
    -
    -

    A path parameter of a string value:

    -
    {
    -  "name": "username",
    -  "in": "path",
    -  "description": "username to fetch",
    -  "required": true,
    -  "schema": {
    -    "type": "string"
    -  }
    -}
    -
    -
    name: username
    -in: path
    -description: username to fetch
    -required: true
    -schema:
    -  type: string
    -
    -

    An optional query parameter of a string value, allowing multiple values by repeating the query parameter:

    -
    {
    -  "name": "id",
    -  "in": "query",
    -  "description": "ID of the object to fetch",
    -  "required": false,
    -  "schema": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    }
    -  },
    -  "style": "form",
    -  "explode": true
    -}
    -
    -
    name: id
    -in: query
    -description: ID of the object to fetch
    -required: false
    -schema:
    -  type: array
    -  items:
    -    type: string
    -style: form
    -explode: true
    -
    -

    A free-form query parameter, allowing undefined parameters of a specific type:

    -
    {
    -  "in": "query",
    -  "name": "freeForm",
    -  "schema": {
    -    "type": "object",
    -    "additionalProperties": {
    -      "type": "integer"
    -    },
    -  },
    -  "style": "form"
    -}
    -
    -
    in: query
    -name: freeForm
    -schema:
    -  type: object
    -  additionalProperties:
    -    type: integer
    -style: form
    -
    -

    A complex parameter using content to define serialization:

    -
    {
    -  "in": "query",
    -  "name": "coordinates",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "type": "object",
    -        "required": [
    -          "lat",
    -          "long"
    -        ],
    -        "properties": {
    -          "lat": {
    -            "type": "number"
    -          },
    -          "long": {
    -            "type": "number"
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    in: query
    -name: coordinates
    -content:
    -  application/json:
    -    schema:
    -      type: object
    -      required:
    -        - lat
    -        - long
    -      properties:
    -        lat:
    -          type: number
    -        long:
    -          type: number
    -
    -

    4.7.13. Request Body Object

    -

    Describes a single request body.

    -
    4.7.13.1. Fixed Fields
    - - - - - - - -
    Field Name - Type - Description -
    description - string - A brief description of the request body. This could contain examples of use. CommonMark syntax MAY be used for rich text representation. -
    content - Map[string, Media Type Object] - REQUIRED. The content of the request body. The key is a media type or [media type range]appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* -
    required - boolean - Determines if the request body is required in the request. Defaults to false. -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.13.2. Request Body Examples
    -

    A request body with a referenced model definition.

    -
    {
    -  "description": "user to add to the system",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "$ref": "#/components/schemas/User"
    -      },
    -      "examples": {
    -          "user" : {
    -            "summary": "User Example", 
    -            "externalValue": "http://foo.bar/examples/user-example.json"
    -          } 
    -        }
    -    },
    -    "application/xml": {
    -      "schema": {
    -        "$ref": "#/components/schemas/User"
    -      },
    -      "examples": {
    -          "user" : {
    -            "summary": "User example in XML",
    -            "externalValue": "http://foo.bar/examples/user-example.xml"
    -          }
    -        }
    -    },
    -    "text/plain": {
    -      "examples": {
    -        "user" : {
    -            "summary": "User example in Plain text",
    -            "externalValue": "http://foo.bar/examples/user-example.txt" 
    -        }
    -      } 
    -    },
    -    "*/*": {
    -      "examples": {
    -        "user" : {
    -            "summary": "User example in other format",
    -            "externalValue": "http://foo.bar/examples/user-example.whatever"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    description: user to add to the system
    -content: 
    -  'application/json':
    -    schema:
    -      $ref: '#/components/schemas/User'
    -    examples:
    -      user:
    -        summary: User Example
    -        externalValue: 'http://foo.bar/examples/user-example.json'
    -  'application/xml':
    -    schema:
    -      $ref: '#/components/schemas/User'
    -    examples:
    -      user:
    -        summary: User Example in XML
    -        externalValue: 'http://foo.bar/examples/user-example.xml'
    -  'text/plain':
    -    examples:
    -      user:
    -        summary: User example in text plain format
    -        externalValue: 'http://foo.bar/examples/user-example.txt'
    -  '*/*':
    -    examples:
    -      user: 
    -        summary: User example in other format
    -        externalValue: 'http://foo.bar/examples/user-example.whatever'
    -
    -

    A body parameter that is an array of string values:

    -
    {
    -  "description": "user to add to the system",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "type": "string"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    description: user to add to the system
    -required: true
    -content:
    -  text/plain:
    -    schema:
    -      type: array
    -      items:
    -        type: string
    -
    -

    4.7.14. Media Type Object

    -

    Each Media Type Object provides schema and examples for the media type identified by its key.

    -
    4.7.14.1. Fixed Fields
    - - - - - - - - -
    Field Name - Type - Description -
    schema - Schema Object ¦ Reference Object - The schema defining the type used for the request body. -
    example - Any - Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The example field is mutually exclusive of the examples field. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema. -
    examples - Map[ string, Example Object ¦ Reference Object] - Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The examples field is mutually exclusive of the example field. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema. -
    encoding - Map[string, Encoding Object] - A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded. -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.14.2. Media Type Examples
    -
    {
    -  "application/json": {
    -    "schema": {
    -         "$ref": "#/components/schemas/Pet"
    -    },
    -    "examples": {
    -      "cat" : {
    -        "summary": "An example of a cat",
    -        "value": 
    -          {
    -            "name": "Fluffy",
    -            "petType": "Cat",
    -            "color": "White",
    -            "gender": "male",
    -            "breed": "Persian"
    -          }
    -      },
    -      "dog": {
    -        "summary": "An example of a dog with a cat’s name",
    -        "value" :  { 
    -          "name": "Puma",
    -          "petType": "Dog",
    -          "color": "Black",
    -          "gender": "Female",
    -          "breed": "Mixed"
    -        },
    -      "frog": {
    -          "$ref": "#/components/examples/frog-example"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    application/json: 
    -  schema:
    -    $ref: "#/components/schemas/Pet"
    -  examples:
    -    cat:
    -      summary: An example of a cat
    -      value:
    -        name: Fluffy
    -        petType: Cat
    -        color: White
    -        gender: male
    -        breed: Persian
    -    dog:
    -      summary: An example of a dog with a cat’s name
    -      value:
    -        name: Puma
    -        petType: Dog
    -        color: Black
    -        gender: Female
    -        breed: Mixed
    -    frog:
    -      $ref: "#/components/examples/frog-example"
    -
    -
    4.7.14.3. Considerations for File Uploads
    -

    In contrast with the 2.0 specification, file input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically:

    -
    # content transferred with base64 encoding
    -schema:
    -  type: string
    -  format: base64
    -
    -
    # content transferred in binary (octet-stream):
    -schema:
    -  type: string
    -  format: binary
    -
    -

    These examples apply to either input payloads of file uploads or response payloads.

    -

    A requestBody for submitting a file in a POST operation may look like the following example:

    -
    requestBody:
    -  content:
    -    application/octet-stream:
    -      # any media type is accepted, functionally equivalent to */*
    -      schema:
    -        # a binary file of any type
    -        type: string
    -        format: binary
    -
    -

    In addition, specific media types MAY be specified:

    -
    # multiple, specific media types may be specified:
    -requestBody:
    -  content:
    -      # a binary file of type png or jpeg
    -    'image/jpeg':
    -      schema:
    -        type: string
    -        format: binary
    -    'image/png':
    -      schema:
    -        type: string
    -        format: binary        
    -
    -

    To upload multiple files, a multipart media type MUST be used:

    -
    requestBody:
    -  content:
    -    multipart/form-data:
    -      schema:
    -        properties:
    -          # The property name 'file' will be used for all files.
    -          file:
    -            type: array
    -            items:
    -              type: string
    -              format: binary
    -
    -
    -
    4.7.14.4. Support for x-www-form-urlencoded Request Bodies
    -

    To submit content using form url encoding via [rfc1866], the following -definition may be used:

    -
    requestBody:
    -  content:
    -    application/x-www-form-urlencoded:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            type: string
    -            format: uuid
    -          address:
    -            # complex types are stringified to support RFC 1866
    -            type: object
    -            properties: {}
    -
    -

    In this example, the contents in the requestBody MUST be stringified per [rfc1866]) when passed to the server. In addition, the address field complex object will be stringified.

    -

    When passing complex objects in the application/x-www-form-urlencoded content type, the default serialization strategy of such properties is described in the Encoding Object’s style property as form.

    -
    4.7.14.5. Special Considerations for multipart Content
    -

    It is common to use multipart/form-data as a Content-Type when transferring request bodies to operations. In contrast to 2.0, a schema is REQUIRED to define the input parameters to the operation when using multipart content. This supports complex structures as well as supporting mechanisms for multiple file uploads.

    -

    When passing in multipart types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default Content-Types are defined for multipart:

    -
      -
    • If the property is a primitive, or an array of primitive values, the default Content-Type is text/plain -
    • If the property is complex, or an array of complex values, the default Content-Type is application/json -
    • If the property is a type: string with format: binary or format: base64 (aka a file object), the default Content-Type is application/octet-stream -
    -

    Examples:

    -
    requestBody:
    -  content:
    -    multipart/form-data:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            type: string
    -            format: uuid
    -          address:
    -            # default Content-Type for objects is application/json
    -            type: object
    -            properties: {}
    -          profileImage:
    -            # default Content-Type for string/binary is application/octet-stream
    -            type: string
    -            format: binary
    -          children:
    -            # default Content-Type for arrays is based on the inner type (text/plain here)
    -            type: array
    -            items:
    -              type: string
    -          addresses:
    -            # default Content-Type for arrays is based on the inner type (object shown, so application/json in this example)
    -            type: array
    -            items:
    -              type: '#/components/schemas/Address'
    -
    -

    An encoding attribute is introduced to give you control over the serialization of parts of multipart request bodies. This attribute is only applicable to multipart and application/x-www-form-urlencoded request bodies.

    -

    4.7.15. Encoding Object

    -

    A single encoding definition applied to a single schema property.

    -
    4.7.15.1. Fixed Fields
    - - - - - - - - - -
    Field Name - Type - Description -
    contentType - string - The Content-Type for encoding a specific property. Default value depends on the property type: for string with format being binaryapplication/octet-stream; for other primitive types – text/plain; for object - application/json; for array – the default is defined based on the inner type. The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types. -
    headers - Map[string, Header Object ¦ Reference Object] - A map allowing additional information to be provided as headers, for example Content-Disposition. Content-Type is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a multipart. -
    style - string - Describes how a specific property value will be serialized depending on its type. See Parameter Object for details on the style property. The behavior follows the same values as query parameters, including default values. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded. -
    explode - boolean - When this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded. -
    allowReserved - boolean - Determines whether the parameter value SHOULD allow reserved characters, as defined by [rfc3986]section-2.2) :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded. -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.15.2. Encoding Object Example
    -
    requestBody:
    -  content:
    -    multipart/mixed:
    -      schema:
    -        type: object
    -        properties:
    -          id:
    -            # default is text/plain
    -            type: string
    -            format: uuid
    -          address:
    -            # default is application/json
    -            type: object
    -            properties: {}
    -          historyMetadata:
    -            # need to declare XML format!
    -            description: metadata in XML format
    -            type: object
    -            properties: {}
    -          profileImage:
    -            # default is application/octet-stream, need to declare an image type only!
    -            type: string
    -            format: binary
    -      encoding:
    -        historyMetadata:
    -          # require XML Content-Type in utf-8 encoding
    -          contentType: application/xml; charset=utf-8
    -        profileImage:
    -          # only accept png/jpeg
    -          contentType: image/png, image/jpeg
    -          headers:
    -            X-Rate-Limit-Limit:
    -              description: The number of allowed requests in the current period
    -              schema:
    -                type: integer
    -
    -

    4.7.16. Responses Object

    -

    A container for the expected responses of an operation. -The container maps a HTTP response code to the expected response.

    -

    The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. -However, documentation is expected to cover a successful operation response and any known errors.

    -

    The default MAY be used as a default response object for all HTTP codes -that are not covered individually by the specification.

    -

    The Responses Object MUST contain at least one response code, and it -SHOULD be the response for a successful operation call.

    -
    4.7.16.1. Fixed Fields
    - - - - - -
    Field Name - Type - Description -
    default - Response Object ¦ Reference Object - The documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. A Reference Object can link to a response that the OpenAPI Object’s components/responses section defines. -
    -
    4.7.16.2. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    HTTP Status Code - Response Object ¦ Reference Object - Any HTTP status code can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A Reference Object can link to a response that is defined in the OpenAPI Object’s components/responses section. This field MUST be enclosed in quotation marks (for example, “200”) for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character X. For example, 2XX represents all response codes between [200-299]. The following range definitions are allowed: 1XX, 2XX, 3XX, 4XX, and 5XX. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code. -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.16.3. Responses Object Example
    -

    A 200 response for a successful operation and a default response for others (implying an error):

    -
    {
    -  "200": {
    -    "description": "a pet to be returned",
    -    "content": {
    -      "application/json": {
    -        "schema": {
    -          "$ref": "#/components/schemas/Pet"
    -        }
    -      }
    -    }
    -  },
    -  "default": {
    -    "description": "Unexpected error",
    -    "content": {
    -      "application/json": {
    -        "schema": {
    -          "$ref": "#/components/schemas/ErrorModel"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    '200':
    -  description: a pet to be returned
    -  content: 
    -    application/json:
    -      schema:
    -        $ref: '#/components/schemas/Pet'
    -default:
    -  description: Unexpected error
    -  content:
    -    application/json:
    -      schema:
    -        $ref: '#/components/schemas/ErrorModel'
    -
    -

    4.7.17. Response Object

    -

    Describes a single response from an API Operation, including design-time, static links to operations based on the response.

    -
    4.7.17.1. Fixed Fields
    - - - - - - - - -
    Field Name - Type - Description -
    description - string - REQUIRED. A short description of the response. CommonMark syntax MAY be used for rich text representation. -
    headers - Map[string, Header Object ¦ Reference Object] - Maps a header name to its definition. [rfc7230]page-22) states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored. -
    content - Map[string, Media Type Object] - A map containing descriptions of potential response payloads. The key is a media type or [media type range]appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* -
    links - Map[string, Link Object ¦ Reference Object] - A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for Component Objects. -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.17.2. Response Object Examples
    -

    Response of an array of a complex type:

    -
    {
    -  "description": "A complex object array response",
    -  "content": {
    -    "application/json": {
    -      "schema": {
    -        "type": "array",
    -        "items": {
    -          "$ref": "#/components/schemas/VeryComplexType"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    description: A complex object array response
    -content: 
    -  application/json:
    -    schema: 
    -      type: array
    -      items:
    -        $ref: '#/components/schemas/VeryComplexType'
    -
    -

    Response with a string type:

    -
    {
    -  "description": "A simple string response",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  }
    -
    -}
    -
    -
    description: A simple string response
    -content:
    -  text/plain:
    -    schema:
    -      type: string
    -
    -

    Plain text response with headers:

    -
    {
    -  "description": "A simple string response",
    -  "content": {
    -    "text/plain": {
    -      "schema": {
    -        "type": "string"
    -      }
    -    }
    -  },
    -  "headers": {
    -    "X-Rate-Limit-Limit": {
    -      "description": "The number of allowed requests in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    },
    -    "X-Rate-Limit-Remaining": {
    -      "description": "The number of remaining requests in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    },
    -    "X-Rate-Limit-Reset": {
    -      "description": "The number of seconds left in the current period",
    -      "schema": {
    -        "type": "integer"
    -      }
    -    }
    -  }
    -}
    -
    -
    description: A simple string response
    -content:
    -  text/plain:
    -    schema:
    -      type: string
    -    example: 'whoa!'
    -headers:
    -  X-Rate-Limit-Limit:
    -    description: The number of allowed requests in the current period
    -    schema:
    -      type: integer
    -  X-Rate-Limit-Remaining:
    -    description: The number of remaining requests in the current period
    -    schema:
    -      type: integer
    -  X-Rate-Limit-Reset:
    -    description: The number of seconds left in the current period
    -    schema:
    -      type: integer
    -
    -

    Response with no return value:

    -
    {
    -  "description": "object created"
    -}
    -
    -
    description: object created
    -
    -

    4.7.18. Callback Object

    -

    A map of possible out-of band callbacks related to the parent operation. -Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. -The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

    -
    4.7.18.1. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    {expression} - Path Item Object - A Path Item Object used to define a callback request and expected responses. A complete example is available. -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.18.2. Key Expression
    -

    The key that identifies the Path Item Object is a runtime expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request. -A simple example might be $request.body#/url. -However, using a runtime expression the complete HTTP message can be accessed. -This includes accessing any part of a body that a JSON Pointer [rfc6901] can reference.

    -

    For example, given the following HTTP request:

    -
    POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1
    -Host: example.org
    -Content-Type: application/json
    -Content-Length: 187
    -
    -{
    -  "failedUrl" : "http://clientdomain.com/failed",
    -  "successUrls" : [
    -    "http://clientdomain.com/fast",
    -    "http://clientdomain.com/medium",
    -    "http://clientdomain.com/slow"
    -  ] 
    -}
    -
    -201 Created
    -Location: http://example.org/subscription/1
    -
    -

    The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named eventType and a query parameter named queryUrl.

    - - - - - - - - - - - - -
    Expression - Value -
    $url - http://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning -
    $method - POST -
    $request.path.eventType - myevent -
    $request.query.queryUrl - http://clientdomain.com/stillrunning -
    $request.header.content-Type - application/json -
    $request.body#/failedUrl - http://clientdomain.com/stillrunning -
    $request.body#/successUrls/2 - http://clientdomain.com/medium -
    $response.header.Location - http://example.org/subscription/1 -
    -
    4.7.18.3. Callback Object Example
    -

    The following example shows a callback to the URL specified by the id and email property in the request body.

    -
    myWebhook:
    -  'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
    -    post:
    -      requestBody:
    -        description: Callback payload
    -        content: 
    -          'application/json':
    -            schema:
    -              $ref: '#/components/schemas/SomePayload'
    -      responses:
    -        '200':
    -          description: webhook successfully processed and no retries will be performed
    -
    -

    4.7.19. Example Object

    -
    4.7.19.1. Fixed Fields
    - - - - - - - - -
    Field Name - Type - Description -
    summary - string - Short description for the example. -
    description - string - Long description for the example. CommonMark syntax MAY be used for rich text representation. -
    value - Any - Embedded literal example. The value field and externalValue field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary. -
    externalValue - string - A URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The value field and externalValue field are mutually exclusive. -
    -

    This object MAY be extended with Specification Extensions.

    -

    In all cases, the example value is expected to be compatible with the type schema -of its associated value. Tooling implementations MAY choose to -validate compatibility automatically, and reject the example value(s) if incompatible.

    -
    4.7.19.2. Example Object Example
    -
    # in a model
    -schemas:
    -  properties:
    -    name:
    -      type: string
    -      examples:
    -        name:
    -          $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example
    -
    -# in a request body:
    -  requestBody:
    -    content:
    -      'application/json':
    -        schema:
    -          $ref: '#/components/schemas/Address'
    -        examples: 
    -          foo:
    -            summary: A foo example
    -            value: {"foo": "bar"}
    -          bar:
    -            summary: A bar example
    -            value: {"bar": "baz"}
    -      'application/xml':
    -        examples: 
    -          xmlExample:
    -            summary: This is an example in XML
    -            externalValue: 'http://example.org/examples/address-example.xml'
    -      'text/plain':
    -        examples:
    -          textExample: 
    -            summary: This is a text example
    -            externalValue: 'http://foo.bar/examples/address-example.txt' 
    -
    -
    -# in a parameter
    -  parameters:
    -    - name: 'zipCode'
    -      in: 'query'
    -      schema:
    -        type: 'string'
    -        format: 'zip-code'
    -        examples:
    -          zip-example: 
    -            $ref: '#/components/examples/zip-example'
    -
    -# in a response
    -  responses:
    -    '200':
    -      description: your car appointment has been booked
    -      content: 
    -        application/json:
    -          schema:
    -            $ref: '#/components/schemas/SuccessResponse'
    -          examples:
    -            confirmation-success:
    -              $ref: '#/components/examples/confirmation-success'
    -
    - -

    The Link object represents a possible design-time link for a response. -The presence of a link does not guarantee the caller’s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.

    -

    Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.

    -

    For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.

    -
    4.7.20.1. Fixed Fields
    - - - - - - - - - - -
    Field Name - Type - Description -
    operationRef - string - A relative or absolute reference to an OAS operation. This field is mutually exclusive of the operationId field, and MUST point to an Operation Object. Relative operationRef values MAY be used to locate an existing Operation Object in the OpenAPI definition. -
    operationId - string - The name of an existing, resolvable OAS operation, as defined with a unique operationId. This field is mutually exclusive of the operationRef field. -
    parameters - Map[string, Any ¦ {expression}] - A map representing parameters to pass to an operation as specified with operationId or identified via operationRef. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id). -
    requestBody - Any ¦ {expression} - A literal value or {expression} to use as a request body when calling the target operation. -
    description - string - A description of the link. CommonMark syntax MAY be used for rich text representation. -
    server - Server Object - A server object to be used by the target operation. -
    -

    This object MAY be extended with Specification Extensions.

    -

    A linked operation MUST be identified using either an operationRef or operationId. -In the case of an operationId, it MUST be unique and resolved in the scope of the OAS document. -Because of the potential for name clashes, the operationRef syntax is preferred -for specifications with external references.

    -
    4.7.20.2. Examples
    -

    Computing a link from a request operation where the $request.path.id is used to pass a request parameter to the linked operation.

    -
    paths:
    -  /users/{id}:
    -    parameters:
    -    - name: id
    -      in: path
    -      required: true
    -      description: the user identifier, as userId 
    -      schema:
    -        type: string
    -    get:
    -      responses:
    -        '200':
    -          description: the user being returned
    -          content:
    -            application/json:
    -              schema:
    -                type: object
    -                properties:
    -                  uuid: # the unique user id
    -                    type: string
    -                    format: uuid
    -          links:
    -            address:
    -              # the target link operationId
    -              operationId: getUserAddress
    -              parameters:
    -                # get the id field from the request path parameter named id
    -                userId: $request.path.id
    -  # the path item of the linked operation
    -  /users/{userid}/address:
    -    parameters:
    -    - name: userid
    -      in: path
    -      required: true
    -      description: the user identifier, as userId 
    -      schema:
    -        type: string
    -    # linked operation
    -    get:
    -      operationId: getUserAddress
    -      responses:
    -        '200':
    -          description: the user’s address
    -
    -

    When a runtime expression fails to evaluate, no parameter value is passed to the target operation.

    -

    Values from the response body can be used to drive a linked operation.

    -
    links:
    -  address:
    -    operationId: getUserAddressByUUID
    -    parameters:
    -      # get the uuid field from the uuid field in the response body
    -      userUuid: $response.body#/uuid
    -
    -

    Clients follow all links at their discretion. -Neither permissions, nor the capability to make a successful call to that link, is guaranteed -solely by the existence of a relationship.

    -
    4.7.20.3. OperationRef Examples
    -

    As references to operationId MAY NOT be possible (the operationId is an optional -value), references MAY also be made through a relative operationRef:

    -
    links:
    -  UserRepositories:
    -    # returns array of '#/components/schemas/repository'
    -    operationRef: '#/paths/~12.0~1repositories~1{username}/get'
    -    parameters:
    -      username: $response.body#/username
    -
    -

    or an absolute operationRef:

    -
    links:
    -  UserRepositories:
    -    # returns array of '#/components/schemas/repository'
    -    operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get'
    -    parameters:
    -      username: $response.body#/username
    -
    -

    Note that in the use of operationRef, the escaped forward-slash is necessary when -using JSON references.

    -
    4.7.20.4. Runtime Expressions
    -

    Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. -This mechanism is used by Link Objects and Callback Objects.

    -

    The runtime expression is defined by the following [Augmented Backus-Naur Form] syntax

    -
    expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source )
    -source = ( header-reference | query-reference | path-reference | body-reference )  
    -header-reference = "header." token
    -query-reference = "query." name  
    -path-reference = "path." name
    -body-reference = "body" ["#" fragment]
    -fragment = a JSON Pointer [[!rfc6901]]  
    -name = *( char )
    -char = as per RFC [7159]section-7)
    -token = as per RFC [7230]section-3.2.6)
    -
    -

    The name identifier is case-sensitive, whereas token is not.

    -

    The table below provides examples of runtime expressions and examples of their use in a value:

    -
    4.7.20.5. Examples
    - - - - - - - - - - - -
    Source Location - example expression - notes -
    HTTP Method - $method - The allowable values for the $method will be those for the HTTP operation. -
    Requested media type - $request.header.accept - -
    Request parameter - $request.path.id - Request parameters MUST be declared in the parameters section of the parent operation or they cannot be evaluated. This includes request headers. -
    Request body property - $request.body#/user/uuid - In operations which accept payloads, references may be made to portions of the requestBody or the entire body. -
    Request URL - $url - -
    Response value - $response.body#/status - In operations which return payloads, references may be made to portions of the response body or the entire body. -
    Response header - $response.header.Server - Single header values only are available -
    -

    Runtime expressions preserve the type of the referenced value. -Expressions can be embedded into string values by surrounding the expression with {} curly braces.

    -

    4.7.21. Header Object

    -

    The Header Object follows the structure of the Parameter Object with the following changes:

    -
      -
    1. name MUST NOT be specified, it is given in the corresponding headers map. -
    2. in MUST NOT be specified, it is implicitly in header. -
    3. All traits that are affected by the location MUST be applicable to a location of header (for example, style). -
    -
    4.7.21.1. Header Object Example
    -

    A simple header of type integer:

    -
    {
    -  "description": "The number of allowed requests in the current period",
    -  "schema": {
    -    "type": "integer"
    -  }
    -}
    -
    -
    description: The number of allowed requests in the current period
    -schema:
    -  type: integer
    -
    -

    4.7.22. Tag Object

    -

    Adds metadata to a single tag that is used by the Operation Object. -It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

    -
    4.7.22.1. Fixed Fields
    - - - - - - - -
    Field Name - Type - Description -
    name - string - REQUIRED. The name of the tag. -
    description - string - A short description for the tag. CommonMark syntax MAY be used for rich text representation. -
    externalDocs - External Documentation Object - Additional external documentation for this tag. -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.22.2. Tag Object Example
    -
    {
    -  "name": "pet",
    -  "description": "Pets operations"
    -}
    -
    -
    name: pet
    -description: Pets operations
    -
    -

    4.7.23. Reference Object

    -

    A simple object to allow referencing other components in the specification, internally and externally.

    -

    The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.

    -

    For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.

    -
    4.7.23.1. Fixed Fields
    - - - - - -
    Field Name - Type - Description -
    $ref - string - REQUIRED. The reference string. -
    -

    This object cannot be extended with additional properties and any properties added SHALL be ignored.

    -
    4.7.23.2. Reference Object Example
    -
    {
    -  "$ref": "#/components/schemas/Pet"
    -}
    -
    -
    $ref: '#/components/schemas/Pet'
    -
    -
    4.7.23.3. Relative Schema Document Example
    -
    {
    -  "$ref": "Pet.json"
    -}
    -
    -
    $ref: Pet.yaml
    -
    -
    4.7.23.4. Relative Documents With Embedded Schema Example
    -
    {
    -  "$ref": "definitions.json#/Pet"
    -}
    -
    -
    $ref: definitions.yaml#/Pet
    -
    -

    4.7.24. Schema Object

    -

    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 an extended subset of the JSON Schema Specification Wright Draft 00.

    -

    For more information about the properties, see JSON Schema Core and JSON Schema Validation. -Unless stated otherwise, the property definitions follow the JSON Schema.

    -
    4.7.24.1. Properties
    -

    The following properties are taken directly from the JSON Schema definition and follow the same specifications:

    -
      -
    • title -
    • multipleOf -
    • maximum -
    • exclusiveMaximum -
    • minimum -
    • exclusiveMinimum -
    • maxLength -
    • minLength -
    • pattern (This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect) -
    • maxItems -
    • minItems -
    • uniqueItems -
    • maxProperties -
    • minProperties -
    • required -
    • enum -
    -

    The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification.

    -
      -
    • type - Value MUST be a string. Multiple types via an array are not supported. -
    • allOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. -
    • oneOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. -
    • anyOf - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. -
    • not - Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. -
    • items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. items MUST be present if the type is array. -
    • properties - Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced). -
    • additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. -
    • description - CommonMark syntax MAY be used for rich text representation. -
    • format - See Data Type Formats for further details. While relying on JSON Schema’s defined formats, the OAS offers a few additional predefined formats. -
    • default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if type is string, then default can be "foo" but cannot be 1. -
    -

    Alternatively, any time a Schema Object can be used, a Reference Object can be used in its place. This allows referencing definitions instead of defining them inline.

    -

    Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported.

    -

    Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation:

    -
    4.7.24.2. Fixed Fields
    - - - - - - - - - - - - -
    Field Name - Type - Description -
    nullable - boolean - Allows sending a null value for the defined schema. Default value is false. -
    discriminator - Discriminator Object - Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See Composition and Inheritance for more details. -
    readOnly - boolean - 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 SHOULD NOT be sent as part of the request. If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false. -
    writeOnly - boolean - Relevant only for Schema "properties" definitions. Declares the property as “write only”. Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as writeOnly being true and is in the required list, the required will take effect on the request only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false. -
    xml - XML Object - This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property. -
    externalDocs - External Documentation Object - Additional external documentation for this schema. -
    example - Any - A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. -
    deprecated - boolean - Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is false. -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.24.2.1. Composition and Inheritance (Polymorphism)
    -

    The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. allOf takes an array of object definitions that are validated independently but together compose a single object.

    -

    While composition offers model extensibility, it does not imply a hierarchy between the models. -To support polymorphism, the OpenAPI Specification adds the discriminator field. -When used, the discriminator will be the name of the property that decides which schema definition validates the structure of the model. -As such, the discriminator field MUST be a required field. -There are two ways to define the value of a discriminator for an inheriting instance.

    -
      -
    • Use the schema name. -
    • Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name. -As such, inline schema definitions, which do not have a given id, cannot be used in polymorphism. -
    -
    4.7.24.2.2. XML Modeling
    -

    The xml property allows extra definitions when translating the JSON definition to XML. -The XML Object contains additional information about the available options.

    -
    4.7.24.3. Schema Object Examples
    -
    4.7.24.3.1. Primitive Sample
    -
    {
    -  "type": "string",
    -  "format": "email"
    -}
    -
    -
    type: string
    -format: email
    -
    -
    4.7.24.3.2. Simple Model
    -
    {
    -  "type": "object",
    -  "required": [
    -    "name"
    -  ],
    -  "properties": {
    -    "name": {
    -      "type": "string"
    -    },
    -    "address": {
    -      "$ref": "#/components/schemas/Address"
    -    },
    -    "age": {
    -      "type": "integer",
    -      "format": "int32",
    -      "minimum": 0
    -    }
    -  }
    -}
    -
    -
    type: object
    -required:
    -- name
    -properties:
    -  name:
    -    type: string
    -  address:
    -    $ref: '#/components/schemas/Address'
    -  age:
    -    type: integer
    -    format: int32
    -    minimum: 0
    -
    -
    4.7.24.3.3. Model with Map/Dictionary Properties
    -

    For a simple string to string mapping:

    -
    {
    -  "type": "object",
    -  "additionalProperties": {
    -    "type": "string"
    -  }
    -}
    -
    -
    type: object
    -additionalProperties:
    -  type: string
    -
    -

    For a string to model mapping:

    -
    {
    -  "type": "object",
    -  "additionalProperties": {
    -    "$ref": "#/components/schemas/ComplexModel"
    -  }
    -}
    -
    -
    type: object
    -additionalProperties:
    -  $ref: '#/components/schemas/ComplexModel'
    -
    -
    4.7.24.3.4. Model with Example
    -
    {
    -  "type": "object",
    -  "properties": {
    -    "id": {
    -      "type": "integer",
    -      "format": "int64"
    -    },
    -    "name": {
    -      "type": "string"
    -    }
    -  },
    -  "required": [
    -    "name"
    -  ],
    -  "example": {
    -    "name": "Puma",
    -    "id": 1
    -  }
    -}
    -
    -
    type: object
    -properties:
    -  id:
    -    type: integer
    -    format: int64
    -  name:
    -    type: string
    -required:
    -- name
    -example:
    -  name: Puma
    -  id: 1
    -
    -
    4.7.24.3.5. Models with Composition
    -
    {
    -  "components": {
    -    "schemas": {
    -      "ErrorModel": {
    -        "type": "object",
    -        "required": [
    -          "message",
    -          "code"
    -        ],
    -        "properties": {
    -          "message": {
    -            "type": "string"
    -          },
    -          "code": {
    -            "type": "integer",
    -            "minimum": 100,
    -            "maximum": 600
    -          }
    -        }
    -      },
    -      "ExtendedErrorModel": {
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/ErrorModel"
    -          },
    -          {
    -            "type": "object",
    -            "required": [
    -              "rootCause"
    -            ],
    -            "properties": {
    -              "rootCause": {
    -                "type": "string"
    -              }
    -            }
    -          }
    -        ]
    -      }
    -    }
    -  }
    -}
    -
    -
    components:
    -  schemas:
    -    ErrorModel:
    -      type: object
    -      required:
    -      - message
    -      - code
    -      properties:
    -        message:
    -          type: string
    -        code:
    -          type: integer
    -          minimum: 100
    -          maximum: 600
    -    ExtendedErrorModel:
    -      allOf:
    -      - $ref: '#/components/schemas/ErrorModel'
    -      - type: object
    -        required:
    -        - rootCause
    -        properties:
    -          rootCause:
    -            type: string
    -
    -
    4.7.24.3.6. Models with Polymorphism Support
    -
    {
    -  "components": {
    -    "schemas": {
    -      "Pet": {
    -        "type": "object",
    -        "discriminator": {
    -          "propertyName": "petType"
    -        },
    -        "properties": {
    -          "name": {
    -            "type": "string"
    -          },
    -          "petType": {
    -            "type": "string"
    -          }
    -        },
    -        "required": [
    -          "name",
    -          "petType"
    -        ]
    -      },
    -      "Cat": {
    -        "description": "A representation of a cat. Note that Cat will be used as the discriminator value.",
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/Pet"
    -          },
    -          {
    -            "type": "object",
    -            "properties": {
    -              "huntingSkill": {
    -                "type": "string",
    -                "description": "The measured skill for hunting",
    -                "default": "lazy",
    -                "enum": [
    -                  "clueless",
    -                  "lazy",
    -                  "adventurous",
    -                  "aggressive"
    -                ]
    -              }
    -            },
    -            "required": [
    -              "huntingSkill"
    -            ]
    -          }
    -        ]
    -      },
    -      "Dog": {
    -        "description": "A representation of a dog. Note that Dog will be used as the discriminator value.",
    -        "allOf": [
    -          {
    -            "$ref": "#/components/schemas/Pet"
    -          },
    -          {
    -            "type": "object",
    -            "properties": {
    -              "packSize": {
    -                "type": "integer",
    -                "format": "int32",
    -                "description": "the size of the pack the dog is from",
    -                "default": 0,
    -                "minimum": 0
    -              }
    -            },
    -            "required": [
    -              "packSize"
    -            ]
    -          }
    -        ]
    -      }
    -    }
    -  }
    -}
    -
    -
    components:
    -  schemas:
    -    Pet:
    -      type: object
    -      discriminator:
    -        propertyName: petType
    -      properties:
    -        name:
    -          type: string
    -        petType:
    -          type: string
    -      required:
    -      - name
    -      - petType
    -    Cat:  ## "Cat" will be used as the discriminator value
    -      description: A representation of a cat
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        properties:
    -          huntingSkill:
    -            type: string
    -            description: The measured skill for hunting
    -            enum:
    -            - clueless
    -            - lazy
    -            - adventurous
    -            - aggressive
    -        required:
    -        - huntingSkill
    -    Dog:  ## "Dog" will be used as the discriminator value
    -      description: A representation of a dog
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        properties:
    -          packSize:
    -            type: integer
    -            format: int32
    -            description: the size of the pack the dog is from
    -            default: 0
    -            minimum: 0
    -        required:
    -        - packSize
    -
    -

    4.7.25. Discriminator Object

    -

    When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

    -

    When using the discriminator, inline schemas will not be considered.

    -
    4.7.25.1. Fixed Fields
    - - - - - - -
    Field Name - Type - Description -
    propertyName - string - REQUIRED. The name of the property in the payload that will hold the discriminator value. -
    mapping - Map[string, string] - An object to hold mappings between payload values and schema names or references. -
    -

    The discriminator attribute is legal only when using one of the composite keywords oneOf, anyOf, allOf.

    -

    In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:

    -
    MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -
    -

    which means the payload MUST, by validation, match exactly one of the schemas described by Cat, Dog, or Lizard. In this case, a discriminator MAY act as a “hint” to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use:

    -
    MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -  discriminator:
    -    propertyName: pet_type
    -
    -

    The expectation now is that a property with name pet_type MUST be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload:

    -
    {
    -  "id": 12345,
    -  "pet_type": "Cat"
    -}
    -
    -

    Will indicate that the Cat schema be used in conjunction with this payload.

    -

    In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional mapping definition MAY be used:

    -
    MyResponseType:
    -  oneOf:
    -  - $ref: '#/components/schemas/Cat'
    -  - $ref: '#/components/schemas/Dog'
    -  - $ref: '#/components/schemas/Lizard'
    -  - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json'
    -  discriminator:
    -    propertyName: pet_type
    -    mapping:
    -      dog: '#/components/schemas/Dog'
    -      monster: 'https://gigantic-server.com/schemas/Monster/schema.json'
    -
    -

    Here the discriminator value of dog will map to the schema #/components/schemas/Dog, rather than the default (implicit) value of Dog. If the discriminator value does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison.

    -

    When used in conjunction with the anyOf construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload.

    -

    In both the oneOf and anyOf use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an allOf construct may be used as an alternate schema.

    -

    For example:

    -
    components:
    -  schemas:
    -    Pet:
    -      type: object
    -      required:
    -      - pet_type
    -      properties:
    -        pet_type:
    -          type: string
    -      discriminator:
    -        propertyName: pet_type
    -        mapping:
    -          cachorro: Dog
    -    Cat:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a Cat
    -        properties:
    -          name:
    -            type: string
    -    Dog:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a Dog
    -        properties:
    -          bark:
    -            type: string
    -    Lizard:
    -      allOf:
    -      - $ref: '#/components/schemas/Pet'
    -      - type: object
    -        # all other properties specific to a Lizard
    -        properties:
    -          lovesRocks:
    -            type: boolean
    -
    -

    a payload like this:

    -
    {
    -  "pet_type": "Cat",
    -  "name": "misty"
    -}
    -
    -

    will indicate that the Cat schema be used. Likewise this schema:

    -
    {
    -  "pet_type": "cachorro",
    -  "bark": "soft"
    -}
    -
    -

    will map to Dog because of the definition in the mappings element.

    -

    4.7.26. XML Object

    -

    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.

    -
    4.7.26.1. Fixed Fields
    - - - - - - - - - -
    Field Name - Type - Description -
    name - string - Replaces the name of the element/attribute used for the described schema property. When defined within 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. -
    namespace - string - The URI of the namespace definition. Value MUST be in the form of an absolute URI. -
    prefix - string - The prefix to be used for the name. -
    attribute - boolean - Declares whether the property definition translates to an attribute instead of an element. Default value is false. -
    wrapped - 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). -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.26.2. XML Object Examples
    -

    The examples of the XML object definitions are included inside a property definition of a Schema Object with a sample of the XML representation of it.

    -
    4.7.26.2.1. No XML Element
    -

    Basic string property:

    -
    {
    -    "animals": {
    -        "type": "string"
    -    }
    -}
    -
    -
    animals:
    -  type: string
    -
    -
    <animals>...</animals>
    -
    -

    Basic string array property (wrapped is false by default):

    -
    {
    -    "animals": {
    -        "type": "array",
    -        "items": {
    -            "type": "string"
    -        }
    -    }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -
    -
    <animals>...</animals>
    -<animals>...</animals>
    -<animals>...</animals>
    -
    -
    4.7.26.2.2. XML Name Replacement
    -
    {
    -  "animals": {
    -    "type": "string",
    -    "xml": {
    -      "name": "animal"
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: string
    -  xml:
    -    name: animal
    -
    -
    <animal>...</animal>
    -
    -
    4.7.26.2.3. XML Attribute, Prefix and Namespace
    -

    In this example, a full model definition is shown.

    -
    {
    -  "Person": {
    -    "type": "object",
    -    "properties": {
    -      "id": {
    -        "type": "integer",
    -        "format": "int32",
    -        "xml": {
    -          "attribute": true
    -        }
    -      },
    -      "name": {
    -        "type": "string",
    -        "xml": {
    -          "namespace": "http://example.com/schema/sample",
    -          "prefix": "sample"
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -
    Person:
    -  type: object
    -  properties:
    -    id:
    -      type: integer
    -      format: int32
    -      xml:
    -        attribute: true
    -    name:
    -      type: string
    -      xml:
    -        namespace: http://example.com/schema/sample
    -        prefix: sample
    -
    -
    <Person id="123">
    -    <sample:name xmlns:sample="http://example.com/schema/sample">example</sample:name>
    -</Person>
    -
    -
    4.7.26.2.4. XML Arrays
    -

    Changing the element names:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -
    -
    <animal>value</animal>
    -<animal>value</animal>
    -
    -

    The external name property has no effect on the XML:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens"
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -
    -
    <animal>value</animal>
    -<animal>value</animal>
    -
    -

    Even when the array is wrapped, if a name is not explicitly defined, the same name will be used both internally and externally:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    wrapped: true
    -
    -
    <animals>
    -  <animals>value</animals>
    -  <animals>value</animals>
    -</animals>
    -
    -

    To overcome the naming problem in the example above, the following definition can be used:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    wrapped: true
    -
    -
    <animals>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</animals>
    -
    -

    Affecting both internal and external names:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string",
    -      "xml": {
    -        "name": "animal"
    -      }
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -    xml:
    -      name: animal
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    <aliens>
    -  <animal>value</animal>
    -  <animal>value</animal>
    -</aliens>
    -
    -

    If we change the external element but not the internal ones:

    -
    {
    -  "animals": {
    -    "type": "array",
    -    "items": {
    -      "type": "string"
    -    },
    -    "xml": {
    -      "name": "aliens",
    -      "wrapped": true
    -    }
    -  }
    -}
    -
    -
    animals:
    -  type: array
    -  items:
    -    type: string
    -  xml:
    -    name: aliens
    -    wrapped: true
    -
    -
    <aliens>
    -  <aliens>value</aliens>
    -  <aliens>value</aliens>
    -</aliens>
    -
    -

    4.7.27. Security Scheme Object

    -

    Defines a security scheme that can be used by the operations. -Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2’s common flows (implicit, password, application and access code) as defined in [rfc6749], and OpenID Connect Discovery.

    -
    4.7.27.1. Fixed Fields
    - - - - - - - - - - - - -
    Field Name - Type - Applies To - Description -
    type - string - Any - REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "oauth2", "openIdConnect". -
    description - string - Any - A short description for security scheme. CommonMark syntax MAY be used for rich text representation. -
    name - string - apiKey - REQUIRED. The name of the header, query or cookie parameter to be used. -
    in - string - apiKey - REQUIRED. The location of the API key. Valid values are "query", "header" or "cookie". -
    scheme - string - http - REQUIRED. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235]section-5.1). -
    bearerFormat - string - http ("bearer") - A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. -
    flows - OAuth Flows Object - oauth2 - REQUIRED. An object containing configuration information for the flow types supported. -
    openIdConnectUrl - string - openIdConnect - REQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.27.2. Security Scheme Object Example
    -
    4.7.27.2.1. Basic Authentication Sample
    -
    {
    -  "type": "http",
    -  "scheme": "basic"
    -}
    -
    -
    type: http
    -scheme: basic
    -
    -
    4.7.27.2.2. API Key Sample
    -
    {
    -  "type": "apiKey",
    -  "name": "api_key",
    -  "in": "header"
    -}
    -
    -
    type: apiKey
    -name: api_key
    -in: header
    -
    -
    4.7.27.2.3. JWT Bearer Sample
    -
    {
    -  "type": "http",
    -  "scheme": "bearer",
    -  "bearerFormat": "JWT",
    -}
    -
    -
    type: http
    -scheme: bearer
    -bearerFormat: JWT
    -
    -
    4.7.27.2.4. Implicit OAuth2 Sample
    -
    {
    -  "type": "oauth2",
    -  "flows": {
    -    "implicit": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    }
    -  }
    -}
    -
    -
    type: oauth2
    -flows: 
    -  implicit:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets
    -
    -

    4.7.28. OAuth Flows Object

    -

    Allows configuration of the supported OAuth Flows.

    -
    4.7.28.1. Fixed Fields
    - - - - - - - - -
    Field Name - Type - Description -
    implicit - OAuth Flow Object - Configuration for the OAuth Implicit flow -
    password - OAuth Flow Object - Configuration for the OAuth Resource Owner Password flow -
    clientCredentials - OAuth Flow Object - Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0. -
    authorizationCode - OAuth Flow Object - Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0. -
    -

    This object MAY be extended with Specification Extensions.

    -

    4.7.29. OAuth Flow Object

    -

    Configuration details for a supported OAuth Flow

    -
    4.7.29.1. Fixed Fields
    - - - - - - - - -
    Field Name - Type - Applies To - Description -
    authorizationUrl - string - oauth2 ("implicit", "authorizationCode") - REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL. -
    tokenUrl - string - oauth2 ("password", "clientCredentials", "authorizationCode") - REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL. -
    refreshUrl - string - oauth2 - The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. -
    scopes - Map[string, string] - oauth2 - REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. -
    -

    This object MAY be extended with Specification Extensions.

    -
    4.7.29.2. OAuth Flow Object Examples
    -
    {
    -  "type": "oauth2",
    -  "flows": {
    -    "implicit": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    },
    -    "authorizationCode": {
    -      "authorizationUrl": "https://example.com/api/oauth/dialog",
    -      "tokenUrl": "https://example.com/api/oauth/token",
    -      "scopes": {
    -        "write:pets": "modify pets in your account",
    -        "read:pets": "read your pets"
    -      }
    -    }
    -  }
    -}
    -
    -
    type: oauth2
    -flows: 
    -  implicit:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets
    -  authorizationCode:
    -    authorizationUrl: https://example.com/api/oauth/dialog
    -    tokenUrl: https://example.com/api/oauth/token
    -    scopes:
    -      write:pets: modify pets in your account
    -      read:pets: read your pets 
    -
    -

    4.7.30. Security Requirement Object

    -

    Lists the required security schemes to execute this operation. -The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.

    -

    Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. -This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.

    -

    When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.

    -
    4.7.30.1. Patterned Fields
    - - - - - -
    Field Pattern - Type - Description -
    {name} - [string] - Each name MUST correspond to a security scheme which is declared in the Security Schemes under the Components Object. If the security scheme is of type "oauth2" or "openIdConnect", then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty. -
    -
    4.7.30.2. Security Requirement Object Examples
    -
    4.7.30.2.1. Non-OAuth2 Security Requirement
    -
    {
    -  "api_key": []
    -}
    -
    -
    api_key: []
    -
    -
    4.7.30.2.2. OAuth2 Security Requirement
    -
    {
    -  "petstore_auth": [
    -    "write:pets",
    -    "read:pets"
    -  ]
    -}
    -
    -
    petstore_auth:
    -- write:pets
    -- read:pets
    -
    -

    4.8. Specification Extensions

    -

    While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.

    -

    The extensions properties are implemented as patterned fields that are always prefixed by "x-".

    - - - - - -
    Field Pattern - Type - Description -
    ^x- - Any - Allows extensions to the OpenAPI Schema. The field name MUST begin with x-, for example, x-internal-id. The value can be null, a primitive, an array or an object. 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).

    -

    4.9. Security Filtering

    -

    Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.

    -

    The reasoning is to allow an additional layer of access control over the documentation. -While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.

    -

    Two examples of this:

    -
      -
    1. The Paths Object MAY be empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can’t access any documentation. They’d still have access to the Info Object which may contain additional information regarding authentication. -
    2. The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different than hiding the path itself from the Paths Object, so the user will not be aware of its existence. This allows the documentation provider to finely control what the viewer can see. -
    -

    Appendix A: Revision History

    - - - - - - - - - - - - - - -
    Version - Date - Notes -
    3.0.1 - 2017-12-06 - Patch release of the OpenAPI Specification 3.0.1 -
    3.0.0 - 2017-07-26 - Release of the OpenAPI Specification 3.0.0 -
    3.0.0-rc2 - 2017-06-16 - rc2 of the 3.0 specification -
    3.0.0-rc1 - 2017-04-27 - rc1 of the 3.0 specification -
    3.0.0-rc0 - 2017-02-28 - Implementer’s Draft of the 3.0 specification -
    2.0 - 2015-12-31 - Donation of Swagger 2.0 to the Open API Initiative -
    2.0 - 2014-09-08 - Release of Swagger 2.0 -
    1.2 - 2014-03-14 - Initial release of the formal document. -
    1.1 - 2012-08-22 - Release of Swagger 1.1 -
    1.0 - 2011-08-10 - First release of the Swagger Specification -
    -
    -
    -

    Conformance

    -

    Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. - The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” - in the normative parts of this document - are to be interpreted as described in RFC 2119. - However, for readability, - these words do not appear in all uppercase letters in this specification.

    -

    All of the text of this specification is normative - except sections explicitly marked as non-normative, examples, and notes. [RFC2119]

    -

    Examples in this specification are introduced with the words “for example” - or are set apart from the normative text with class="example", like this:

    -
    This is an example of an informative example.
    -

    Informative notes begin with the word “Note” - and are set apart from the normative text with class="note", like this:

    -

    Note, this is an informative note.

    -
    - -

    Index

    -

    Terms defined by this specification

    - -

    References

    -

    Normative References

    -
    -
    [RFC1866] -
    D. Connolly; L. Masinter. The 'text/html' Media Type. June 2000. Informational. URL: https://tools.ietf.org/html/rfc2854 -
    [RFC2119] -
    S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119 -
    [RFC3986] -
    T. Berners-Lee; R. Fielding; L. Masinter. Uniform Resource Identifier (URI): Generic Syntax. January 2005. Internet Standard. URL: https://tools.ietf.org/html/rfc3986 -
    [RFC6570] -
    J. Gregorio; et al. URI Template. March 2012. Proposed Standard. URL: https://tools.ietf.org/html/rfc6570 -
    [RFC6749] -
    D. Hardt, Ed.. The OAuth 2.0 Authorization Framework. October 2012. Proposed Standard. URL: https://tools.ietf.org/html/rfc6749 -
    [RFC6838] -
    N. Freed; J. Klensin; T. Hansen. Media Type Specifications and Registration Procedures. January 2013. Best Current Practice. URL: https://tools.ietf.org/html/rfc6838 -
    [RFC6901] -
    P. Bryan, Ed.; K. Zyp; M. Nottingham, Ed.. JavaScript Object Notation (JSON) Pointer. April 2013. Proposed Standard. URL: https://tools.ietf.org/html/rfc6901 -
    [RFC7230] -
    R. Fielding, Ed.; J. Reschke, Ed.. Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing. June 2014. Proposed Standard. URL: https://tools.ietf.org/html/rfc7230 -
    [RFC7231] -
    R. Fielding, Ed.; J. Reschke, Ed.. Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content. June 2014. Proposed Standard. URL: https://tools.ietf.org/html/rfc7231 -
    [RFC8174] -
    B. Leiba. Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words. May 2017. Best Current Practice. URL: https://tools.ietf.org/html/rfc8174 -
    - - - - - \ No newline at end of file From 33d8c0b41e03aa621da5c290075e1a0f6670f23f Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Wed, 27 May 2020 17:34:48 +0100 Subject: [PATCH 29/34] md2html; specify lang="en" in html --- scripts/md2html/md2html.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/md2html/md2html.js b/scripts/md2html/md2html.js index 3a990bc1cc..3c0fd5045e 100644 --- a/scripts/md2html/md2html.js +++ b/scripts/md2html/md2html.js @@ -71,7 +71,7 @@ function preface(title,options) { includePermalinks: true }; - let preface = `${md.utils.escapeHtml(title)}`; + let preface = `${md.utils.escapeHtml(title)}`; if (options.respec) { preface += ''; preface += ``; From a73363bbaa2eee33cc04122d5ec1e4735b5981b0 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Tue, 16 Feb 2021 07:38:25 +0000 Subject: [PATCH 30/34] build: update deps --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e4f1c278ef..1c0c24460c 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,9 @@ "schemas/*" ], "dependencies": { - "cheerio": "^1.0.0-rc.2", - "highlight.js": "^10.0.3", - "markdown-it": "^11.0.0", + "cheerio": "^1.0.0-rc.5", + "highlight.js": "^10.6.0", + "markdown-it": "^12.0.4", "yargs": "^12.0.5" }, "devDependencies": { From fa8f44ba417370952df5527b066bbf45173ec2b2 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Thu, 29 Apr 2021 16:10:27 +0100 Subject: [PATCH 31/34] fix: style examples bugs, refs #2488 --- scripts/md2html/md2html.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/md2html/md2html.js b/scripts/md2html/md2html.js index 3c0fd5045e..ba680d0881 100644 --- a/scripts/md2html/md2html.js +++ b/scripts/md2html/md2html.js @@ -228,7 +228,7 @@ for (let l in lines) { line = line.replace('">','"> '); } - line = line.split('\\|').join('¦'); + line = line.split('\\|').join('|'); // was ¦ if (!inCodeBlock) { @@ -305,6 +305,6 @@ s = preface('OpenAPI Specification',argv)+'\n\n'+lines.join('\n'); let out = md.render(s); out = out.replace(/\[([RGB])\]/g,function(match,group1){ console.warn('Fixing',match,group1); - return '\\'+group1; + return '['+group1+']'; }); console.log(out); From 85040b6c1bd65e2499f881bcc0b8c9baeddd2be9 Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Wed, 12 May 2021 14:20:12 +0100 Subject: [PATCH 32/34] fix: update highlightjs call in md2html --- .gitignore | 2 ++ scripts/md2html/build.sh | 6 ++++++ scripts/md2html/md2html.js | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index aa8e47b4c6..9ffeae3497 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ target atlassian-ide-plugin.xml node_modules/ package-lock.json +deploy/ +history Gemfile.lock diff --git a/scripts/md2html/build.sh b/scripts/md2html/build.sh index d91f79a2ed..e0a3256f86 100755 --- a/scripts/md2html/build.sh +++ b/scripts/md2html/build.sh @@ -1,7 +1,13 @@ #!/bin/sh + +# run this script from the root of the repo + mkdir -p deploy/oas mkdir -p deploy/js + cd scripts/md2html +mkdir -p history +git show c740e950d:MAINTAINERS.md > history/MAINTAINERS_v2.0.md cp -p js/* ../../deploy/js cp -p markdown/* ../../deploy/ diff --git a/scripts/md2html/md2html.js b/scripts/md2html/md2html.js index ba680d0881..26448d1081 100644 --- a/scripts/md2html/md2html.js +++ b/scripts/md2html/md2html.js @@ -42,7 +42,7 @@ const md = require('markdown-it')({ if (lang && hljs.getLanguage(lang)) { // && !argv.respec) { try { return '
    ' +
    -                  hljs.highlight(lang, str, true).value +
    +                  hljs.highlight(str, { language: lang }).value +
                       '
    '; } catch (__) { } } From b2b1c165f84458492d532fc7fedab8ed034e0d2a Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Thu, 13 May 2021 15:52:33 +0100 Subject: [PATCH 33/34] feat: add github action Signed-off-by: Mike Ralphson --- .github/workflows/respec.yaml | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/respec.yaml diff --git a/.github/workflows/respec.yaml b/.github/workflows/respec.yaml new file mode 100644 index 0000000000..bfa286f72e --- /dev/null +++ b/.github/workflows/respec.yaml @@ -0,0 +1,55 @@ +name: respec + +# author: @MikeRalphson +# issue: https://github.com/OAI/OpenAPI-Specification/issues/1564 + +# +# This workflow updates the respec 'pretty' rendered versions of the spec +# on the gh-pages branch when the corresponding markdown files change. +# + +# run this on push to main +on: + push: + branches: + - main + workflow_dispatch: {} + +jobs: + respec: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 # checkout main branch + + - name: Install dependencies + run: npm i + + - uses: actions/checkout@v2 # checkout gh-pages branch + with: + ref: gh-pages + path: deploy + + - name: run main script + run: scripts/md2html/build.sh + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: update-respec-version + base: gh-pages + delete-branch: true + path: deploy + labels: Housekeeping + reviewers: webron,darrelmiller + title: Update ReSpec versions + commit-message: Update ReSpec versions + signoff: true + body: | + This pull request is automatically triggered by GitHub action `respec`. + + The versions/v*.md files have changed, so the HTML files are automatically being regenerated. + + From 3e89efab599a4c39a82b849cd99fce12b7d33f1c Mon Sep 17 00:00:00 2001 From: Mike Ralphson Date: Mon, 17 May 2021 13:25:25 +0100 Subject: [PATCH 34/34] build: create a `latest.html` ReSpec version Signed-off-by: Mike Ralphson --- scripts/md2html/build.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/md2html/build.sh b/scripts/md2html/build.sh index e0a3256f86..3ddf387c2e 100755 --- a/scripts/md2html/build.sh +++ b/scripts/md2html/build.sh @@ -8,12 +8,20 @@ mkdir -p deploy/js cd scripts/md2html mkdir -p history git show c740e950d:MAINTAINERS.md > history/MAINTAINERS_v2.0.md -cp -p js/* ../../deploy/js -cp -p markdown/* ../../deploy/ +cp -p js/* ../../deploy/js 2> /dev/null +cp -p markdown/* ../../deploy/ 2> /dev/null node md2html.js --respec --maintainers ./history/MAINTAINERS_v2.0.md ../../versions/2.0.md > ../../deploy/oas/v2.0.html +latest=`git describe --abbrev=0 --tags` for filename in ../../versions/[3456789].*.md ; do - node md2html.js --respec --maintainers ../../MAINTAINERS.md ${filename} > ../../deploy/oas/v$(basename "$filename" .md).html + version=$(basename "$filename" .md) + node md2html.js --respec --maintainers ../../MAINTAINERS.md ${filename} > ../../deploy/oas/v$version.html + if [ $version = $latest ]; then + if [[ ${version} != *"rc"* ]];then + # version is not a Release Candidate + cp -p ../../deploy/oas/v$version.html ../../deploy/oas/latest.html + fi + fi done