From 1072487a57d12c0629316bf69697916cc52926a5 Mon Sep 17 00:00:00 2001
From: David Goss Copyright © ${options.publishDate.getFullYear()} the Linux Foundation Copyright © ${options.publishDate.getFullYear()} the Linux Foundation Copyright © 3001 the Linux Foundation
+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](https://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. Default value is `false`.
+ 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. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision.
+
+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) | The schema defining the type used for the parameter.
+example | Any | Example of the parameter's potential value. 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` that 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 parameter's potential value. 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` that 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`, `object` | `query` | Space separated array or object values. This option replaces `collectionFormat` equal to `ssv` from OpenAPI 2.0.
+pipeDelimited | `array`, `object` | `query` | Pipe separated array or object 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`](#styleValues) | `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\|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).
+
+##### 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](https://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": "https://foo.bar/examples/user-example.json"
+ }
+ }
+ },
+ "application/xml": {
+ "schema": {
+ "$ref": "#/components/schemas/User"
+ },
+ "examples": {
+ "user" : {
+ "summary": "User example in XML",
+ "externalValue": "https://foo.bar/examples/user-example.xml"
+ }
+ }
+ },
+ "text/plain": {
+ "examples": {
+ "user" : {
+ "summary": "User example in Plain text",
+ "externalValue": "https://foo.bar/examples/user-example.txt"
+ }
+ }
+ },
+ "*/*": {
+ "examples": {
+ "user" : {
+ "summary": "User example in other format",
+ "externalValue": "https://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: 'https://foo.bar/examples/user-example.json'
+ 'application/xml':
+ schema:
+ $ref: '#/components/schemas/User'
+ examples:
+ user:
+ summary: User example in XML
+ externalValue: 'https://foo.bar/examples/user-example.xml'
+ 'text/plain':
+ examples:
+ user:
+ summary: User example in Plain text
+ externalValue: 'https://foo.bar/examples/user-example.txt'
+ '*/*':
+ examples:
+ user:
+ summary: User example in other format
+ externalValue: 'https://foo.bar/examples/user-example.whatever'
+```
+
+A body parameter that is an array of string values:
+```json
+{
+ "description": "user to add to the system",
+ "required": true,
+ "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) | The schema defining the content of the request, response, or parameter.
+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](#exampleObject) \| [Reference Object](#referenceObject)] | 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](#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
+
+```json
+{
+ "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.
+
+In contrast with the 3.0 specification, the `format` keyword has no effect on the content-encoding of the schema. JSON Schema offers a `contentEncoding` keyword, which may be used to specify the `Content-Encoding` for the schema. The `contentEncoding` keyword supports all encodings defined in [RFC4648](https://tools.ietf.org/html/rfc4648), including "base64" and "base64url", as well as "quoted-printable" from [RFC2045](https://tools.ietf.org/html/rfc2045#section-6.7). The encoding specified by the `contentEncoding` keyword is independent of an encoding specified by the `Content-Type` header in the request or response or metadata of a multipart body -- when both are present, the encoding specified in the `contentEncoding` is applied first and then the encoding specified in the `Content-Type` header.
+
+JSON Schema also offers a `contentMediaType` keyword. However, when the media type is already specified by the Media Type Object's key, or by the `contentType` field of an [Encoding Object](#encodingObject), the `contentMediaType` keyword SHALL be ignored if present.
+
+Examples:
+
+Content transferred in binary (octet-stream) MAY omit `schema`:
+
+```yaml
+# a PNG image as a binary file:
+content:
+ image/png: {}
+```
+
+```yaml
+# an arbitrary binary file:
+content:
+ application/octet-stream: {}
+```
+
+Binary content transferred with base64 encoding:
+
+```yaml
+content:
+ image/png:
+ schema:
+ type: string
+ contentMediaType: image/png
+ contentEncoding: base64
+```
+
+Note that the `Content-Type` remains `image/png`, describing the semantics of the payload. The JSON Schema `type` and `contentEncoding` fields explain that the payload is transferred as text. The JSON Schema `contentMediaType` is technically redundant, but can be used by JSON Schema tools that may not be aware of the OpenAPI context.
+
+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: {}
+```
+
+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: {}
+ image/png: {}
+```
+
+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: {}
+```
+
+As seen in the section on `multipart/form-data` below, the empty schema for `items` indicates a media type of `application/octet-stream`.
+
+##### 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.
+
+In a `multipart/form-data` request body, each schema property, or each element of a schema array property, takes a section in the payload with an internal header as defined by [RFC7578](https://tools.ietf.org/html/rfc7578). The serialization strategy for each property of a `multipart/form-data` request body can be specified in an associated [`Encoding Object`](#encodingObject).
+
+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 a `contentEncoding`, the default Content-Type is `application/octet-stream`
+
+Per the JSON Schema specification, `contentMediaType` without `contentEncoding` present is treated as if `contentEncoding: identity` were present. While useful for embedding text documents such as `text/html` into JSON strings, it is not useful for a `multipart/form-data` part, as it just causes the document to be treated as `text/plain` instead of its actual media type. Use the Encoding Object without `contentMediaType` if no `contentEncoding` is required.
+
+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:
+ # Content-Type for application-level encoded resource is `text/plain`
+ type: string
+ contentMediaType: image/png
+ contentEncoding: base64
+ 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: object
+ $ref: '#/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 `object` - `application/json`; for `array` – the default is defined based on the inner type; for all other cases the default is `application/octet-stream`. 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` or `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](#encodingContentType) (implicit or explicit) SHALL be ignored.
+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` or `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](#encodingContentType) (implicit or explicit) SHALL be ignored.
+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` or `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](#encodingContentType) (implicit or explicit) SHALL be ignored.
+
+This object MAY be extended with [Specification Extensions](#specificationExtensions).
+
+##### Encoding Object Example
+
+```yaml
+requestBody:
+ content:
+ multipart/form-data:
+ 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: {}
+ 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 `Responses Object`.
+
+The `Responses Object` MUST contain at least one response code, and if only one
+response code is provided 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.
+
+##### 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. 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]`. Only the following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response 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 description of the response. [CommonMark syntax](https://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
+content:
+ text/plain:
+ schema:
+ type: string
+```
+
+Plain text response with headers:
+
+```json
+{
+ "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"
+ }
+ }
+ }
+}
+```
+
+```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 path item object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
+
+To describe incoming requests from the API provider independent from another API call, use the [`webhooks`](#oasWebhooks) field.
+
+##### Patterned Fields
+Field Pattern | Type | Description
+---|:---:|---
+{expression} | [Path Item Object](#pathItemObject) \| [Reference Object](#referenceObject) | A Path Item Object, or a reference to one, 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=https://clientdomain.com/stillrunning HTTP/1.1
+Host: example.org
+Content-Type: application/json
+Content-Length: 187
+
+{
+ "failedUrl" : "https://clientdomain.com/failed",
+ "successUrls" : [
+ "https://clientdomain.com/fast",
+ "https://clientdomain.com/medium",
+ "https://clientdomain.com/slow"
+ ]
+}
+
+201 Created
+Location: https://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 | https://example.org/subscribe/myevent?queryUrl=https://clientdomain.com/stillrunning
+$method | POST
+$request.path.eventType | myevent
+$request.query.queryUrl | https://clientdomain.com/stillrunning
+$request.header.content-Type | application/json
+$request.body#/failedUrl | https://clientdomain.com/failed
+$request.body#/successUrls/2 | https://clientdomain.com/medium
+$response.header.Location | https://example.org/subscription/1
+
+
+##### Callback Object Examples
+
+The following example uses the user provided `queryUrl` query string parameter to define the callback URL. This is an example of how to use a callback object to describe a WebHook callback that goes with the subscription operation to enable registering for the WebHook.
+
+```yaml
+myCallback:
+ '{$request.query.queryUrl}':
+ post:
+ requestBody:
+ description: Callback payload
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/SomePayload'
+ responses:
+ '200':
+ description: callback successfully processed
+```
+
+The following example shows a callback where the server is hard-coded, but the query string parameters are populated from the `id` and `email` property in the request body.
+
+```yaml
+transactionCallback:
+ '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: callback successfully processed
+```
+
+#### Example Object
+
+##### Fixed Fields
+Field Name | Type | Description
+---|:---:|---
+summary | `string` | Short description for the example.
+description | `string` | Long description for the example. [CommonMark syntax](https://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 URI 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. See the rules for resolving [Relative References](#relativeReferencesURI).
+
+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 Examples
+
+In a request body:
+
+```yaml
+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: 'https://example.org/examples/address-example.xml'
+ 'text/plain':
+ examples:
+ textExample:
+ summary: This is a text example
+ externalValue: 'https://foo.bar/examples/address-example.txt'
+```
+
+In a parameter:
+
+```yaml
+parameters:
+ - name: 'zipCode'
+ in: 'query'
+ schema:
+ type: 'string'
+ format: 'zip-code'
+ examples:
+ zip-example:
+ $ref: '#/components/examples/zip-example'
+```
+
+In a response:
+
+```yaml
+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 URI 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. See the rules for resolving [Relative References](#relativeReferencesURI).
+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](https://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 OpenAPI documents 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 `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
+field in an [Operation Object](#operationObject)), 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
+
+```abnf
+ 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" ["#" json-pointer ]
+ json-pointer = *( "/" reference-token )
+ reference-token = *( unescaped / escaped )
+ unescaped = %x00-2E / %x30-7D / %x7F-10FFFF
+ ; %x2F ('/') and %x7E ('~') are excluded from 'unescaped'
+ escaped = "~" ( "0" / "1" )
+ ; representing '~' and '/', respectively
+ name = *( CHAR )
+ token = 1*tchar
+ tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." /
+ "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA
+```
+
+Here, `json-pointer` is taken from [RFC6901](https://tools.ietf.org/html/rfc6901), `char` from [RFC7159](https://tools.ietf.org/html/rfc7159#section-7) and `token` from [RFC7230](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 description for the tag. [CommonMark syntax](https://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
+```
+
+
+#### Reference Object
+
+A simple object to allow referencing other components in the OpenAPI document, internally and externally.
+
+The `$ref` string value contains a URI [RFC3986](https://tools.ietf.org/html/rfc3986), which identifies the location of the value being referenced.
+
+See the rules for resolving [Relative References](#relativeReferencesURI).
+
+##### Fixed Fields
+Field Name | Type | Description
+---|:---:|---
+$ref | `string` | **REQUIRED**. The reference identifier. This MUST be in the form of a URI.
+summary | `string` | A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a `summary` field, then this field has no effect.
+description | `string` | A description which by default SHOULD override that of the referenced component. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. If the referenced object-type does not allow a `description` field, then this field has no effect.
+
+This object cannot be extended with additional properties and any properties added SHALL be ignored.
+
+Note that this restriction on additional properties is a difference between Reference Objects and [`Schema Objects`](#schemaObject) that contain a `$ref` keyword.
+
+##### 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 a superset of the [JSON Schema Specification Draft 2020-12](https://tools.ietf.org/html/draft-bhutton-json-schema-00).
+
+For more information about the properties, see [JSON Schema Core](https://tools.ietf.org/html/draft-bhutton-json-schema-00) and [JSON Schema Validation](https://tools.ietf.org/html/draft-bhutton-json-schema-validation-00).
+
+Unless stated otherwise, the property definitions follow those of JSON Schema and do not add any additional semantics.
+Where JSON Schema indicates that behavior is defined by the application (e.g. for annotations), OAS also defers the definition of semantics to the application consuming the OpenAPI document.
+
+##### Properties
+
+The OpenAPI Schema Object [dialect](https://tools.ietf.org/html/draft-bhutton-json-schema-00#section-4.3.3) is defined as requiring the [OAS base vocabulary](#baseVocabulary), in addition to the vocabularies as specified in the JSON Schema draft 2020-12 [general purpose meta-schema](https://tools.ietf.org/html/draft-bhutton-json-schema-00#section-8).
+
+The OpenAPI Schema Object dialect for this version of the specification is identified by the URI `https://spec.openapis.org/oas/3.1/dialect/base` (the "OAS dialect schema id").
+
+The following properties are taken from the JSON Schema specification but their definitions have been extended by the OAS:
+
+- description - [CommonMark syntax](https://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.
+
+In addition to the JSON Schema properties comprising the OAS dialect, the Schema Object supports keywords from any other vocabularies, or entirely arbitrary properties.
+
+The OpenAPI Specification's base vocabulary is comprised of the following keywords:
+
+##### Fixed Fields
+
+Field Name | Type | Description
+---|:---:|---
+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.
+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:** The `example` property has been deprecated in favor of the JSON Schema `examples` keyword. Use of `example` is discouraged, and later versions of this specification may remove it.
+
+This object MAY be extended with [Specification Extensions](#specificationExtensions), though as noted, additional properties MAY omit the `x-` prefix within this object.
+
+###### 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](#schemaXml) property allows extra definitions when translating the JSON definition to XML.
+The [XML Object](#xmlObject) contains additional information about the available options.
+
+###### Specifying Schema Dialects
+
+It is important for tooling to be able to determine which dialect or meta-schema any given resource wishes to be processed with: JSON Schema Core, JSON Schema Validation, OpenAPI Schema dialect, or some custom meta-schema.
+
+The `$schema` keyword MAY be present in any root Schema Object, and if present MUST be used to determine which dialect should be used when processing the schema. This allows use of Schema Objects which comply with other drafts of JSON Schema than the default Draft 2020-12 support. Tooling MUST support the OAS dialect schema id, and MAY support additional values of `$schema`.
+
+To allow use of a different default `$schema` value for all Schema Objects contained within an OAS document, a `jsonSchemaDialect` value may be set within the OpenAPI Object. If this default is not set, then the OAS dialect schema id MUST be used for these Schema Objects. The value of `$schema` within a Schema Object always overrides any default.
+
+When a Schema Object is referenced from an external resource which is not an OAS document (e.g. a bare JSON Schema resource), then the value of the `$schema` keyword for schemas within that resource MUST follow [JSON Schema rules](https://tools.ietf.org/html/draft-bhutton-json-schema-00#section-8.1.1).
+
+##### 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 document 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.
+
+This object MAY be extended with [Specification Extensions](#specificationExtensions).
+
+The discriminator object 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:
+
+```yaml
+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:
+
+
+```yaml
+MyResponseType:
+ oneOf:
+ - $ref: '#/components/schemas/Cat'
+ - $ref: '#/components/schemas/Dog'
+ - $ref: '#/components/schemas/Lizard'
+ discriminator:
+ propertyName: petType
+```
+
+The expectation now is that a property with name `petType` _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:
+
+```json
+{
+ "id": 12345,
+ "petType": "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:
+
+```yaml
+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: petType
+ 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:
+
+```yaml
+components:
+ schemas:
+ Pet:
+ type: object
+ required:
+ - petType
+ properties:
+ petType:
+ type: string
+ discriminator:
+ propertyName: petType
+ mapping:
+ dog: 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:
+
+```json
+{
+ "petType": "Cat",
+ "name": "misty"
+}
+```
+
+will indicate that the `Cat` schema be used. Likewise this schema:
+
+```json
+{
+ "petType": "dog",
+ "bark": "soft"
+}
+```
+
+will map to `Dog` because of the definition in the `mapping` 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. This 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, `
**Deprecated:** The `example` property has been deprecated in favor of the JSON Schema `examples` keyword. Use of `example` is discouraged, and later versions of this specification may remove it.
@@ -2345,13 +2346,8 @@ The OpenAPI Specification allows combining and extending model definitions using
`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.
+To support polymorphism, the OpenAPI Specification adds the `discriminator` keyword.
+When used, the `discriminator` will indicate the name of the property that decides which schema definition validates the structure of the model.
###### XML Modeling
From bde8f9723f595f6b2836e5650aef6f004394325e Mon Sep 17 00:00:00 2001
From: Jason Desrosiers
**Deprecated:** Usage of the `$ref` property has been deprecated when accompanied with properties other than `summary` and `description`.
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](https://spec.commonmark.org/) MAY be used for rich text representation.
get | [Operation Object](#operationObject) | A definition of a GET operation on this path.
From 733c879b3a760be5d8980d065fef284bf4aa0a92 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=81xel=20Costas=20Pena?=
+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](https://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. Default value is `false`.
+ 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. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision.
+
+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 parameter's potential value. 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` that 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 parameter's potential value. 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` that 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\|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).
+
+##### 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](https://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 content of the request, response, or parameter.
+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](#exampleObject) \| [Reference Object](#referenceObject)] | 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](#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
+
+```json
+{
+ "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:
+ 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]`. Only the following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response 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](https://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
+content:
+ text/plain:
+ schema:
+ type: string
+```
+
+Plain text response with headers:
+
+```json
+{
+ "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"
+ }
+ }
+ }
+}
+```
+
+```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 path item 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/failed
+$request.body#/successUrls/2 | http://clientdomain.com/medium
+$response.header.Location | http://example.org/subscription/1
+
+
+##### Callback Object Examples
+
+The following example uses the user provided `queryUrl` query string parameter to define the callback URL. This is an example of how to use a callback object to describe a WebHook callback that goes with the subscription operation to enable registering for the WebHook.
+
+```yaml
+myCallback:
+ '{$request.query.queryUrl}':
+ post:
+ requestBody:
+ description: Callback payload
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/SomePayload'
+ responses:
+ '200':
+ description: callback successfully processed
+```
+
+The following example shows a callback where the server is hard-coded, but the query string parameters are populated from the `id` and `email` property in the request body.
+
+```yaml
+transactionCallback:
+ '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: callback successfully processed
+```
+
+#### Example Object
+
+##### Fixed Fields
+Field Name | Type | Description
+---|:---:|---
+summary | `string` | Short description for the example.
+description | `string` | Long description for the example. [CommonMark syntax](https://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 Examples
+
+In a request body:
+
+```yaml
+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:
+
+```yaml
+parameters:
+ - name: 'zipCode'
+ in: 'query'
+ schema:
+ type: 'string'
+ format: 'zip-code'
+ examples:
+ zip-example:
+ $ref: '#/components/examples/zip-example'
+```
+
+In a response:
+
+```yaml
+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 URI 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](https://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 `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
+field in an [Operation Object](#operationObject)), 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
+
+```abnf
+ 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" ["#" json-pointer ]
+ json-pointer = *( "/" reference-token )
+ reference-token = *( unescaped / escaped )
+ unescaped = %x00-2E / %x30-7D / %x7F-10FFFF
+ ; %x2F ('/') and %x7E ('~') are excluded from 'unescaped'
+ escaped = "~" ( "0" / "1" )
+ ; representing '~' and '/', respectively
+ name = *( CHAR )
+ token = 1*tchar
+ tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." /
+ "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA
+```
+
+Here, `json-pointer` is taken from [RFC 6901](https://tools.ietf.org/html/rfc6901), `char` from [RFC 7159](https://tools.ietf.org/html/rfc7159#section-7) and `token` from [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](https://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
+```
+
+
+#### 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](https://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 Edition 5.1 regular expression](https://www.ecma-international.org/ecma-262/5.1/#sec-15.10.1) 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. Consistent with JSON Schema, `additionalProperties` defaults to `true`.
+- description - [CommonMark syntax](https://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` | A `true` value adds `"null"` to the allowed type specified by the `type` keyword, only if `type` is explicitly defined within the same Schema Object. Other Schema Object constraints retain their defined behavior, and therefore may disallow the use of `null` as a value. A `false` value leaves the specified or default `type` unmodified. The 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 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 object 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:
+
+```yaml
+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:
+
+
+```yaml
+MyResponseType:
+ oneOf:
+ - $ref: '#/components/schemas/Cat'
+ - $ref: '#/components/schemas/Dog'
+ - $ref: '#/components/schemas/Lizard'
+ discriminator:
+ propertyName: petType
+```
+
+The expectation now is that a property with name `petType` _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:
+
+```json
+{
+ "id": 12345,
+ "petType": "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:
+
+```yaml
+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: petType
+ 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:
+
+```yaml
+components:
+ schemas:
+ Pet:
+ type: object
+ required:
+ - petType
+ properties:
+ petType:
+ type: string
+ discriminator:
+ propertyName: petType
+ mapping:
+ dog: 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:
+
+```json
+{
+ "petType": "Cat",
+ "name": "misty"
+}
+```
+
+will indicate that the `Cat` schema be used. Likewise this schema:
+
+```json
+{
+ "petType": "dog",
+ "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 via Eclipse MarketPlace https://marketplace.eclipse.org/content/openapi-studio-rich-oas3-editor | Java | A user-friendly, visually rich studio supporting all features defined by the OpenAPI 3. Easy but powerful UI-based components creation, API testing, import, export, code generation and much more. |
-
-#### User Interfaces
-
-| Title | Project Link | Language | Description |
-|-------|--------------|----------|-------------|
-| openapi-viewer | [github/koumoul/openapi-viewer](https://github.com/koumoul-dev/openapi-viewer) | Vue.js | Browse and test a REST API described with the OpenAPI 3.0 Specification. |
-| swagger-ui | [github/swagger-api](https://github.com/swagger-api/swagger-UI) | JavaScript | Web-Based interface for visualizing and testing OpenAPI\Swagger definitions |
-| lincoln | [github/temando/open-api-renderer](https://github.com/temando/open-api-renderer)| React.js| A React renderer for OpenAPI v3 |
-| WebSphere Liberty | [Download jar](https://developer.ibm.com/wasdev/downloads/) | JavaScript | Includes a native OpenAPI v3 UI which allows for customization of its banners and URL |
-| Widdershins | [github/Mermade/widdershins](https://github.com/Mermade/widdershins) | Node.js | Generate Slate/Shins markdown from OpenAPI 3.0.x |
-| angular-swagger-ui | [github/angular-swagger-ui](https://github.com/Orange-OpenSource/angular-swagger-ui) | AngularJS | An angularJS implementation of Swagger UI |
-| Redoc | [github/Redocly/redoc](https://github.com/Redocly/redoc) | JavaScript | A React-based renderer with deep support for OAS v2 and v3 and zero dev-dependency |
-| RapiDoc | [github/mrin9/RapiDoc](https://github.com/mrin9/RapiDoc) | JavaScript | A highly customizable Web Component for viewing Swagger and OpenAPI definitions |
-| Bump.sh | [github/bump-sh/CLI](https://github.com/bump-sh/cli) | NodeJS | Generate documentations from OpenAPI contracts, visualize changelogs and get notified of breaking changes |
-
-#### Mock Servers
+You may find a more comprehensive list at https://tools.openapis.org
-| Title | Project Link | Language | Description |
-|-------|--------------|----------|-------------|
-| API Sprout | [github/danielgtaylor/apisprout](https://github.com/danielgtaylor/apisprout) | Go | Lightweight, blazing fast, cross-platform OpenAPI 3 mock server with validation |
+Instructions on listing your projects are contained in https://github.com/OAI/Tooling#how-can-you-help
-#### Testing tools
-| Title | Project Link | Language | Description |
-| ------|--------------|----------|-------------|
-| Schemathesis | [github/schemathesis/schemathesis](https://github.com/schemathesis/schemathesis) | Python | A modern API testing tool for web applications built with OpenAPI and GraphQL specifications |
-| Tcases for OpenAPI | [github/Cornutum/tcases](https://github.com/Cornutum/tcases/blob/master/tcases-openapi/README.md#tcases-for-openapi-from-rest-ful-to-test-ful) | Java | Generates test cases directly from an OpenAPI 3.0.X definition. Creates tests executable using various test frameworks. Bonus: Semantic linter reports elements that are inconsistent, superfluous, or dubious. |
-
-#### Server Implementations
-
-| Title | Project Link | Language | Description |
-|-------|--------------|----------|-------------|
-| Vert.x Web API Contract | [github/vert-x3/vertx-web](http://vertx.io/docs/#web) | Java, Kotlin, JavaScript, Groovy, Ruby, Ceylon & Scala | Create an API endpoint with Vert.x 3 and OpenAPI 3 with automatic requests validation
-| Fusio | [github/apioo/fusio](https://github.com/apioo/fusio) | PHP, JavaScript | Build API endpoints based on OpenAPI 3
-| Modern | [github/modern-project/modern-ruby](https://github.com/modern-project/modern-ruby) | Ruby | OpenAPI 3-based Rack framework with automatic OAS generation and requests/response validation
-| Exegesis | [github/exegesis-js/exegesis](https://github.com/exegesis-js/exegesis) | Node.js | OpenAPI 3 server-side framework for express and other frameworks.
-| PHP-CRUD-API | [github/mevdschee/php-crud-api](https://github.com/mevdschee/php-crud-api) | PHP | Automatic CRUD API with OpenAPI 3 docs
-| FastAPI | [github/tiangolo/fastapi](https://github.com/tiangolo/fastapi) | Python | OpenAPI 3 based, high performance, Python 3.6+ API framework with automatic data validation, serialization and great editor support.
-| Fastify OpenAPI v3 | [gitlab.com/m03geek/fastify-oas](https://gitlab.com/m03geek/fastify-oas) | Node.JS | Fastify OpenAPI v3+ plugin. Generates OpenAPI specification from fastify schemas and routes. Also serves swagger ui and spec in json/yaml formats.
-| openapi-backend | [github/anttiviljami/openapi-backend](https://github.com/anttiviljami/openapi-backend) | Node.js, TypeScript | Build, Validate, Route, and Mock in the backend using OpenAPI v3 spec in your favourite framework
-| Connexion | [github/zalando/connexion](https://github.com/zalando/connexion) | Python | Swagger/OpenAPI First framework for Python on top of Flask with automatic endpoint validation & OAuth2 support
-| JSONSchema::Validator | [https://github.com/skbkontur/perl-jsonschema-validator](https://github.com/skbkontur/perl-jsonschema-validator) | Perl | OpenAPI 3 request/response validation
-| rest | [github.com/swaggest/rest](https://github.com/swaggest/rest) | Go | API server with automatic request/response mapping/validation and OpenAPI schema
-| whook | [nfroidure/whook](https://github.com/nfroidure/whook) | Typescript | OpenAPI 3 based NodeJS server. |
-
-#### Client Implementations
-
-| Title | Project Link | Language | Description |
-|-------|--------------|----------|-------------|
-| Scorpio | [github/notEthan/scorpio](https://github.com/notEthan/Scorpio) | Ruby | OpenAPI 2 and 3 implementation offering a HTTP client library |
-| openapi-client-axios | [github/anttiviljami/openapi-client-axios](https://github.com/anttiviljami/openapi-client-axios) | JavaScript, TypeScript | JavaScript client library for consuming OpenAPI-enabled APIs with axios. Types included.
-| restful-react | [github/contiamo/restful-react](https://github.com/contiamo/restful-react) | Typescript | Well tested library to generate typesafe hooks and components. Easy to integrate into your development process. |
-| openapi-ts-sdk-builder | [nfroidure/openapi-ts-sdk-builder](https://github.com/nfroidure/openapi-ts-sdk-builder) | Typescript | Generate a TypeScript SDK from OpenAPI 3 definitions. |
-| aiopenapi3 | [github.com/commonism/aiopenapi3](https://github.com/commonism/aiopenapi3) | Python | OpenAPI 3, Python3.7+ client & validator with automatic data validation & serialization, sync or asyncio.
-
-#### Code Generators
-
-| Title | Project Link | Language | Description |
-|-------|--------------|----------|-------------|
-| baucis-openapi3 | [github/metadevpro/baucis-openapi3](https://github.com/metadevpro/baucis-openapi3) | Node.js | [Baucis.js](https://github.com/wprl/baucis) plugin for generating OpenAPI 3.0 compliant API contracts. |
-| Google Gnostic | [github/googleapis/gnostic](https://github.com/googleapis/gnostic) | Go | Compile OpenAPI descriptions into equivalent Protocol Buffer representations. |
-| Gen | [github/wzshiming/gen](https://github.com/wzshiming/gen) | Go | Generate OpenAPI 3, client, and route based on golang source code. |
-| serverless-openapi-documentation | [github/temando/serverless-openapi-documentation](https://github.com/temando/serverless-openapi-documentation) | TypeScript | Serverless 1.0 plugin to generate OpenAPI V3 documentation from serverless configuration |
-| zero-rails_openapi | [github/zhandao/zero-rails_openapi](https://github.com/zhandao/zero-rails_openapi) | Ruby | Provide concise DSL for generating the OpenAPI Specification 3 documentation file for Rails application |
-| slush-vertx | [github/pmlopes/slush-vertx](https://github.com/pmlopes/slush-vertx) | Java, Kotlin & Groovy | Generate server skeleton for [Vert.x Web API Contract](http://vertx.io/docs/#web) and API Client based on [Vert.x 3 Web Client](http://vertx.io/docs/#web)
-| WebSphere Liberty | [Download jar](https://developer.ibm.com/wasdev/downloads/) | Java EE | Generates OpenAPI v3 documentation from Java EE applications |
-| swagger-node-codegen | [github/fmvilas/swagger-node-codegen](https://github.com/fmvilas/swagger-node-codegen) | Node.js | Generates a Node.js/express server, but also has a template engine for creating any templates needed. |
-.NET-C#-Annotations | [github/Microsoft/OpenAPI-NET-CSharpAnnotations](https://github.com/Microsoft/OpenAPI.NET.CSharpAnnotations) | dotnet | Convert your native C# comments/annotation XML from your API code into a OpenAPI document object. |
-| Object Oriented OpenAPI Specification | [github/goldspecdigital/oooas](https://github.com/goldspecdigital/oooas) | PHP | Generates OpenAPI documents using PHP. |
-| swac | [github.com/swaggest/swac](https://github.com/swaggest/swac) | PHP, Go | Generates clients for Go and PHP from OpenAPI 2/3. |
+These tools are not endorsed by the OAI.
From 1b1b20bb2c1f354692dabf3e534bd7e4c1bb6a11 Mon Sep 17 00:00:00 2001
From: Ralf Handl ${title.split('|')[0]}
`;
- preface += `${abstract}
`;
preface += 'The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP 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 += '${title.split('|')[0]}
`;
+ preface += `${abstract}
`;
preface += 'The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP 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 += 'Status of This Document
';
preface += 'The source-of-truth for the specification is the GitHub markdown file referenced above.';
preface += '${title.split('|')[0]}
`;
preface += `${abstract}
`;
+ preface += `${abstract}
`;
preface += 'The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP 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 += 'Status of This Document
';
preface += 'The source-of-truth for the specification is the GitHub markdown file referenced above.';
preface += '${title.split('|')[0]}
`;
From a12a1ee152d96f340845cb7969c3025549d9909e Mon Sep 17 00:00:00 2001
From: Ralf Handl ${title.split('|')[0]}
`;
@@ -284,31 +358,14 @@ for (let l in lines) {
line = line.replace('[JSON Pointer]','JSON Pointer [RFC6901]'); // only in 2.0.md
line = line.replace('[media type range](https://tools.ietf.org/html/rfc7231#appendix-D) ','media type range, see [RFC7231](https://tools.ietf.org/html/rfc7231#appendix-D), ');
- if (line.indexOf('[RFC')>=0) {
- // also detect [RFC4648 §3.2] etc. in 3.0.4.md and 3.1.1.md
- //TODO: TDC decision: fix in source markdown
- line = line.replace(/\[RFC ?([0-9]{1,5})( §[0-9 .-]+)?\]/g,function(match,group1){
- //TODO: use string pattern with $1 instead of function
- return '[[RFC'+group1+']]';
- });
- }
-
- //TODO: TDC decision: fix unconventional references to RFCs in 3.0.4 and 3.1.1, for example
- // [RFC3986 §5.1.2 – 5.1.4](https://tools.ietf.org/html/rfc3986#section-5.1.2)
- // RFC6570 [mentions](https://www.rfc-editor.org/rfc/rfc6570.html#section-2.4.2)
- // [are not](https://datatracker.ietf.org/doc/html/rfc3986#appendix-A)
- // [special behavior](https://www.rfc-editor.org/rfc/rfc1866#section-8.2.1)
- // [RFC6570 considers to be _undefined_](https://datatracker.ietf.org/doc/html/rfc6570#section-2.3)
-
- //TODO: TDC decision: fix non-link mentions of RFCs etc. in 3.0.4 and 3.1.1, for example
- // RFC3986's definition of [reserved](https://datatracker.ietf.org/doc/html/rfc3986#section-2.2)
+ line = line.replace(/\[RFC ?([0-9]{1,5})\]\(/g,'[[RFC$1]](');
// harmonize RFC URLs
//TODO: harmonize to https://www.rfc-editor.org/rfc/rfc*
line = line.replaceAll('](http://','](https://');
line = line.replace('https://www.ietf.org/rfc/rfc2119.txt','https://tools.ietf.org/html/rfc2119'); // only in 2.0.md
line = line.replace(/https:\/\/www.rfc-editor.org\/rfc\/rfc([0-9]{1,5})(\.html)?/g,'https://tools.ietf.org/html/rfc$1');
- line = line.replaceAll('https://datatracker.ietf.org/doc/html/rfc','https://tools.ietf.org/html/rfc');
+ line = line.replaceAll('https://datatracker.ietf.org/doc/html/','https://tools.ietf.org/html/');
// handle url fragments in RFC links and construct section links as well as RFC links
line = line.replace(/\]\]\(https:\/\/tools.ietf.org\/html\/rfc([0-9]{1,5})\/?(\#[^)]*)?\)/g, function(match, rfcNumber, fragment) {
@@ -328,9 +385,23 @@ for (let l in lines) {
line = line.replace('[CommonMark 0.27](https://spec.commonmark.org/0.27/)','[[CommonMark-0.27]]');
line = line.replace('[CommonMark syntax](https://spec.commonmark.org/)','[[CommonMark]] syntax');
line = line.replace('CommonMark markdown formatting','[[CommonMark]] markdown formatting');
- line = line.replace('consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4)','consult [[html401]] [Section 17.13.4](http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4)');
- //TODO
- line = line.replace(/YAML version \[1\.2\]\(https:\/\/(www\.)?yaml\.org\/spec\/1\.2\/spec\.html\)/,'[[YAML]] version 1.2');
+ line = line.replace('consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4)','consult [[HTML401]] [Section 17.13.4](http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4)');
+ line = line.replace('[IANA Status Code Registry](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml)','[[IANA-HTTP-STATUS-CODES|IANA Status Code Registry]]');
+ line = line.replace('[IANA Authentication Scheme registry](https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml)','[[IANA-HTTP-AUTHSCHEMES]]');
+ line = line.replace('[JSON Schema Specification Draft 4](https://json-schema.org/)','[[JSON-Schema-04|JSON Schema Specification Draft 4]]');
+ line = line.replace('[JSON Schema Core](https://tools.ietf.org/html/draft-zyp-json-schema-04)','[[JSON-Schema-04|JSON Schema Core]]');
+ line = line.replace('[JSON Schema Validation](https://tools.ietf.org/html/draft-fge-json-schema-validation-00)','[[JSON-Schema-Validation-04|JSON Schema Validation]]');
+ line = line.replace('[JSON Schema Specification Wright Draft 00](https://json-schema.org/)','[[JSON-Schema-05|JSON Schema Specification Wright Draft 00]]');
+ line = line.replace('[JSON Schema Core](https://tools.ietf.org/html/draft-wright-json-schema-00)','[[JSON-Schema-05|JSON Schema Core]]');
+ line = line.replace('[JSON Schema Validation](https://tools.ietf.org/html/draft-wright-json-schema-validation-00)','[[JSON-Schema-Validation-05|JSON Schema Validation]]');
+ line = line.replace('[JSON Schema Specification Draft 2020-12](https://tools.ietf.org/html/draft-bhutton-json-schema-00)','[[JSON-Schema-2020-12|JSON Schema Specification Draft 2020-12]]');
+ line = line.replace('[JSON Schema Core](https://tools.ietf.org/html/draft-bhutton-json-schema-00)','[[JSON-Schema-2020-12|JSON Schema Core]]');
+ line = line.replace('[JSON Schema Validation](https://tools.ietf.org/html/draft-bhutton-json-schema-validation-00)','[[JSON-Schema-Validation-2020-12|JSON Schema Validation]]');
+ line = line.replace('[SPDX](https://spdx.org/licenses/)','[[SPDX]]');
+ line = line.replace('[XML namespaces](https://www.w3.org/TR/xml-names11/)','[[xml-names11|XML namespaces]]');
+ line = line.replace('JSON standards. YAML,','[[RFC7159|JSON]] standards. [[YAML|YAML]],'); // 2.0.md only
+ line = line.replace('JSON or YAML format.','[[RFC7159|JSON]] or [[YAML|YAML]] format.');
+ line = line.replace(/YAML version \[1\.2\]\(https:\/\/(www\.)?yaml\.org\/spec\/1\.2\/spec\.html\)/,'[[YAML|YAML version 1.2]]');
}
if (!inCodeBlock && line.indexOf('](../') >= 0) {
@@ -378,8 +449,6 @@ for (let l in lines) {
s = preface(`OpenAPI Specification v${argv.subtitle} | Introduction, Definitions, & More`,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+']';
-});
+out = out.replace(/\[([RGB])\]/g,'[$1]');
+out = out.replace('[[IANA-HTTP-AUTHSCHEMES]]','[[IANA-HTTP-AUTHSCHEMES|IANA Authentication Scheme registry]]');
console.log(out);
From 7d7f69d783c8b9f460c46864c90da5977f90caa4 Mon Sep 17 00:00:00 2001
From: Ralf Handl form‑urlencoded
-[RFC1866 §8.2.1 form‑urlencoded](https://datatracker.ietf.org/doc/html/rfc1866#section-8.2.1) | 11/1995 | content-based serialization | RFC1738 | obsoleted by [HTML 4.01 §17.13.4.1](https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1), [WHATWG URL §5](https://url.spec.whatwg.org/#urlencoded-serializing)
+[[RFC3986]] | 01/2005 | URI/URL syntax | [[RFC3986]] | obsoletes [[RFC1738]], [[RFC2396]]
+[[RFC6570]] | 03/2012 | style-based serialization | [[RFC3986]] | does not use `+` for form‑urlencoded
+[RFC1866](https://datatracker.ietf.org/doc/html/rfc1866#section-8.2.1) | 11/1995 | content-based serialization | [[RFC1738]] | obsoleted by [[HTML401]] [Section 17.13.4.1](https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1), [[URL]] [Section 5](https://url.spec.whatwg.org/#urlencoded-serializing)
Style-based serialization is used in the [Parameter Object](#parameterObject) when `schema` is present, and in the [Encoding Object](#encodingObject) when at least one of `style`, `explode`, or `allowReserved` is present.
See [Appendix C](#usingRFC6570Implementations) for more details of RFC6570's two different approaches to percent-encoding, including an example involving `+`.
From 50cbb049aa7677122450eafbd1b7b641500552e9 Mon Sep 17 00:00:00 2001
From: Ralf Handl
-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](https://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. Default value is `false`.
- allowEmptyValue | `boolean` | If `true`, clients MAY pass a zero-length string value in place of parameters that would otherwise be omitted entirely, which the server SHOULD interpret as the parameter being unused. Default value is `false`. If [`style`](#parameterStyle) is used, and if [behavior is _n/a_ (cannot be serialized)](#style-examples), the value of `allowEmptyValue` SHALL be ignored. Interactions between this field and the parameter's [Schema Object](#schemaObject) are implementation-defined. This field is valid only for `query` parameters. Use of this property is NOT RECOMMENDED, and it is likely to be removed in a later revision.
+| Field Name | Type | Description |
+| ------------------------------------------------------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| name | `string` | **REQUIRED**. The name of the parameter. Parameter names are _case sensitive_.
|
+| 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](https://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. Default value is `false`. |
+| allowEmptyValue | `boolean` | If `true`, clients MAY pass a zero-length string value in place of parameters that would otherwise be omitted entirely, which the server SHOULD interpret as the parameter being unused. Default value is `false`. If [`style`](#parameterStyle) is used, and if [behavior is _n/a_ (cannot be serialized)](#style-examples), the value of `allowEmptyValue` SHALL be ignored. Interactions between this field and the parameter's [Schema Object](#schemaObject) are implementation-defined. This field is valid only for `query` parameters. Use of this property is NOT RECOMMENDED, and it is likely to be removed in a later revision. |
This object MAY be extended with [Specification Extensions](#specificationExtensions).
@@ -1139,14 +1135,14 @@ The `example` and `examples` fields are mutually exclusive, and if either is pre
Serializing with `schema` is NOT RECOMMENDED for `in: cookie` parameters, `in: header` parameters that use HTTP header parameters (name=value pairs following a `;`) in their values, or `in: header` parameters where values might have non-URL-safe characters; see [Appendix D](#serializingHeadersAndCookies) for details.
-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`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject` is undefined.
-allowReserved | `boolean` | When this is true, parameter values are serialized using reserved expansion, as defined by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.3), which allows [RFC3986's reserved character set](https://datatracker.ietf.org/doc/html/rfc3986#section-2.2), as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#section-3.4) (`[`, `]`, `#`), or have a special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see Appendices [C](#usingRFC6570Implementations) and [E](#percentEncodingAndFormMediaTypes) for details. 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 parameter's potential value; see [Working With Examples](#working-with-examples).
-examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the parameter's potential value; see [Working With Examples](#working-with-examples).
+| 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`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject` is undefined. |
+| allowReserved | `boolean` | When this is true, parameter values are serialized using reserved expansion, as defined by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.3), which allows [RFC3986's reserved character set](https://datatracker.ietf.org/doc/html/rfc3986#section-2.2), as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#section-3.4) (`[`, `]`, `#`), or have a special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see Appendices [C](#usingRFC6570Implementations) and [E](#percentEncodingAndFormMediaTypes) for details. 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 parameter's potential value; see [Working With Examples](#working-with-examples). |
+| examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the parameter's potential value; see [Working With Examples](#working-with-examples). |
See also [Appendix C: Using RFC6570 Implementations](#usingRFC6570Implementations) for additional guidance.
@@ -1155,23 +1151,23 @@ See also [Appendix C: Using RFC6570 Implementations](#usingRFC6570Implementation
For more complex scenarios, the [`content`](#parameterContent) property can define the media type and schema of the parameter, as well as give examples of its use.
Using `content` with a `text/plain` media type is RECOMMENDED for `in: header` and `in: cookie` parameters where the `schema` strategy is not appropriate.
-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.
+| 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)
-simple | `primitive`, `array`, `object` | `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.
-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.
-spaceDelimited | `array`, `object` | `query` | Space separated array values or object properties and values. This option replaces `collectionFormat` equal to `ssv` from OpenAPI 2.0.
-pipeDelimited | `array`, `object` | `query` | Pipe separated array values or object properties and values. This option replaces `collectionFormat` equal to `pipes` from OpenAPI 2.0.
-deepObject | `object` | `query` | Allows objects with scalar properties to be represented using form parameters. The representation of array or object properties is not 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) |
+| simple | `primitive`, `array`, `object` | `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. |
+| 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. |
+| spaceDelimited | `array`, `object` | `query` | Space separated array values or object properties and values. This option replaces `collectionFormat` equal to `ssv` from OpenAPI 2.0. |
+| pipeDelimited | `array`, `object` | `query` | Pipe separated array values or object properties and values. This option replaces `collectionFormat` equal to `pipes` from OpenAPI 2.0. |
+| deepObject | `object` | `query` | Allows objects with scalar properties to be represented using form parameters. The representation of array or object properties is not defined. |
See [Appendix E](#percentEncodingAndFormMediaTypes) for a discussion of percent-encoding, including when delimiters need to be percent-encoded and options for handling collisions with percent-encoded data.
@@ -1187,29 +1183,29 @@ Assume a parameter named `color` has one of the following values:
The following table shows examples, as would be shown with the `example` or `examples` keywords, of the different serializations for each value.
-* The value _empty_ denotes the empty string, and is unrelated to the `allowEmptyValue` field
-* The behavior of combinations marked _n/a_ is undefined
-* The `undefined` replaces the `empty` column in previous versions of this specification in order to better align with [RFC6570](https://www.rfc-editor.org/rfc/rfc6570.html#section-2.3) terminology, which describes certain values including but not limited to `null` as "undefined" values with special handling; notably, the empty string is _not_ undefined
-* For `form` and the non-RFC6570 query string styles `spaceDelimited`, `pipeDelimited`, and `deepObject`, each example is shown prefixed with `?` as if it were the only query parameter; see [Appendix C](#usingRFC6570Implementations) for more information on constructing query strings from multiple parameters, and [Appendix D](#serializingHeadersAndCookies) for warnings regarding `form` and cookie parameters
-* Note that the `?` prefix is not appropriate for serializing `application/x-www-form-urlencoded` HTTP message bodies, and MUST be stripped or (if constructing the string manually) not added when used in that context; see the [Encoding Object](#encodingObject) for more information
-* The examples are percent-encoded as required by RFC6570 and RFC3986; see [Appendix E](#percentEncodingAndFormMediaTypes) for a thorough discussion of percent-encoding concerns, including why unencoded `|` (`%7C`), `[` (`%5B`), and `]` (`%5D`) seem to work in some environments despite not being compliant.
-
-[`style`](#styleValues) | `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
-simple | false | _empty_ | blue | blue,black,brown | R,100,G,200,B,150
-simple | true | _empty_ | 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
-spaceDelimited | false | _n/a_ | _n/a_ | ?color=blue%20black%20brown | ?color=R%20100%20G%20200%20B%20150
-spaceDelimited | true | _n/a_ | _n/a_ | _n/a_ | _n/a_
-pipeDelimited | false | _n/a_ | _n/a_ | ?color=blue%7Cblack%7Cbrown | ?color=R%7C100%7CG%7C200%7CB%7C150
-pipeDelimited | true | _n/a_ | _n/a_ | _n/a_ | _n/a_
-deepObject | false | _n/a_ | _n/a_ | _n/a_ | _n/a_
-deepObject | true | _n/a_ | _n/a_ | _n/a_ | ?color%5BR%5D=100&color%5BG%5D=200&color%5BB%5D=150
+- The value _empty_ denotes the empty string, and is unrelated to the `allowEmptyValue` field
+- The behavior of combinations marked _n/a_ is undefined
+- The `undefined` replaces the `empty` column in previous versions of this specification in order to better align with [RFC6570](https://www.rfc-editor.org/rfc/rfc6570.html#section-2.3) terminology, which describes certain values including but not limited to `null` as "undefined" values with special handling; notably, the empty string is _not_ undefined
+- For `form` and the non-RFC6570 query string styles `spaceDelimited`, `pipeDelimited`, and `deepObject`, each example is shown prefixed with `?` as if it were the only query parameter; see [Appendix C](#usingRFC6570Implementations) for more information on constructing query strings from multiple parameters, and [Appendix D](#serializingHeadersAndCookies) for warnings regarding `form` and cookie parameters
+- Note that the `?` prefix is not appropriate for serializing `application/x-www-form-urlencoded` HTTP message bodies, and MUST be stripped or (if constructing the string manually) not added when used in that context; see the [Encoding Object](#encodingObject) for more information
+- The examples are percent-encoded as required by RFC6570 and RFC3986; see [Appendix E](#percentEncodingAndFormMediaTypes) for a thorough discussion of percent-encoding concerns, including why unencoded `|` (`%7C`), `[` (`%5B`), and `]` (`%5D`) seem to work in some environments despite not being compliant.
+
+| [`style`](#styleValues) | `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 |
+| simple | false | _empty_ | blue | blue,black,brown | R,100,G,200,B,150 |
+| simple | true | _empty_ | 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 |
+| spaceDelimited | false | _n/a_ | _n/a_ | ?color=blue%20black%20brown | ?color=R%20100%20G%20200%20B%20150 |
+| spaceDelimited | true | _n/a_ | _n/a_ | _n/a_ | _n/a_ |
+| pipeDelimited | false | _n/a_ | _n/a_ | ?color=blue%7Cblack%7Cbrown | ?color=R%7C100%7CG%7C200%7CB%7C150 |
+| pipeDelimited | true | _n/a_ | _n/a_ | _n/a_ | _n/a_ |
+| deepObject | false | _n/a_ | _n/a_ | _n/a_ | _n/a_ |
+| deepObject | true | _n/a_ | _n/a_ | _n/a_ | ?color%5BR%5D=100&color%5BG%5D=200&color%5BB%5D=150 |
##### Parameter Object Examples
@@ -1246,6 +1242,7 @@ style: simple
```
A path parameter of a string value:
+
```json
{
"name": "username",
@@ -1268,6 +1265,7 @@ schema:
```
An optional query parameter of a string value, allowing multiple values by repeating the query parameter:
+
```json
{
"name": "id",
@@ -1299,6 +1297,7 @@ explode: true
```
A free-form query parameter, allowing undefined parameters of a specific type:
+
```json
{
"in": "query",
@@ -1307,7 +1306,7 @@ A free-form query parameter, allowing undefined parameters of a specific type:
"type": "object",
"additionalProperties": {
"type": "integer"
- },
+ }
},
"style": "form"
}
@@ -1333,10 +1332,7 @@ A complex parameter using `content` to define serialization:
"application/json": {
"schema": {
"type": "object",
- "required": [
- "lat",
- "long"
- ],
+ "required": ["lat", "long"],
"properties": {
"lat": {
"type": "number"
@@ -1373,18 +1369,19 @@ content:
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](https://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`.
+| Field Name | Type | Description |
+| ------------------------------------------------ | :--------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](https://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 schema definition.
+
```json
{
"description": "user to add to the system",
@@ -1394,7 +1391,7 @@ A request body with a referenced schema definition.
"$ref": "#/components/schemas/User"
},
"examples": {
- "user" : {
+ "user": {
"summary": "User Example",
"externalValue": "https://foo.bar/examples/user-example.json"
}
@@ -1405,7 +1402,7 @@ A request body with a referenced schema definition.
"$ref": "#/components/schemas/User"
},
"examples": {
- "user" : {
+ "user": {
"summary": "User example in XML",
"externalValue": "https://foo.bar/examples/user-example.xml"
}
@@ -1413,7 +1410,7 @@ A request body with a referenced schema definition.
},
"text/plain": {
"examples": {
- "user" : {
+ "user": {
"summary": "User example in Plain text",
"externalValue": "https://foo.bar/examples/user-example.txt"
}
@@ -1421,7 +1418,7 @@ A request body with a referenced schema definition.
},
"*/*": {
"examples": {
- "user" : {
+ "user": {
"summary": "User example in other format",
"externalValue": "https://foo.bar/examples/user-example.whatever"
}
@@ -1461,6 +1458,7 @@ content:
```
#### Media Type Object
+
Each Media Type Object provides schema and examples for the media type identified by its key.
When `example` or `examples` are provided, the example SHOULD match the specified schema and be in the correct format as specified by the media type and its encoding.
@@ -1468,12 +1466,13 @@ The `example` and `examples` fields are mutually exclusive, and if either is pre
See [Working With Examples](#working-with-examples) for further guidance regarding the different ways of specifying examples, including non-JSON/YAML values.
##### Fixed Fields
-Field Name | Type | Description
----|:---:|---
-schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the content of the request, response, parameter, or header.
-example | Any | Example of the media type; see [Working With Examples](#working-with-examples).
-examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type; see [Working With Examples](#working-with-examples).
-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 attribute SHALL only apply to [Request Body Objects](#requestBodyObject), and only when the media type is `multipart` or `application/x-www-form-urlencoded`. If no Encoding Object is provided for a property, the behavior is determined by the default values documented for the Encoding Object.
+
+| Field Name | Type | Description |
+| ---------------------------------------- | :--------------------------------------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the content of the request, response, parameter, or header. |
+| example | Any | Example of the media type; see [Working With Examples](#working-with-examples). |
+| examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type; see [Working With Examples](#working-with-examples). |
+| 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 attribute SHALL only apply to [Request Body Objects](#requestBodyObject), and only when the media type is `multipart` or `application/x-www-form-urlencoded`. If no Encoding Object is provided for a property, the behavior is determined by the default values documented for the Encoding Object. |
This object MAY be extended with [Specification Extensions](#specificationExtensions).
@@ -1486,7 +1485,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
"$ref": "#/components/schemas/Pet"
},
"examples": {
- "cat" : {
+ "cat": {
"summary": "An example of a cat",
"value": {
"name": "Fluffy",
@@ -1498,7 +1497,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
},
"dog": {
"summary": "An example of a dog with a cat's name",
- "value" : {
+ "value": {
"name": "Puma",
"petType": "Dog",
"color": "Black",
@@ -1517,7 +1516,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
```yaml
application/json:
schema:
- $ref: "#/components/schemas/Pet"
+ $ref: '#/components/schemas/Pet'
examples:
cat:
summary: An example of a cat
@@ -1536,7 +1535,7 @@ application/json:
gender: Female
breed: Mixed
frog:
- $ref: "#/components/examples/frog-example"
+ $ref: '#/components/examples/frog-example'
```
##### Considerations for File Uploads
@@ -1570,7 +1569,7 @@ 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
+ # a binary file of type png or jpeg
'image/jpeg':
schema:
type: string
@@ -1607,22 +1606,22 @@ See [Appendix E](#percentEncodingAndFormMediaTypes) for a detailed examination o
These fields MAY be used either with or without the RFC6570-style serialization fields defined in the next section below.
-Field Name | Type | Description
----|:---:|---
-contentType | `string` | The `Content-Type` for encoding a specific property. The value is a comma-separated list, each element of which is either a specific media type (e.g. `image/png`) or a wildcard media type (e.g. `image/*`). Default value depends on the property type as shown in the table below.
-headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | A map allowing additional information to be provided as headers. `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`.
+| Field Name | Type | Description |
+| --------------------------------------------- | :-----------------------------------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| contentType | `string` | The `Content-Type` for encoding a specific property. The value is a comma-separated list, each element of which is either a specific media type (e.g. `image/png`) or a wildcard media type (e.g. `image/*`). Default value depends on the property type as shown in the table below. |
+| headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | A map allowing additional information to be provided as headers. `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`. |
This object MAY be extended with [Specification Extensions](#specificationExtensions).
The default values for `contentType` are as follows, where an _n/a_ in the `format` column means that the presence or value of `format` is irrelevant:
-Property `type` | Property `format` | Default `contentType`
-------------- | --------------- | ---------------------
-`string` | `binary` _or_ `byte` | `application/octet-stream`
-`string` | _none, or any except `binary` or `byte`_ | `text/plain`
-`number`, `integer`, or `boolean` | _n/a_ | `text/plain`
-`object` | _n/a_ | `application/json`
-`array` | _n/a_ | according to the `type` and `format` of the `items` schema
+| Property `type` | Property `format` | Default `contentType` |
+| --------------------------------- | ---------------------------------------- | ---------------------------------------------------------- |
+| `string` | `binary` _or_ `byte` | `application/octet-stream` |
+| `string` | _none, or any except `binary` or `byte`_ | `text/plain` |
+| `number`, `integer`, or `boolean` | _n/a_ | `text/plain` |
+| `object` | _n/a_ | `application/json` |
+| `array` | _n/a_ | according to the `type` and `format` of the `items` schema |
Determining how to handle `null` values if `nullable: true` is present depends on how `null` values are being serialized.
If `null` values are entirely omitted, then the `contentType` is irrelevant.
@@ -1630,24 +1629,24 @@ See [Appendix B](#dataTypeConversion) for a discussion of data type conversion o
###### Fixed Fields for RFC6570-style Serialization
-Field Name | Type | Description
----|:---:|---
-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. Note that the initial `?` used in query strings is not used in `application/x-www-form-urlencoded` message bodies, and MUST be removed (if using an RFC6570 implementation) or simply not added (if constructing the string manually). 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`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject` is undefined. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`.
-allowReserved | `boolean` | When this is true, parameter values are serialized using reserved expansion, as defined by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.3), which allows [RFC3986's reserved character set](https://datatracker.ietf.org/doc/html/rfc3986#section-2.2), as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#section-3.4) (`[`, `]`, `#`), or have a special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see Appendices [C](#usingRFC6570Implementations) and [E](#percentEncodingAndFormMediaTypes) for details. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`.
+| Field Name | Type | Description |
+| ------------------------------------------------- | :-------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| 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. Note that the initial `?` used in query strings is not used in `application/x-www-form-urlencoded` message bodies, and MUST be removed (if using an RFC6570 implementation) or simply not added (if constructing the string manually). 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`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject` is undefined. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. |
+| allowReserved | `boolean` | When this is true, parameter values are serialized using reserved expansion, as defined by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.3), which allows [RFC3986's reserved character set](https://datatracker.ietf.org/doc/html/rfc3986#section-2.2), as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#section-3.4) (`[`, `]`, `#`), or have a special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see Appendices [C](#usingRFC6570Implementations) and [E](#percentEncodingAndFormMediaTypes) for details. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. |
See also [Appendix C: Using RFC6570 Implementations](#usingRFC6570Implementations) for additional guidance.
The role of `contentType` with `application/x-www-form-urlencoded` request bodies was not described in detail in version 3.0.3 and earlier of this specification.
To match the intent of these fields and be compatible with version 3.1 of this specification, it is RECOMMENDED that whenever any of `style`, `explode`, or `allowReserved` are present with an explicit value:
-* The value of `contentType`, whether it is explicitly defined or has the default value, is to be ignored
-* If any of `style`, `explode`, or `allowReserved` are _not_ present with explicit values, then they are to be treated as if they were present with their default values
+- The value of `contentType`, whether it is explicitly defined or has the default value, is to be ignored
+- If any of `style`, `explode`, or `allowReserved` are _not_ present with explicit values, then they are to be treated as if they were present with their default values
However, if all three of `style`, `explode`, and `allowReserved` fields are absent, it is RECOMMENDED that:
-* All three keywords are to be entirely ignored, rather than treated as having their default values
-* Encoding is to be based on `contentType` alone, whether it is present with an explicit value or absent and treated as having its default value
+- All three keywords are to be entirely ignored, rather than treated as having their default values
+- Encoding is to be based on `contentType` alone, whether it is present with an explicit value or absent and treated as having its default value
Note that the presence of at least one of `style`, `explode`, or `allowReserved` with an explicit value is equivalent to using `schema` with `in: query` Parameter Objects.
The absence of all three of those fields is the equivalent of using `content`, but with the media type specified in `contentType` rather than through a Media Type Object.
@@ -1741,7 +1740,7 @@ However, this is not guaranteed and the value would still need to be percent-dec
##### Encoding `multipart` Media Types
-It is common to use `multipart/form-data` as a `Content-Type` when transferring forms as request bodies. 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.
+It is common to use `multipart/form-data` as a `Content-Type` when transferring forms as request bodies. 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.
The `form-data` disposition and its `name` parameter are mandatory for `multipart/form-data` ([RFC7578](https://www.rfc-editor.org/rfc/rfc7578.html#section-4.2)).
Array properties are handled by applying the same `name` to multiple parts, as is recommended by [RFC7578](https://www.rfc-editor.org/rfc/rfc7578.html#section-4.3) for supplying multiple values per form field.
@@ -1757,7 +1756,7 @@ Note also that `Content-Transfer-Encoding` is deprecated for `multipart/form-dat
Using `format: byte` for a multipart field is equivalent to specifying an [Encoding Object](#encodingObject) with a `headers` field containing `Content-Transfer-Encoding` with a schema that requires the value `base64`.
If `format: byte` is used for a multipart field that has an Encoding Object with a `headers` field containing `Content-Transfer-Encoding` with a schema that disallows `base64`, the result is undefined for serialization and parsing.
-Per the JSON Schema specification, `contentMediaType` without `contentEncoding` present is treated as if `contentEncoding: identity` were present. While useful for embedding text documents such as `text/html` into JSON strings, it is not useful for a `multipart/form-data` part, as it just causes the document to be treated as `text/plain` instead of its actual media type. Use the Encoding Object without `contentMediaType` if no `contentEncoding` is required.
+Per the JSON Schema specification, `contentMediaType` without `contentEncoding` present is treated as if `contentEncoding: identity` were present. While useful for embedding text documents such as `text/html` into JSON strings, it is not useful for a `multipart/form-data` part, as it just causes the document to be treated as `text/plain` instead of its actual media type. Use the Encoding Object without `contentMediaType` if no `contentEncoding` is required.
See [Appendix E](#percentEncodingAndFormMediaTypes) for a detailed examination of percent-encoding concerns for form media types.
@@ -1811,7 +1810,7 @@ requestBody:
description: addresses in XML format
type: array
items:
- $ref: '#/components/schemas/Address'
+ $ref: '#/components/schemas/Address'
profileImage:
# default is application/octet-stream, but we can declare
# a more specific image type or types
@@ -1849,7 +1848,6 @@ requestBody:
items:
type: string
format: binary
-
```
#### Responses Object
@@ -1860,7 +1858,7 @@ 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
+The `default` MAY be used as a default response object for all HTTP codes
that are not covered individually by the Responses Object.
The Responses Object MUST contain at least one response code, and if only one
@@ -1868,15 +1866,16 @@ response code is provided 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.
+
+| 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]`. Only the following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code.
+| 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]`. Only the following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response 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).
@@ -1925,16 +1924,18 @@ default:
```
#### Response Object
-Describes a single response from an API Operation, including design-time, static
+
+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 description of the response. [CommonMark syntax](https://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#section-3.2) 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).
+
+| Field Name | Type | Description |
+| --------------------------------------------- | :-----------------------------------------------------------------------------------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| description | `string` | **REQUIRED**. A description of the response. [CommonMark syntax](https://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#section-3.2) 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).
@@ -2068,9 +2069,10 @@ Each value in the map is a [Path Item Object](#pathItemObject) that describes a
The key value used to identify the path item 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.
+
+| 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).
@@ -2079,7 +2081,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
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.
+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:
@@ -2104,21 +2106,20 @@ Location: https://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 | https://example.org/subscribe/myevent?queryUrl=https://clientdomain.com/stillrunning
-$method | POST
-$request.path.eventType | myevent
-$request.query.queryUrl | https://clientdomain.com/stillrunning
-$request.header.content-Type | application/json
-$request.body#/failedUrl | https://clientdomain.com/failed
-$request.body#/successUrls/1 | https://clientdomain.com/medium
-$response.header.Location | https://example.org/subscription/1
-
+| Expression | Value |
+| ---------------------------- | :----------------------------------------------------------------------------------- |
+| $url | https://example.org/subscribe/myevent?queryUrl=https://clientdomain.com/stillrunning |
+| $method | POST |
+| $request.path.eventType | myevent |
+| $request.query.queryUrl | https://clientdomain.com/stillrunning |
+| $request.header.content-Type | application/json |
+| $request.body#/failedUrl | https://clientdomain.com/failed |
+| $request.body#/successUrls/1 | https://clientdomain.com/medium |
+| $response.header.Location | https://example.org/subscription/1 |
##### Callback Object Examples
-The following example uses the user provided `queryUrl` query string parameter to define the callback URL. This is an example of how to use a callback object to describe a WebHook callback that goes with the subscription operation to enable registering for the WebHook.
+The following example uses the user provided `queryUrl` query string parameter to define the callback URL. This is an example of how to use a callback object to describe a WebHook callback that goes with the subscription operation to enable registering for the WebHook.
```yaml
myCallback:
@@ -2160,12 +2161,13 @@ This object is typically used in properties named `examples` (plural), and is a
Examples allow demonstration of the usage of properties, parameters and objects within OpenAPI.
##### Fixed Fields
-Field Name | Type | Description
----|:---:|---
-summary | `string` | Short description for the example.
-description | `string` | Long description for the example. [CommonMark syntax](https://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. See the rules for resolving [Relative References](#relativeReferences).
+
+| Field Name | Type | Description |
+| ------------------------------------------------ | :------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| summary | `string` | Short description for the example. |
+| description | `string` | Long description for the example. [CommonMark syntax](https://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. See the rules for resolving [Relative References](#relativeReferences). |
This object MAY be extended with [Specification Extensions](#specificationExtensions).
@@ -2176,7 +2178,7 @@ Tooling implementations MAY choose to validate compatibility automatically, and
Example Objects can be used in both [Parameter Objects](#parameterObject) and [Media Type Objects](#mediaTypeObject).
In both Objects, this is done through the `examples` (plural) field.
-However, there are two other ways to provide examples: The `example` (singular) field that is mutually exclusive with `examples` in both Objects, and the `example` (singular) field in the [Schema Object](#schemaObject) that appears in the `schema` field of both Objects.
+However, there are two other ways to provide examples: The `example` (singular) field that is mutually exclusive with `examples` in both Objects, and the `example` (singular) field in the [Schema Object](#schemaObject) that appears in the `schema` field of both Objects.
Each of these fields has slightly different considerations.
The Schema Object's `example` field is used to show example values without regard to how they might be formatted as parameters or within media type representations.
@@ -2204,10 +2206,10 @@ requestBody:
examples:
foo:
summary: A foo example
- value: {"foo": "bar"}
+ value: { 'foo': 'bar' }
bar:
summary: A bar example
- value: {"bar": "baz"}
+ value: { 'bar': 'baz' }
application/xml:
examples:
xmlExample:
@@ -2279,7 +2281,6 @@ application/json:
In the above example, we can just show the JSON string (or any JSON value) as-is, rather than stuffing a serialized JSON value into a JSON string, which would have looked like `"\"json\""`.
-
In contrast, a JSON string encoded inside of a URL-style form body:
```json
@@ -2331,24 +2332,24 @@ The presence of a link does not guarantee the caller's ability to successfully i
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.
+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 URI 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 description.
-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 (optionally qualified with the parameter location, e.g. `path.id` for an `id` parameter in the path), whereas the value can be a constant or an expression to be evaluated and passed to the linked operation.
-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](https://spec.commonmark.org/) MAY be used for rich text representation.
-server | [Server Object](#serverObject) | A server object to be used by the target operation.
+| Field Name | Type | Description |
+| ------------------------------------------- | :------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| operationRef | `string` | A relative or absolute URI 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 description. |
+| 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 (optionally qualified with the parameter location, e.g. `path.id` for an `id` parameter in the path), whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. |
+| 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](https://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 OpenAPI description.
-Because of the potential for name clashes, the `operationRef` syntax is preferred
+Because of the potential for name clashes, the `operationRef` syntax is preferred
for multi-document OpenAPI descriptions.
Note that it is not possible to provide a constant value to `parameters` that matches the syntax of a runtime expression.
@@ -2362,12 +2363,12 @@ Computing a link from a request operation where the `$request.path.id` is used t
paths:
/users/{id}:
parameters:
- - name: id
- in: path
- required: true
- description: the user identifier, as userId
- schema:
- type: string
+ - name: id
+ in: path
+ required: true
+ description: the user identifier, as userId
+ schema:
+ type: string
get:
responses:
'200':
@@ -2390,12 +2391,12 @@ paths:
# 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
+ - name: userid
+ in: path
+ required: true
+ description: the user identifier, as userId
+ schema:
+ type: string
# linked operation
get:
operationId: getUserAddress
@@ -2417,14 +2418,13 @@ links:
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
+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
+As references to `operationId` MAY NOT be possible (the `operationId` is an optional
field in an [Operation Object](#operationObject)), references MAY also be made through a relative `operationRef`:
```yaml
@@ -2447,10 +2447,9 @@ links:
username: $response.body#/username
```
-Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when
+Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when
using JSON Pointer, and it is necessary to URL-encode `{` and `}` as `%7B` and `%7D`, respectively when using JSON Pointer as URI fragments.
-
##### Runtime Expressions
Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call.
@@ -2462,7 +2461,7 @@ The runtime expression is defined by the following [ABNF](https://tools.ietf.org
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
+ query-reference = "query." name
path-reference = "path." name
body-reference = "body" ["#" json-pointer ]
json-pointer = *( "/" reference-token )
@@ -2479,21 +2478,21 @@ The runtime expression is defined by the following [ABNF](https://tools.ietf.org
Here, `json-pointer` is taken from [RFC6901](https://tools.ietf.org/html/rfc6901), `char` from [RFC7159](https://tools.ietf.org/html/rfc7159#section-7) and `token` from [RFC7230](https://tools.ietf.org/html/rfc7230#section-3.2.6).
-The `name` identifier is case-sensitive, whereas `token` is not.
+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
+| 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.
@@ -2502,11 +2501,11 @@ Expressions can be embedded into string values by surrounding the expression wit
Describes a single header for [HTTP responses](#responseHeaders) and for [individual parts in `multipart` representations](#encodingHeaders); see the relevant [Response Object](#responseObject) and [Encoding Object](#encodingObject) documentation for restrictions on which headers can be described.
-The Header Object follows the structure of the [Parameter Object](#parameterObject), including determining its serialization strategy based on whether `schema` or `content` is present, with the following changes:
+The Header Object follows the structure of the [Parameter Object](#parameterObject), including determining its serialization strategy based on whether `schema` or `content` is present, 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)). This means that `allowEmptyValue` and `allowReserved` MUST NOT be used, and `style`, if used, MUST be limited to `simple`.
+1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, [`style`](#parameterStyle)). This means that `allowEmptyValue` and `allowReserved` MUST NOT be used, and `style`, if used, MUST be limited to `simple`.
##### Fixed Fields
@@ -2514,11 +2513,11 @@ The Header Object follows the structure of the [Parameter Object](#parameterObje
These fields MAY be used with either `content` or `schema`.
-Field Name | Type | Description
----|:---:|---
-description | `string` | A brief description of the header. This could contain examples of use. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
-required | `boolean` | Determines whether this header is mandatory. The default value is `false`.
- deprecated | `boolean` | Specifies that the header is deprecated and SHOULD be transitioned out of usage. Default value is `false`.
+| Field Name | Type | Description |
+| ------------------------------------------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| description | `string` | A brief description of the header. This could contain examples of use. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| required | `boolean` | Determines whether this header is mandatory. The default value is `false`. |
+| deprecated | `boolean` | Specifies that the header is deprecated and SHOULD be transitioned out of usage. Default value is `false`. |
This object MAY be extended with [Specification Extensions](#specificationExtensions).
@@ -2532,13 +2531,13 @@ Serializing with `schema` is NOT RECOMMENDED for headers with parameters (name=v
When `example` or `examples` are provided in conjunction with the `schema` object, the example SHOULD match the specified schema and follow the prescribed serialization strategy for the header.
The `example` and `examples` fields are mutually exclusive, and if either is present it SHALL _override_ any `example` in the schema.
-Field Name | Type | Description
----|:---:|---
-style | `string` | Describes how the header value will be serialized. The default (and only legal value for headers) is `simple`.
-explode | `boolean` | When this is true, header values of type `array` or `object` generate a single header whose value is a comma-separated list of the array items or key-value pairs of the map, see [Style Examples](#style-examples). For other data types this property has no effect. The default value is `false`.
-schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the header.
-example | Any | Example of the header's potential value; see [Working With Examples](#working-with-examples).
-examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the header's potential value; see [Working With Examples](#working-with-examples).
+| Field Name | Type | Description |
+| ------------------------------------- | :--------------------------------------------------------------------------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| style | `string` | Describes how the header value will be serialized. The default (and only legal value for headers) is `simple`. |
+| explode | `boolean` | When this is true, header values of type `array` or `object` generate a single header whose value is a comma-separated list of the array items or key-value pairs of the map, see [Style Examples](#style-examples). For other data types this property has no effect. The default value is `false`. |
+| schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the header. |
+| example | Any | Example of the header's potential value; see [Working With Examples](#working-with-examples). |
+| examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the header's potential value; see [Working With Examples](#working-with-examples). |
See also [Appendix C: Using RFC6570 Implementations](#usingRFC6570Implementations) for additional guidance.
@@ -2547,9 +2546,9 @@ See also [Appendix C: Using RFC6570 Implementations](#usingRFC6570Implementation
For more complex scenarios, the [`content`](#headerContent) property can define the media type and schema of the header, as well as give examples of its use.
Using `content` with a `text/plain` media type is RECOMMENDED for headers where the `schema` strategy is not appropriate.
-Field Name | Type | Description
----|:---:|---
-content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the header. The key is the media type and the value describes it. The map MUST only contain one entry.
+| Field Name | Type | Description |
+| ----------------------------------- | :--------------------------------------------------: | ----------------------------------------------------------------------------------------------------------------------------------------------- |
+| content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the header. The key is the media type and the value describes it. The map MUST only contain one entry. |
##### Header Object Example
@@ -2571,7 +2570,7 @@ X-Rate-Limit-Limit:
type: integer
```
-Requiring that a strong `ETag` header (with a value starting with `"` rather than `W/`) is present. Note the use of `content`, because using `schema` and `style` would require the `"` to be percent-encoded as `%22`:
+Requiring that a strong `ETag` header (with a value starting with `"` rather than `W/`) is present. Note the use of `content`, because using `schema` and `style` would require the `"` to be percent-encoded as `%22`:
```json
"ETag": {
@@ -2594,7 +2593,7 @@ ETag:
text/plain:
schema:
type: string
- pattern: ^"
+ pattern: ^"
```
#### Tag Object
@@ -2603,11 +2602,12 @@ Adds metadata to a single tag that is used by the [Operation Object](#operationO
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 description for the tag. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
-externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this tag.
+
+| Field Name | Type | Description |
+| ------------------------------------------ | :-----------------------------------------------------------: | ---------------------------------------------------------------------------------------------------------------------- |
+| name | `string` | **REQUIRED**. The name of the tag. |
+| description | `string` | A description for the tag. [CommonMark syntax](https://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).
@@ -2625,19 +2625,19 @@ name: pet
description: Pets operations
```
-
#### Reference Object
A simple object to allow referencing other components in the OpenAPI document, 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.
+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.
+
+| 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.
@@ -2654,6 +2654,7 @@ $ref: '#/components/schemas/Pet'
```
##### Relative Schema Document Example
+
```json
{
"$ref": "Pet.json"
@@ -2665,6 +2666,7 @@ $ref: Pet.yaml
```
##### Relative Documents With Embedded Schema Example
+
```json
{
"$ref": "definitions.json#/Pet"
@@ -2684,7 +2686,7 @@ This object is an extended subset of the [JSON Schema Specification Wright Draft
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 those of JSON Schema and do not add any additional semantics.
-##### Properties
+##### Properties
The following properties are taken directly from the JSON Schema definition and follow the same specifications:
@@ -2705,7 +2707,8 @@ The following properties are taken directly from the JSON Schema definition and
- required
- enum
-The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification.
+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.
@@ -2725,29 +2728,31 @@ Additional properties defined by the JSON Schema specification that are not ment
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` | A `true` value adds `"null"` to the allowed type specified by the `type` keyword, only if `type` is explicitly defined within the same Schema Object. Other Schema Object constraints retain their defined behavior, and therefore may disallow the use of `null` as a value. A `false` value leaves the specified or default `type` unmodified. The default value is `false`.
-discriminator | [Discriminator Object](#discriminatorObject) | Adds support for polymorphism. The discriminator is used to determine which of a set of schemas a payload is expected to satisfy. 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`.
+
+| Field Name | Type | Description |
+| ----------------------------------------------- | :-----------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| nullable | `boolean` | A `true` value adds `"null"` to the allowed type specified by the `type` keyword, only if `type` is explicitly defined within the same Schema Object. Other Schema Object constraints retain their defined behavior, and therefore may disallow the use of `null` as a value. A `false` value leaves the specified or default `type` unmodified. The default value is `false`. |
+| discriminator | [Discriminator Object](#discriminatorObject) | Adds support for polymorphism. The discriminator is used to determine which of a set of schemas a payload is expected to satisfy. 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.
+`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`](#schemaDiscriminator) field.
When used, the `discriminator` indicates the name of the property that hints which schema definition is expected to validate 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](#discriminatorMapping) by overriding the property with a new value. If a new value exists, this takes precedence over the schema name.
@@ -2777,9 +2782,7 @@ format: email
```json
{
"type": "object",
- "required": [
- "name"
- ],
+ "required": ["name"],
"properties": {
"name": {
"type": "string"
@@ -2799,7 +2802,7 @@ format: email
```yaml
type: object
required:
-- name
+ - name
properties:
name:
type: string
@@ -2861,9 +2864,7 @@ additionalProperties:
"type": "string"
}
},
- "required": [
- "name"
- ],
+ "required": ["name"],
"example": {
"name": "Puma",
"id": 1
@@ -2880,7 +2881,7 @@ properties:
name:
type: string
required:
-- name
+ - name
example:
name: Puma
id: 1
@@ -2894,10 +2895,7 @@ example:
"schemas": {
"ErrorModel": {
"type": "object",
- "required": [
- "message",
- "code"
- ],
+ "required": ["message", "code"],
"properties": {
"message": {
"type": "string"
@@ -2916,9 +2914,7 @@ example:
},
{
"type": "object",
- "required": [
- "rootCause"
- ],
+ "required": ["rootCause"],
"properties": {
"rootCause": {
"type": "string"
@@ -2938,8 +2934,8 @@ components:
ErrorModel:
type: object
required:
- - message
- - code
+ - message
+ - code
properties:
message:
type: string
@@ -2949,13 +2945,13 @@ components:
maximum: 600
ExtendedErrorModel:
allOf:
- - $ref: '#/components/schemas/ErrorModel'
- - type: object
- required:
- - rootCause
- properties:
- rootCause:
- type: string
+ - $ref: '#/components/schemas/ErrorModel'
+ - type: object
+ required:
+ - rootCause
+ properties:
+ rootCause:
+ type: string
```
###### Models with Polymorphism Support
@@ -2977,10 +2973,7 @@ components:
"type": "string"
}
},
- "required": [
- "name",
- "petType"
- ]
+ "required": ["name", "petType"]
},
"Cat": {
"description": "A representation of a cat. Note that `Cat` will be used as the discriminating value.",
@@ -2995,17 +2988,10 @@ components:
"type": "string",
"description": "The measured skill for hunting",
"default": "lazy",
- "enum": [
- "clueless",
- "lazy",
- "adventurous",
- "aggressive"
- ]
+ "enum": ["clueless", "lazy", "adventurous", "aggressive"]
}
},
- "required": [
- "huntingSkill"
- ]
+ "required": ["huntingSkill"]
}
]
},
@@ -3026,9 +3012,7 @@ components:
"minimum": 0
}
},
- "required": [
- "packSize"
- ]
+ "required": ["packSize"]
}
]
}
@@ -3050,38 +3034,38 @@ components:
petType:
type: string
required:
- - name
- - petType
- Cat: # "Cat" will be used as the discriminating value
+ - name
+ - petType
+ Cat: # "Cat" will be used as the discriminating 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 discriminating value
+ - $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 discriminating 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
+ - $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
@@ -3093,12 +3077,14 @@ The Discriminator Object does this by implicitly or explicitly associating the p
Note that `discriminator` MUST NOT change the validation outcome of the schema.
##### Fixed Fields
-Field Name | Type | Description
----|:---:|---
-propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminating value. This property SHOULD be required in the payload schema, as the behavior when the property is absent is undefined.
- mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or URI references.
+
+| Field Name | Type | Description |
+| ------------------------------------------- | :---------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminating value. This property SHOULD be required in the payload schema, as the behavior when the property is absent is undefined. |
+| mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or URI references. |
##### Conditions for Using the Discriminator Object
+
The Discriminator Object is legal only when using one of the composite keywords `oneOf`, `anyOf`, `allOf`.
In both the `oneOf` and `anyOf` use cases, where those keywords are adjacent to `discriminator`, all possible schemas MUST be listed explicitly.
@@ -3113,6 +3099,7 @@ This is because `discriminator` cannot change the validation outcome, and no sta
The behavior of any configuration of `oneOf`, `anyOf`, `allOf` and `discriminator` that is not described above is undefined.
##### Options for Mapping Values to Schemas
+
The value of the property named in `propertyName` is used as the name of the associated schema under the [Components Object](#componentsObject), _unless_ a `mapping` is present for that value.
The `mapping` entry maps a specific property value to either a different schema component name, or to a schema identified by a URI.
When using implicit or explicit schema component names, inline `oneOf` or `anyOf` subschemas are not considered.
@@ -3131,9 +3118,9 @@ In OAS 3.0, a response payload MAY be described to be exactly one of any number
```yaml
MyResponseType:
oneOf:
- - $ref: '#/components/schemas/Cat'
- - $ref: '#/components/schemas/Dog'
- - $ref: '#/components/schemas/Lizard'
+ - $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`. Deserialization of a `oneOf` can be a costly operation, as it requires determining which schema matches the payload and thus should be used in deserialization. This problem also exists for `anyOf` schemas. A `discriminator` MAY be used as a "hint" to improve the efficiency of selection of the matching schema. The `discriminator` field cannot change the validation result of the `oneOf`, it can only help make the deserialization more efficient and provide better error messaging. We can specify the exact field that tells us which schema is expected to match the instance:
@@ -3141,14 +3128,14 @@ which means the payload _MUST_, by validation, match exactly one of the schemas
```yaml
MyResponseType:
oneOf:
- - $ref: '#/components/schemas/Cat'
- - $ref: '#/components/schemas/Dog'
- - $ref: '#/components/schemas/Lizard'
+ - $ref: '#/components/schemas/Cat'
+ - $ref: '#/components/schemas/Dog'
+ - $ref: '#/components/schemas/Lizard'
discriminator:
propertyName: petType
```
-The expectation now is that a property with name `petType` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OpenAPI description. Thus the response payload:
+The expectation now is that a property with name `petType` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OpenAPI description. Thus the response payload:
```json
{
@@ -3164,10 +3151,10 @@ In scenarios where the value of the discriminator field does not match the schem
```yaml
MyResponseType:
oneOf:
- - $ref: '#/components/schemas/Cat'
- - $ref: '#/components/schemas/Dog'
- - $ref: '#/components/schemas/Lizard'
- - $ref: https://gigantic-server.com/schemas/Monster/schema.json
+ - $ref: '#/components/schemas/Cat'
+ - $ref: '#/components/schemas/Dog'
+ - $ref: '#/components/schemas/Lizard'
+ - $ref: https://gigantic-server.com/schemas/Monster/schema.json
discriminator:
propertyName: petType
mapping:
@@ -3175,7 +3162,7 @@ MyResponseType:
monster: https://gigantic-server.com/schemas/Monster/schema.json
```
-Here the discriminating value of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `#/components/schemas/dog`. If the discriminating value does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail.
+Here the discriminating value of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `#/components/schemas/dog`. If the discriminating value does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail.
When used in conjunction with the `anyOf` construct, the use of the discriminator can avoid ambiguity for serializers/deserializers where multiple schemas may satisfy a single payload.
@@ -3187,7 +3174,7 @@ components:
Pet:
type: object
required:
- - petType
+ - petType
properties:
petType:
type: string
@@ -3197,28 +3184,28 @@ components:
dog: Dog
Cat:
allOf:
- - $ref: '#/components/schemas/Pet'
- - type: object
- # all other properties specific to a `Cat`
- properties:
- name:
- type: string
+ - $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
+ - $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
+ - $ref: '#/components/schemas/Pet'
+ - type: object
+ # all other properties specific to a `Lizard`
+ properties:
+ lovesRocks:
+ type: boolean
```
Validated against the `Pet` schema, a payload like this:
@@ -3230,7 +3217,7 @@ Validated against the `Pet` schema, a payload like this:
}
```
-will indicate that the `#/components/schemas/Cat` schema is expected to match. Likewise this payload:
+will indicate that the `#/components/schemas/Cat` schema is expected to match. Likewise this payload:
```json
{
@@ -3241,30 +3228,30 @@ will indicate that the `#/components/schemas/Cat` schema is expected to match.
will map to `#/components/schemas/Dog` because the `dog` entry in the `mapping` element maps to `Dog` which is the schema name for `#/components/schemas/Dog`.
-
#### 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.
+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 a non-relative 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, `form‑urlencoded
-[RFC1866](https://datatracker.ietf.org/doc/html/rfc1866#section-8.2.1) | 11/1995 | content-based serialization | [[RFC1738]] | obsoleted by [[HTML401]] [Section 17.13.4.1](https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1), [[URL]] [Section 5](https://url.spec.whatwg.org/#urlencoded-serializing)
+| Specification | Date | OAS Usage | Percent-Encoding | Notes |
+| ---------------------------------------------------------------------- | ------- | --------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [[RFC3986]] | 01/2005 | URI/URL syntax | [[RFC3986]] | obsoletes [[RFC1738]], [[RFC2396]] |
+| [[RFC6570]] | 03/2012 | style-based serialization | [[RFC3986]] | does not use `+` for form‑urlencoded
|
+| [RFC1866](https://datatracker.ietf.org/doc/html/rfc1866#section-8.2.1) | 11/1995 | content-based serialization | [[RFC1738]] | obsoleted by [[HTML401]] [Section 17.13.4.1](https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1), [[URL]] [Section 5](https://url.spec.whatwg.org/#urlencoded-serializing) |
Style-based serialization is used in the [Parameter Object](#parameterObject) when `schema` is present, and in the [Encoding Object](#encodingObject) when at least one of `style`, `explode`, or `allowReserved` is present.
See [Appendix C](#usingRFC6570Implementations) for more details of RFC6570's two different approaches to percent-encoding, including an example involving `+`.
From d899954ae9dba2a7f556c1e0710a7bb3a56f11fc Mon Sep 17 00:00:00 2001
From: Lorna Mitchell
|
-| 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](https://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. Default value is `false`. |
-| allowEmptyValue | `boolean` | If `true`, clients MAY pass a zero-length string value in place of parameters that would otherwise be omitted entirely, which the server SHOULD interpret as the parameter being unused. Default value is `false`. If [`style`](#parameterStyle) is used, and if [behavior is _n/a_ (cannot be serialized)](#style-examples), the value of `allowEmptyValue` SHALL be ignored. Interactions between this field and the parameter's [Schema Object](#schemaObject) are implementation-defined. This field is valid only for `query` parameters. Use of this property is NOT RECOMMENDED, and it is likely to be removed in a later revision. |
+| name | `string` | **REQUIRED**. The name of the parameter. Parameter names are _case sensitive_.
|
+| 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](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameter-in) 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. Default value is `false`. |
+| allowEmptyValue | `boolean` | If `true`, clients MAY pass a zero-length string value in place of parameters that would otherwise be omitted entirely, which the server SHOULD interpret as the parameter being unused. Default value is `false`. If [`style`](#parameter-style) is used, and if [behavior is _n/a_ (cannot be serialized)](#style-examples), the value of `allowEmptyValue` SHALL be ignored. Interactions between this field and the parameter's [Schema Object](#schema-object) are implementation-defined. This field is valid only for `query` parameters. Use of this property is NOT RECOMMENDED, and it is likely to be removed in a later revision. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
Note that while `"Cookie"` as a `name` is not forbidden with `in: header`, the effect of defining a cookie parameter that way is undefined; use `in: cookie` instead.
###### Fixed Fields for use with `schema`
-For simpler scenarios, a [`schema`](#parameterSchema) and [`style`](#parameterStyle) can describe the structure and syntax of the parameter.
+For simpler scenarios, a [`schema`](#parameter-schema) and [`style`](#parameter-style) can describe the structure and syntax of the parameter.
When `example` or `examples` are provided in conjunction with the `schema` object, the example SHOULD match the specified schema and follow the prescribed serialization strategy for the parameter.
The `example` and `examples` fields are mutually exclusive, and if either is present it SHALL _override_ any `example` in the schema.
-Serializing with `schema` is NOT RECOMMENDED for `in: cookie` parameters, `in: header` parameters that use HTTP header parameters (name=value pairs following a `;`) in their values, or `in: header` parameters where values might have non-URL-safe characters; see [Appendix D](#serializingHeadersAndCookies) for details.
+Serializing with `schema` is NOT RECOMMENDED for `in: cookie` parameters, `in: header` parameters that use HTTP header parameters (name=value pairs following a `;`) in their values, or `in: header` parameters where values might have non-URL-safe characters; see [Appendix D](#appendix-d-serializing-headers-and-cookies) for details.
| 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`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject` is undefined. |
-| allowReserved | `boolean` | When this is true, parameter values are serialized using reserved expansion, as defined by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.3), which allows [RFC3986's reserved character set](https://datatracker.ietf.org/doc/html/rfc3986#section-2.2), as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#section-3.4) (`[`, `]`, `#`), or have a special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see Appendices [C](#usingRFC6570Implementations) and [E](#percentEncodingAndFormMediaTypes) for details. 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 parameter's potential value; see [Working With Examples](#working-with-examples). |
-| examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the parameter's potential value; see [Working With Examples](#working-with-examples). |
+| 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`](#parameter-style) is `form`, the default value is `true`. For all other styles, the default value is `false`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject` is undefined. |
+| allowReserved | `boolean` | When this is true, parameter values are serialized using reserved expansion, as defined by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.3), which allows [RFC3986's reserved character set](https://datatracker.ietf.org/doc/html/rfc3986#section-2.2), as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#section-3.4) (`[`, `]`, `#`), or have a special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see Appendices [C](#appendix-c-using-rfc6570-implementations) and [E](#appendix-e-percent-encoding-and-form-media-types) for details. This property only applies to parameters with an `in` value of `query`. The default value is `false`. |
+| schema | [Schema Object](#schema-object) \| [Reference Object](#reference-object) | The schema defining the type used for the parameter. |
+| example | Any | Example of the parameter's potential value; see [Working With Examples](#working-with-examples). |
+| examples | Map[ `string`, [Example Object](#example-object) \| [Reference Object](#reference-object)] | Examples of the parameter's potential value; see [Working With Examples](#working-with-examples). |
-See also [Appendix C: Using RFC6570 Implementations](#usingRFC6570Implementations) for additional guidance.
+See also [Appendix C: Using RFC6570 Implementations](#appendix-c-using-rfc6570-implementations) for additional guidance.
###### Fixed Fields for use with `content`
-For more complex scenarios, the [`content`](#parameterContent) property can define the media type and schema of the parameter, as well as give examples of its use.
+For more complex scenarios, the [`content`](#parameter-content) property can define the media type and schema of the parameter, as well as give examples of its use.
Using `content` with a `text/plain` media type is RECOMMENDED for `in: header` and `in: cookie` parameters where the `schema` strategy is not appropriate.
| 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. |
+| content | Map[`string`, [Media Type Object](#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
+##### Style Values
In order to support common ways of serializing simple parameters, a set of `style` values are defined.
-| `style` | [`type`](#dataTypes) | `in` | Comments |
+| `style` | [`type`](#data-types) | `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) |
@@ -1116,7 +1116,7 @@ In order to support common ways of serializing simple parameters, a set of `styl
| pipeDelimited | `array`, `object` | `query` | Pipe separated array values or object properties and values. This option replaces `collectionFormat` equal to `pipes` from OpenAPI 2.0. |
| deepObject | `object` | `query` | Allows objects with scalar properties to be represented using form parameters. The representation of array or object properties is not defined. |
-See [Appendix E](#percentEncodingAndFormMediaTypes) for a discussion of percent-encoding, including when delimiters need to be percent-encoded and options for handling collisions with percent-encoded data.
+See [Appendix E](#appendix-e-percent-encoding-and-form-media-types) for a discussion of percent-encoding, including when delimiters need to be percent-encoded and options for handling collisions with percent-encoded data.
##### Style Examples
@@ -1133,11 +1133,11 @@ The following table shows examples, as would be shown with the `example` or `exa
* The value _empty_ denotes the empty string, and is unrelated to the `allowEmptyValue` field
* The behavior of combinations marked _n/a_ is undefined
* The `undefined` replaces the `empty` column in previous versions of this specification in order to better align with [RFC6570](https://www.rfc-editor.org/rfc/rfc6570.html#section-2.3) terminology, which describes certain values including but not limited to `null` as "undefined" values with special handling; notably, the empty string is _not_ undefined
-* For `form` and the non-RFC6570 query string styles `spaceDelimited`, `pipeDelimited`, and `deepObject`, each example is shown prefixed with `?` as if it were the only query parameter; see [Appendix C](#usingRFC6570Implementations) for more information on constructing query strings from multiple parameters, and [Appendix D](#serializingHeadersAndCookies) for warnings regarding `form` and cookie parameters
-* Note that the `?` prefix is not appropriate for serializing `application/x-www-form-urlencoded` HTTP message bodies, and MUST be stripped or (if constructing the string manually) not added when used in that context; see the [Encoding Object](#encodingObject) for more information
-* The examples are percent-encoded as required by RFC6570 and RFC3986; see [Appendix E](#percentEncodingAndFormMediaTypes) for a thorough discussion of percent-encoding concerns, including why unencoded `|` (`%7C`), `[` (`%5B`), and `]` (`%5D`) seem to work in some environments despite not being compliant.
+* For `form` and the non-RFC6570 query string styles `spaceDelimited`, `pipeDelimited`, and `deepObject`, each example is shown prefixed with `?` as if it were the only query parameter; see [Appendix C](#appendix-c-using-rfc6570-implementations) for more information on constructing query strings from multiple parameters, and [Appendix D](#appendix-d-serializing-headers-and-cookies) for warnings regarding `form` and cookie parameters
+* Note that the `?` prefix is not appropriate for serializing `application/x-www-form-urlencoded` HTTP message bodies, and MUST be stripped or (if constructing the string manually) not added when used in that context; see the [Encoding Object](#encoding-object) for more information
+* The examples are percent-encoded as required by RFC6570 and RFC3986; see [Appendix E](#appendix-e-percent-encoding-and-form-media-types) for a thorough discussion of percent-encoding concerns, including why unencoded `|` (`%7C`), `[` (`%5B`), and `]` (`%5D`) seem to work in some environments despite not being compliant.
-| [`style`](#styleValues) | `explode` | `empty` | `string` | `array` | `object` |
+| [`style`](#style-values) | `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 |
@@ -1311,7 +1311,7 @@ content:
type: number
```
-#### Request Body Object
+#### Request Body Object
Describes a single request body.
@@ -1319,11 +1319,11 @@ Describes a single request body.
| Field Name | Type | Description |
| ------------------------------------------------ | :--------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](https://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`. |
+| description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| content | Map[`string`, [Media Type Object](#media-type-object)] | **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).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### Request Body Examples
@@ -1404,7 +1404,7 @@ content:
externalValue: https://foo.bar/examples/user-example.whatever
```
-#### Media Type Object
+#### Media Type Object
Each Media Type Object provides schema and examples for the media type identified by its key.
@@ -1416,12 +1416,12 @@ See [Working With Examples](#working-with-examples) for further guidance regardi
| Field Name | Type | Description |
| ---------------------------------------- | :--------------------------------------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the content of the request, response, parameter, or header. |
-| example | Any | Example of the media type; see [Working With Examples](#working-with-examples). |
-| examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type; see [Working With Examples](#working-with-examples). |
-| 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 attribute SHALL only apply to [Request Body Objects](#requestBodyObject), and only when the media type is `multipart` or `application/x-www-form-urlencoded`. If no Encoding Object is provided for a property, the behavior is determined by the default values documented for the Encoding Object. |
+| schema | [Schema Object](#schema-object) \| [Reference Object](#reference-object) | The schema defining the content of the request, response, parameter, or header. |
+| example | Any | Example of the media type; see [Working With Examples](#working-with-examples). |
+| examples | Map[ `string`, [Example Object](#example-object) \| [Reference Object](#reference-object)] | Examples of the media type; see [Working With Examples](#working-with-examples). |
+| encoding | Map[`string`, [Encoding Object](#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 attribute SHALL only apply to [Request Body Objects](#request-body-object), and only when the media type is `multipart` or `application/x-www-form-urlencoded`. If no Encoding Object is provided for a property, the behavior is determined by the default values documented for the Encoding Object. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### Media Type Examples
@@ -1537,15 +1537,15 @@ See [Encoding the `x-www-form-urlencoded` Media Type](#encoding-the-x-www-form-u
See [Encoding `multipart` Media Types](#encoding-multipart-media-types) for further guidance and examples, both with and without the `encoding` attribute.
-#### Encoding Object
+#### Encoding Object
A single encoding definition applied to a single schema property.
-See [Appendix B](#dataTypeConversion) for a discussion of converting values of various types to string representations.
+See [Appendix B](#appendix-b-data-type-conversion) for a discussion of converting values of various types to string representations.
Properties are correlated with `multipart` parts using the `name` parameter to `Content-Disposition: form-data`, and with `application/x-www-form-urlencoded` using the query string parameter names.
In both cases, their order is implementation-defined.
-See [Appendix E](#percentEncodingAndFormMediaTypes) for a detailed examination of percent-encoding concerns for form media types.
+See [Appendix E](#appendix-e-percent-encoding-and-form-media-types) for a detailed examination of percent-encoding concerns for form media types.
##### Fixed Fields
@@ -1555,10 +1555,10 @@ These fields MAY be used either with or without the RFC6570-style serialization
| Field Name | Type | Description |
| --------------------------------------------- | :-----------------------------------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| contentType | `string` | The `Content-Type` for encoding a specific property. The value is a comma-separated list, each element of which is either a specific media type (e.g. `image/png`) or a wildcard media type (e.g. `image/*`). Default value depends on the property type as shown in the table below. |
-| headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | A map allowing additional information to be provided as headers. `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`. |
+| contentType | `string` | The `Content-Type` for encoding a specific property. The value is a comma-separated list, each element of which is either a specific media type (e.g. `image/png`) or a wildcard media type (e.g. `image/*`). Default value depends on the property type as shown in the table below. |
+| headers | Map[`string`, [Header Object](#header-object) \| [Reference Object](#reference-object)] | A map allowing additional information to be provided as headers. `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`. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
The default values for `contentType` are as follows, where an _n/a_ in the `format` column means that the presence or value of `format` is irrelevant:
@@ -1572,17 +1572,17 @@ The default values for `contentType` are as follows, where an _n/a_ in the `form
Determining how to handle `null` values if `nullable: true` is present depends on how `null` values are being serialized.
If `null` values are entirely omitted, then the `contentType` is irrelevant.
-See [Appendix B](#dataTypeConversion) for a discussion of data type conversion options.
+See [Appendix B](#appendix-b-data-type-conversion) for a discussion of data type conversion options.
###### Fixed Fields for RFC6570-style Serialization
| Field Name | Type | Description |
| ------------------------------------------------- | :-------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| 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. Note that the initial `?` used in query strings is not used in `application/x-www-form-urlencoded` message bodies, and MUST be removed (if using an RFC6570 implementation) or simply not added (if constructing the string manually). 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`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject` is undefined. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. |
-| allowReserved | `boolean` | When this is true, parameter values are serialized using reserved expansion, as defined by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.3), which allows [RFC3986's reserved character set](https://datatracker.ietf.org/doc/html/rfc3986#section-2.2), as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#section-3.4) (`[`, `]`, `#`), or have a special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see Appendices [C](#usingRFC6570Implementations) and [E](#percentEncodingAndFormMediaTypes) for details. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. |
+| style | `string` | Describes how a specific property value will be serialized depending on its type. See [Parameter Object](#parameter-object) for details on the [`style`](#parameter-style) property. The behavior follows the same values as `query` parameters, including default values. Note that the initial `?` used in query strings is not used in `application/x-www-form-urlencoded` message bodies, and MUST be removed (if using an RFC6570 implementation) or simply not added (if constructing the string manually). 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`](#encoding-style) is `form`, the default value is `true`. For all other styles, the default value is `false`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject` is undefined. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. |
+| allowReserved | `boolean` | When this is true, parameter values are serialized using reserved expansion, as defined by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.3), which allows [RFC3986's reserved character set](https://datatracker.ietf.org/doc/html/rfc3986#section-2.2), as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#section-3.4) (`[`, `]`, `#`), or have a special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see Appendices [C](#appendix-c-using-rfc6570-implementations) and [E](#appendix-e-percent-encoding-and-form-media-types) for details. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. |
-See also [Appendix C: Using RFC6570 Implementations](#usingRFC6570Implementations) for additional guidance.
+See also [Appendix C: Using RFC6570 Implementations](#appendix-c-using-rfc6570-implementations) for additional guidance.
The role of `contentType` with `application/x-www-form-urlencoded` request bodies was not described in detail in version 3.0.3 and earlier of this specification.
To match the intent of these fields and be compatible with version 3.1 of this specification, it is RECOMMENDED that whenever any of `style`, `explode`, or `allowReserved` are present with an explicit value:
@@ -1600,14 +1600,14 @@ The absence of all three of those fields is the equivalent of using `content`, b
##### Encoding the `x-www-form-urlencoded` Media Type
-To submit content using form url encoding via [RFC1866](https://tools.ietf.org/html/rfc1866), use the `application/x-www-form-urlencoded` media type in the [Media Type Object](#mediaTypeObject) under the [Request Body Object](#requestBodyObject).
+To submit content using form url encoding via [RFC1866](https://tools.ietf.org/html/rfc1866), use the `application/x-www-form-urlencoded` media type in the [Media Type Object](#media-type-object) under the [Request Body Object](#request-body-object).
This configuration means that the request body MUST be encoded per [RFC1866](https://tools.ietf.org/html/rfc1866) when passed to the server, after any complex objects have been serialized to a string representation.
-See [Appendix E](#percentEncodingAndFormMediaTypes) for a detailed examination of percent-encoding concerns for form media types.
+See [Appendix E](#appendix-e-percent-encoding-and-form-media-types) for a detailed examination of percent-encoding concerns for form media types.
###### Example: URL Encoded Form with JSON Values
-When there is no [`encoding` field](#mediaTypeEncoding), the serialization strategy is based on the Encoding Object's default values:
+When there is no [`encoding` field](#media-type-encoding), the serialization strategy is based on the Encoding Object's default values:
```yaml
requestBody:
@@ -1642,7 +1642,7 @@ Assuming the most compact representation of the JSON value (with unnecessary whi
id=f81d4fae-7dec-11d0-a765-00a0c91e6bf6&address=%7B%22streetAddress%22:%22123+Example+Dr.%22,%22city%22:%22Somewhere%22,%22state%22:%22CA%22,%22zip%22:%2299999%2B1234%22%7D
```
-Note that the `id` keyword is treated as `text/plain` per the [Encoding Object](#encodingObject)'s default behavior, and is serialized as-is.
+Note that the `id` keyword is treated as `text/plain` per the [Encoding Object](#encoding-object)'s default behavior, and is serialized as-is.
If it were treated as `application/json`, then the serialized value would be a JSON string including quotation marks, which would be percent-encoded as `%22`.
Here is the `id` parameter (without `address`) serialized as `application/json` instead of `text/plain`, and then encoded per RFC1866:
@@ -1700,12 +1700,12 @@ Note that there are significant restrictions on what headers can be used with `m
Note also that `Content-Transfer-Encoding` is deprecated for `multipart/form-data` ([RFC7578](https://www.rfc-editor.org/rfc/rfc7578.html#section-4.7)) where binary data is supported, as it is in HTTP.
-Using `format: byte` for a multipart field is equivalent to specifying an [Encoding Object](#encodingObject) with a `headers` field containing `Content-Transfer-Encoding` with a schema that requires the value `base64`.
+Using `format: byte` for a multipart field is equivalent to specifying an [Encoding Object](#encoding-object) with a `headers` field containing `Content-Transfer-Encoding` with a schema that requires the value `base64`.
If `format: byte` is used for a multipart field that has an Encoding Object with a `headers` field containing `Content-Transfer-Encoding` with a schema that disallows `base64`, the result is undefined for serialization and parsing.
Per the JSON Schema specification, `contentMediaType` without `contentEncoding` present is treated as if `contentEncoding: identity` were present. While useful for embedding text documents such as `text/html` into JSON strings, it is not useful for a `multipart/form-data` part, as it just causes the document to be treated as `text/plain` instead of its actual media type. Use the Encoding Object without `contentMediaType` if no `contentEncoding` is required.
-See [Appendix E](#percentEncodingAndFormMediaTypes) for a detailed examination of percent-encoding concerns for form media types.
+See [Appendix E](#appendix-e-percent-encoding-and-form-media-types) for a detailed examination of percent-encoding concerns for form media types.
###### Example: Basic Multipart Form
@@ -1797,7 +1797,7 @@ requestBody:
format: binary
```
-#### Responses Object
+#### Responses Object
A container for the expected responses of an operation.
The container maps a HTTP response code to the expected response.
@@ -1816,15 +1816,15 @@ call.
| 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. |
+| default | [Response Object](#response-object) \| [Reference 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](#reference-object) can link to a response that the [OpenAPI Object's components/responses](#components-responses) 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]`. Only the following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code. |
+| [HTTP Status Code](#http-status-codes) | [Response Object](#response-object) \| [Reference Object](#reference-object) | Any [HTTP status code](#http-status-codes) 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](#reference-object) can link to a response that is defined in the [OpenAPI Object's components/responses](#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]`. Only the following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response 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).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### Responses Object Example
@@ -1870,7 +1870,7 @@ default:
$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.
@@ -1879,12 +1879,12 @@ Describes a single response from an API Operation, including design-time, static
| Field Name | Type | Description |
| --------------------------------------------- | :-----------------------------------------------------------------------------------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| description | `string` | **REQUIRED**. A description of the response. [CommonMark syntax](https://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#section-3.2) 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). |
+| description | `string` | **REQUIRED**. A description of the response. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| headers | Map[`string`, [Header Object](#header-object) \| [Reference Object](#reference-object)] | Maps a header name to its definition. [RFC7230](https://tools.ietf.org/html/rfc7230#section-3.2) 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](#media-type-object)] | 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](#link-object) \| [Reference 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](#components-object). |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### Response Object Examples
@@ -2009,25 +2009,25 @@ Response with no return value:
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](#pathItemObject) that describes a set of requests that may be initiated by the API provider and the expected responses.
+Each value in the map is a [Path Item Object](#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 path item 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. |
+| {expression} | [Path Item Object](#path-item-object) | 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).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### 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.
+The key that identifies the [Path Item Object](#path-item-object) is a [runtime expression](#runtime-expressions) 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.
+However, using a [runtime expression](#runtime-expressions) 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:
@@ -2100,10 +2100,10 @@ transactionCallback:
description: callback successfully processed
```
-#### Example Object
+#### Example Object
An object grouping an internal or external example value with basic `summary` and `description` metadata.
-This object is typically used in properties named `examples` (plural), and is a [referenceable](#referenceObject) alternative to older `example` (singular) fields that do not support referencing or metadata.
+This object is typically used in properties named `examples` (plural), and is a [referenceable](#reference-object) alternative to older `example` (singular) fields that do not support referencing or metadata.
Examples allow demonstration of the usage of properties, parameters and objects within OpenAPI.
@@ -2111,27 +2111,27 @@ Examples allow demonstration of the usage of properties, parameters and objects
| Field Name | Type | Description |
| ------------------------------------------------ | :------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| summary | `string` | Short description for the example. |
-| description | `string` | Long description for the example. [CommonMark syntax](https://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. See the rules for resolving [Relative References](#relativeReferences). |
+| summary | `string` | Short description for the example. |
+| description | `string` | Long description for the example. [CommonMark syntax](https://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. See the rules for resolving [Relative References](#relative-references-in-urls). |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
In all cases, the example value SHOULD be compatible with the schema of its associated value.
Tooling implementations MAY choose to validate compatibility automatically, and reject the example value(s) if incompatible.
#### Working With Examples
-Example Objects can be used in both [Parameter Objects](#parameterObject) and [Media Type Objects](#mediaTypeObject).
+Example Objects can be used in both [Parameter Objects](#parameter-object) and [Media Type Objects](#media-type-object).
In both Objects, this is done through the `examples` (plural) field.
-However, there are two other ways to provide examples: The `example` (singular) field that is mutually exclusive with `examples` in both Objects, and the `example` (singular) field in the [Schema Object](#schemaObject) that appears in the `schema` field of both Objects.
+However, there are two other ways to provide examples: The `example` (singular) field that is mutually exclusive with `examples` in both Objects, and the `example` (singular) field in the [Schema Object](#schema-object) that appears in the `schema` field of both Objects.
Each of these fields has slightly different considerations.
The Schema Object's `example` field is used to show example values without regard to how they might be formatted as parameters or within media type representations.
The mutually exclusive fields in the Parameter or Media Type Objects are used to show example values which SHOULD both match the schema and be formatted as they would appear as a serialized parameter or within a media type representation.
-The exact serialization and encoding is determined by various fields in the Parameter Object, or in the Media Type Object's [Encoding Object](#encodingObject).
+The exact serialization and encoding is determined by various fields in the Parameter Object, or in the Media Type Object's [Encoding Object](#encoding-object).
Because examples using these fields represent the final serialized form of the data, they SHALL _override_ any `example` in the corresponding Schema Object.
The singular `example` field in the Parameter or Media Type object is concise and convenient for simple examples, but does not offer any other advantages over using Example Objects under `examples`.
@@ -2272,27 +2272,27 @@ application/x-www-form-urlencoded:
In this example, the JSON string had to be serialized before encoding it into the URL form value, so the example includes the quotation marks that are part of the JSON serialization, which are then URL percent-encoded.
-#### 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](#runtimeExpression) is used for accessing values in an operation and using them as parameters while invoking the linked operation.
+For computing links, and providing instructions to execute them, a [runtime expression](#runtime-expressions) 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 URI 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 description. |
-| 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 (optionally qualified with the parameter location, e.g. `path.id` for an `id` parameter in the path), whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. |
-| 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](https://spec.commonmark.org/) MAY be used for rich text representation. |
-| server | [Server Object](#serverObject) | A server object to be used by the target operation. |
+| operationRef | `string` | A relative or absolute URI reference to an OAS operation. This field is mutually exclusive of the `operationId` field, and MUST point to an [Operation Object](#operation-object). Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operation-object) in the OpenAPI description. |
+| 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}](#runtime-expressions)] | 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 (optionally qualified with the parameter location, e.g. `path.id` for an `id` parameter in the path), whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. |
+| requestBody | Any \| [{expression}](#runtime-expressions) | A literal value or [{expression}](#runtime-expressions) to use as a request body when calling the target operation. |
+| description | `string` | A description of the link. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| server | [Server Object](#server-object) | A server object to be used by the target operation. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#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 OpenAPI description.
@@ -2372,7 +2372,7 @@ solely by the existence of a relationship.
##### OperationRef Examples
As references to `operationId` MAY NOT be possible (the `operationId` is an optional
-field in an [Operation Object](#operationObject)), references MAY also be made through a relative `operationRef`:
+field in an [Operation Object](#operation-object)), references MAY also be made through a relative `operationRef`:
```yaml
links:
@@ -2397,10 +2397,10 @@ links:
Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when
using JSON Pointer, and it is necessary to URL-encode `{` and `}` as `%7B` and `%7D`, respectively when using JSON Pointer as URI fragments.
-##### 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](#linkObject) and [Callback Objects](#callbackObject).
+This mechanism is used by [Link Objects](#link-object) and [Callback Objects](#callback-object).
The runtime expression is defined by the following [ABNF](https://tools.ietf.org/html/rfc5234) syntax
@@ -2429,7 +2429,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
| Source Location | example expression | notes |
| --------------------- | :------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -2444,15 +2444,15 @@ The table below provides examples of runtime expressions and examples of their u
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
-Describes a single header for [HTTP responses](#responseHeaders) and for [individual parts in `multipart` representations](#encodingHeaders); see the relevant [Response Object](#responseObject) and [Encoding Object](#encodingObject) documentation for restrictions on which headers can be described.
+Describes a single header for [HTTP responses](#response-headers) and for [individual parts in `multipart` representations](#encoding-headers); see the relevant [Response Object](#response-object) and [Encoding Object](#encoding-object) documentation for restrictions on which headers can be described.
-The Header Object follows the structure of the [Parameter Object](#parameterObject), including determining its serialization strategy based on whether `schema` or `content` is present, with the following changes:
+The Header Object follows the structure of the [Parameter Object](#parameter-object), including determining its serialization strategy based on whether `schema` or `content` is present, 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)). This means that `allowEmptyValue` and `allowReserved` MUST NOT be used, and `style`, if used, MUST be limited to `simple`.
+1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, [`style`](#parameter-style)). This means that `allowEmptyValue` and `allowReserved` MUST NOT be used, and `style`, if used, MUST be limited to `simple`.
##### Fixed Fields
@@ -2462,40 +2462,40 @@ These fields MAY be used with either `content` or `schema`.
| Field Name | Type | Description |
| ------------------------------------------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| description | `string` | A brief description of the header. This could contain examples of use. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
-| required | `boolean` | Determines whether this header is mandatory. The default value is `false`. |
-| deprecated | `boolean` | Specifies that the header is deprecated and SHOULD be transitioned out of usage. Default value is `false`. |
+| description | `string` | A brief description of the header. This could contain examples of use. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| required | `boolean` | Determines whether this header is mandatory. The default value is `false`. |
+| deprecated | `boolean` | Specifies that the header is deprecated and SHOULD be transitioned out of usage. Default value is `false`. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
###### Fixed Fields for use with `schema`
-For simpler scenarios, a [`schema`](#headerSchema) and [`style`](#headerStyle) can describe the structure and syntax of the header.
+For simpler scenarios, a [`schema`](#header-schema) and [`style`](#header-style) can describe the structure and syntax of the header.
When `example` or `examples` are provided in conjunction with the `schema` object, the example MUST follow the prescribed serialization strategy for the header.
-Serializing with `schema` is NOT RECOMMENDED for headers with parameters (name=value pairs following a `;`) in their values, or where values might have non-URL-safe characters; see [Appendix D](#serializingHeadersAndCookies) for details.
+Serializing with `schema` is NOT RECOMMENDED for headers with parameters (name=value pairs following a `;`) in their values, or where values might have non-URL-safe characters; see [Appendix D](#appendix-d-serializing-headers-and-cookies) for details.
When `example` or `examples` are provided in conjunction with the `schema` object, the example SHOULD match the specified schema and follow the prescribed serialization strategy for the header.
The `example` and `examples` fields are mutually exclusive, and if either is present it SHALL _override_ any `example` in the schema.
| Field Name | Type | Description |
| ------------------------------------- | :--------------------------------------------------------------------------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| style | `string` | Describes how the header value will be serialized. The default (and only legal value for headers) is `simple`. |
-| explode | `boolean` | When this is true, header values of type `array` or `object` generate a single header whose value is a comma-separated list of the array items or key-value pairs of the map, see [Style Examples](#style-examples). For other data types this property has no effect. The default value is `false`. |
-| schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the header. |
-| example | Any | Example of the header's potential value; see [Working With Examples](#working-with-examples). |
-| examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the header's potential value; see [Working With Examples](#working-with-examples). |
+| style | `string` | Describes how the header value will be serialized. The default (and only legal value for headers) is `simple`. |
+| explode | `boolean` | When this is true, header values of type `array` or `object` generate a single header whose value is a comma-separated list of the array items or key-value pairs of the map, see [Style Examples](#style-examples). For other data types this property has no effect. The default value is `false`. |
+| schema | [Schema Object](#schema-object) \| [Reference Object](#reference-object) | The schema defining the type used for the header. |
+| example | Any | Example of the header's potential value; see [Working With Examples](#working-with-examples). |
+| examples | Map[ `string`, [Example Object](#example-object) \| [Reference Object](#reference-object)] | Examples of the header's potential value; see [Working With Examples](#working-with-examples). |
-See also [Appendix C: Using RFC6570 Implementations](#usingRFC6570Implementations) for additional guidance.
+See also [Appendix C: Using RFC6570 Implementations](#appendix-c-using-rfc6570-implementations) for additional guidance.
###### Fixed Fields for use with `content`
-For more complex scenarios, the [`content`](#headerContent) property can define the media type and schema of the header, as well as give examples of its use.
+For more complex scenarios, the [`content`](#header-content) property can define the media type and schema of the header, as well as give examples of its use.
Using `content` with a `text/plain` media type is RECOMMENDED for headers where the `schema` strategy is not appropriate.
| Field Name | Type | Description |
| ----------------------------------- | :--------------------------------------------------: | ----------------------------------------------------------------------------------------------------------------------------------------------- |
-| content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the header. The key is the media type and the value describes it. The map MUST only contain one entry. |
+| content | Map[`string`, [Media Type Object](#media-type-object)] | A map containing the representations for the header. The key is the media type and the value describes it. The map MUST only contain one entry. |
##### Header Object Example
@@ -2543,20 +2543,20 @@ ETag:
pattern: ^"
```
-#### Tag Object
+#### Tag Object
-Adds metadata to a single tag that is used by the [Operation Object](#operationObject).
+Adds metadata to a single tag that is used by the [Operation Object](#operation-object).
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 description for the tag. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
-| externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this tag. |
+| name | `string` | **REQUIRED**. The name of the tag. |
+| description | `string` | A description for the tag. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| externalDocs | [External Documentation Object](#external-documentation-object) | Additional external documentation for this tag. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### Tag Object Example
@@ -2572,7 +2572,7 @@ name: pet
description: Pets operations
```
-#### Reference Object
+#### Reference Object
A simple object to allow referencing other components in the OpenAPI document, internally and externally.
@@ -2584,7 +2584,7 @@ For this specification, reference resolution is accomplished as defined by the J
| Field Name | Type | Description |
| ------------------------------- | :------: | ----------------------------------- |
-| $ref | `string` | **REQUIRED**. The reference string. |
+| $ref | `string` | **REQUIRED**. The reference string. |
This object cannot be extended with additional properties and any properties added SHALL be ignored.
@@ -2624,7 +2624,7 @@ $ref: Pet.yaml
$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.
@@ -2657,18 +2657,18 @@ The following properties are taken directly from the JSON Schema definition and
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. Consistent with JSON Schema, `additionalProperties` defaults to `true`.
+* allOf - Inline or referenced schema MUST be of a [Schema Object](#schema-object) and not a standard JSON Schema.
+* oneOf - Inline or referenced schema MUST be of a [Schema Object](#schema-object) and not a standard JSON Schema.
+* anyOf - Inline or referenced schema MUST be of a [Schema Object](#schema-object) and not a standard JSON Schema.
+* not - Inline or referenced schema MUST be of a [Schema Object](#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](#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](#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](#schema-object) and not a standard JSON Schema. Consistent with JSON Schema, `additionalProperties` defaults to `true`.
* description - [CommonMark syntax](https://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.
+* format - See [Data Type Formats](#data-type-format) 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.
+Alternatively, any time a Schema Object can be used, a [Reference Object](#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.
@@ -2678,35 +2678,35 @@ Other than the JSON Schema subset fields, the following fields MAY be used for f
| Field Name | Type | Description |
| ----------------------------------------------- | :-----------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| nullable | `boolean` | A `true` value adds `"null"` to the allowed type specified by the `type` keyword, only if `type` is explicitly defined within the same Schema Object. Other Schema Object constraints retain their defined behavior, and therefore may disallow the use of `null` as a value. A `false` value leaves the specified or default `type` unmodified. The default value is `false`. |
-| discriminator | [Discriminator Object](#discriminatorObject) | Adds support for polymorphism. The discriminator is used to determine which of a set of schemas a payload is expected to satisfy. 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`. |
+| nullable | `boolean` | A `true` value adds `"null"` to the allowed type specified by the `type` keyword, only if `type` is explicitly defined within the same Schema Object. Other Schema Object constraints retain their defined behavior, and therefore may disallow the use of `null` as a value. A `false` value leaves the specified or default `type` unmodified. The default value is `false`. |
+| discriminator | [Discriminator Object](#discriminator-object) | Adds support for polymorphism. The discriminator is used to determine which of a set of schemas a payload is expected to satisfy. See [Composition and Inheritance](#composition-and-inheritance-polymorphism) 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](#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](#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](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#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.
-To support polymorphism, the OpenAPI Specification adds the [`discriminator`](#schemaDiscriminator) field.
+To support polymorphism, the OpenAPI Specification adds the [`discriminator`](#schema-discriminator) field.
When used, the `discriminator` indicates the name of the property that hints which schema definition is expected to validate 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](#discriminatorMapping) by overriding the property with a new value. If a new value exists, this takes precedence over the schema name.
+* [Override the schema name](#discriminator-mapping) by overriding the property with a new value. If a new value exists, this takes precedence over the schema name.
###### 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.
+The [xml](#schema-xml) property allows extra definitions when translating the JSON definition to XML.
+The [XML Object](#xml-object) contains additional information about the available options.
##### Schema Object Examples
@@ -3015,7 +3015,7 @@ components:
- packSize
```
-#### Discriminator Object
+#### Discriminator Object
When request bodies or response payloads may be one of a number of different schemas, a Discriminator Object gives a hint about the expected schema of the document.
This hint can be used to aid in serialization, deserialization, and validation.
@@ -3027,8 +3027,8 @@ Note that `discriminator` MUST NOT change the validation outcome of the schema.
| Field Name | Type | Description |
| ------------------------------------------- | :---------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminating value. This property SHOULD be required in the payload schema, as the behavior when the property is absent is undefined. |
-| mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or URI references. |
+| propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminating value. This property SHOULD be required in the payload schema, as the behavior when the property is absent is undefined. |
+| mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or URI references. |
##### Conditions for Using the Discriminator Object
@@ -3037,7 +3037,7 @@ The Discriminator Object is legal only when using one of the composite keywords
In both the `oneOf` and `anyOf` use cases, where those keywords are adjacent to `discriminator`, all possible schemas MUST be listed explicitly.
To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas building on the parent schema via an `allOf` construct may be used as an alternate schema.
-It is implementation-defined as to whether all named [Schema Objects](#schemaObject) under the [Components Object](#componentsObject), or only those that are otherwise directly referenced are searched for `allOf` references to the parent schema.
+It is implementation-defined as to whether all named [Schema Objects](#schema-object) under the [Components Object](#components-object), or only those that are otherwise directly referenced are searched for `allOf` references to the parent schema.
However, it is RECOMMENDED to search all named schemas in the Components Object because it is common with the `allOf` usage for other parts of the API to only directly reference the parent schema.
The `allOf` form of `discriminator` is _only_ useful for non-validation use cases; validation with the parent schema with this form of `discriminator` _does not_ perform a search for child schemas or use them in validation in any way.
@@ -3047,7 +3047,7 @@ The behavior of any configuration of `oneOf`, `anyOf`, `allOf` and `discriminato
##### Options for Mapping Values to Schemas
-The value of the property named in `propertyName` is used as the name of the associated schema under the [Components Object](#componentsObject), _unless_ a `mapping` is present for that value.
+The value of the property named in `propertyName` is used as the name of the associated schema under the [Components Object](#components-object), _unless_ a `mapping` is present for that value.
The `mapping` entry maps a specific property value to either a different schema component name, or to a schema identified by a URI.
When using implicit or explicit schema component names, inline `oneOf` or `anyOf` subschemas are not considered.
The behavior of a `mapping` value that is both a valid schema name and a valid relative URI reference is implementation-defined, but it is RECOMMENDED that it be treated as a schema name.
@@ -3056,9 +3056,9 @@ To ensure that an ambiguous value (e.g. `"foo"`) is treated as a relative URI re
Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison.
However, the exact nature of such conversions are implementation-defined.
-##### Examples
+##### Examples
-For these examples, assume all schemas are in the entry OpenAPI document; for handling of `discriminator` in referenced documents see [Resolving Implicit Connections](#resolvingImplicitConnections).
+For these examples, assume all schemas are in the entry OpenAPI document; for handling of `discriminator` in referenced documents see [Resolving Implicit Connections](#resolving-implicit-connections).
In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:
@@ -3175,7 +3175,7 @@ will indicate that the `#/components/schemas/Cat` schema is expected to match. L
will map to `#/components/schemas/Dog` because the `dog` entry in the `mapping` element maps to `Dog` which is the schema name for `#/components/schemas/Dog`.
-#### XML Object
+#### XML Object
A metadata object that allows for more fine-tuned XML model definitions.
@@ -3186,13 +3186,13 @@ See examples for expected behavior.
| 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 a non-relative 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, `form‑urlencoded
|
| [RFC1866](https://datatracker.ietf.org/doc/html/rfc1866#section-8.2.1) | 11/1995 | content-based serialization | [[RFC1738]] | obsoleted by [[HTML401]] [Section 17.13.4.1](https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1), [[URL]] [Section 5](https://url.spec.whatwg.org/#urlencoded-serializing) |
-Style-based serialization is used in the [Parameter Object](#parameterObject) when `schema` is present, and in the [Encoding Object](#encodingObject) when at least one of `style`, `explode`, or `allowReserved` is present.
-See [Appendix C](#usingRFC6570Implementations) for more details of RFC6570's two different approaches to percent-encoding, including an example involving `+`.
+Style-based serialization is used in the [Parameter Object](#parameter-object) when `schema` is present, and in the [Encoding Object](#encoding-object) when at least one of `style`, `explode`, or `allowReserved` is present.
+See [Appendix C](#appendix-c-using-rfc6570-implementations) for more details of RFC6570's two different approaches to percent-encoding, including an example involving `+`.
-Content-based serialization is defined by the [Media Type Object](#mediaTypeObject), and used with the [Parameter Object](#parameterObject) when the `content` field is present, and with the [Encoding Object](#encodingObject) based on the `contentType` field when the style fields listed in the previous section are absent.
+Content-based serialization is defined by the [Media Type Object](#media-type-object), and used with the [Parameter Object](#parameter-object) when the `content` field is present, and with the [Encoding Object](#encoding-object) based on the `contentType` field when the style fields listed in the previous section are absent.
Each part is encoded based on the media type (e.g. `text/plain` or `application/json`), and must then be percent-encoded for use in a `form-urlencoded` string.
Note that content-based serialization for `form-data` does not expect or require percent-encoding in the data, only in per-part header values.
@@ -4318,3 +4318,4 @@ Code that relies on leaving these delimiters unencoded, while using regular perc
For maximum interoperability, it is RECOMMENDED to either define and document an additional escape convention while percent-encoding the delimiters for these styles, or to avoid these styles entirely.
The exact method of additional encoding/escaping is left to the API designer, and is expected to be performed before serialization and encoding described in this specification, and reversed after this specification's encoding and serialization steps are reversed.
This keeps it outside of the processes governed by this specification.
+
From 0a92fa6b80d27f61dd44ea97ba2c5b2c30ac2ffd Mon Sep 17 00:00:00 2001
From: Lorna Mitchell
`format: binary` | `contentMediaType: image/png` | if redundant, can be omitted, often resulting in an empty Schema Object
-`type: string`
`format: byte` | `type: string`
`contentMediaType: image/png`
`contentEncoding: base64` | note that `base64url` can be used to avoid re-encoding the base64 string to be URL-safe
+The following table shows how to migrate from OAS 3.0 binary data descriptions, continuing to use `image/png` as the example binary media type:
+| OAS < 3.1 | OAS 3.1 | Comments |
+| ------------------------------------ | -------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
+| `type: string`
`format: binary` | `contentMediaType: image/png` | if redundant, can be omitted, often resulting in an empty Schema Object |
+| `type: string`
`format: byte` | `type: string`
`contentMediaType: image/png`
`contentEncoding: base64` | note that `base64url` can be used to avoid re-encoding the base64 string to be URL-safe |
### 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](https://spec.commonmark.org/0.27/). Tooling MAY choose to ignore some CommonMark or extension features to address security concerns.
+Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown syntax as described by [CommonMark 0.27](https://spec.commonmark.org/0.27/). Tooling MAY choose to ignore some CommonMark or extension features to address security concerns.
While the framing of CommonMark 0.27 as a minimum requirement means that tooling MAY choose to implement extensions on top of it, note that any such extensions are by definition implementation-defined and will not be interoperable.
OpenAPI Description authors SHOULD consider how text using such extensions will be rendered by tools that offer only the minimum support.
-
### Relative References in API Description URIs
-URIs used as references within an OpenAPI Description, or to external documentation or other supplementary information such as a license, are resolved as _identifiers_, and described by this specification as ***URIs***.
+URIs used as references within an OpenAPI Description, or to external documentation or other supplementary information such as a license, are resolved as _identifiers_, and described by this specification as **_URIs_**.
As noted under [Parsing Documents](#parsingDocuments), this specification inherits JSON Schema draft 2020-12's requirements for loading documents and associating them with their expected URIs, which might not match their current location.
This feature is used both for working in development or test environments without having to change the URIs, and for working within restrictive network configurations or security policies.
@@ -326,11 +333,11 @@ Relative references in [Schema Objects](#schemaObject), including any that appea
Relative URI references in other Objects, and in Schema Objects where no parent schema contains an `$id`, MUST be resolved using the referring document's base URI, which is determined in accordance with [RFC3986 §5.1.2 – 5.1.4](https://tools.ietf.org/html/rfc3986#section-5.1.2).
In practice, this is usually the retrieval URI of the document, which MAY be determined based on either its current actual location or a user-supplied expected location.
-If a URI contains a fragment identifier, then the fragment should be resolved per the fragment resolution mechanism of the referenced document. If the representation of the referenced document is JSON or YAML, then the fragment identifier SHOULD be interpreted as a JSON-Pointer as per [RFC6901](https://tools.ietf.org/html/rfc6901).
+If a URI contains a fragment identifier, then the fragment should be resolved per the fragment resolution mechanism of the referenced document. If the representation of the referenced document is JSON or YAML, then the fragment identifier SHOULD be interpreted as a JSON-Pointer as per [RFC6901](https://tools.ietf.org/html/rfc6901).
### Relative References in API URLs
-API endpoints are by definition accessed as locations, and are described by this specification as ***URLs***.
+API endpoints are by definition accessed as locations, and are described by this specification as **_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).
Unless specified otherwise, relative references are resolved using the URLs defined in the [Server Object](#serverObject) as a Base URL. Note that these themselves MAY be relative to the referring document.
@@ -352,18 +359,18 @@ This is the root object of the [OpenAPI document](#oasDocument).
##### Fixed Fields
-Field Name | Type | Description
----|:---:|---
-openapi | `string` | **REQUIRED**. This string MUST be the [version number](#versions) of the OpenAPI Specification that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling 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.
- jsonSchemaDialect | `string` | The default value for the `$schema` keyword within [Schema Objects](#schemaObject) contained within this OAS document. This MUST be in the form of a URI.
-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) | The available paths and operations for the API.
-webhooks | Map[`string`, [Path Item Object](#pathItemObject)] | The incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. Closely related to the `callbacks` feature, this section describes requests initiated other than by an API call, for example by an out of band registration. The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses. An [example](../examples/v3.1/webhook-example.yaml) is available.
-components | [Components Object](#componentsObject) | An element to hold various schemas for the document.
-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. To make security optional, an empty security requirement (`{}`) can be included in the array.
-tags | [[Tag Object](#tagObject)] | A list of tags used by the document 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.
+| Field Name | Type | Description |
+| ----------------------------------------------------- | :-----------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| openapi | `string` | **REQUIRED**. This string MUST be the [version number](#versions) of the OpenAPI Specification that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling 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. |
+| jsonSchemaDialect | `string` | The default value for the `$schema` keyword within [Schema Objects](#schemaObject) contained within this OAS document. This MUST be in the form of a URI. |
+| 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) | The available paths and operations for the API. |
+| webhooks | Map[`string`, [Path Item Object](#pathItemObject)] | The incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. Closely related to the `callbacks` feature, this section describes requests initiated other than by an API call, for example by an out of band registration. The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses. An [example](../examples/v3.1/webhook-example.yaml) is available. |
+| components | [Components Object](#componentsObject) | An element to hold various schemas for the document. |
+| 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. To make security optional, an empty security requirement (`{}`) can be included in the array. |
+| tags | [[Tag Object](#tagObject)] | A list of tags used by the document 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).
@@ -374,16 +381,15 @@ The metadata MAY be used by the clients if needed, and MAY be presented in editi
##### Fixed Fields
-Field Name | Type | Description
----|:---:|---
-title | `string` | **REQUIRED**. The title of the API.
-summary | `string` | A short summary of the API.
-description | `string` | A description of the API. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
-termsOfService | `string` | A URI for the Terms of Service for the API. This MUST be in the form of a URI.
-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 version of the API being described).
-
+| Field Name | Type | Description |
+| ----------------------------------------------- | :------------------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| title | `string` | **REQUIRED**. The title of the API. |
+| summary | `string` | A short summary of the API. |
+| description | `string` | A description of the API. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| termsOfService | `string` | A URI for the Terms of Service for the API. This MUST be in the form of a URI. |
+| 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 version of the API being described). |
This object MAY be extended with [Specification Extensions](#specificationExtensions).
@@ -429,11 +435,11 @@ 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 URI for the contact information. This MUST be in the form of a URI.
-email | `string` | The email address of the contact person/organization. This MUST be in the form of an email address.
+| Field Name | Type | Description |
+| -------------------------------- | :------: | --------------------------------------------------------------------------------------------------- |
+| name | `string` | The identifying name of the contact person/organization. |
+| url | `string` | The URI for the contact information. This MUST be in the form of a URI. |
+| email | `string` | The email address of the contact person/organization. This MUST be in the form of an email address. |
This object MAY be extended with [Specification Extensions](#specificationExtensions).
@@ -459,11 +465,11 @@ License information for the exposed API.
##### Fixed Fields
-Field Name | Type | Description
----|:---:|---
-name | `string` | **REQUIRED**. The license name used for the API.
-identifier | `string` | An [SPDX](https://spdx.org/spdx-specification-21-web-version#h.jxpfx0ykyb60) license expression for the API. The `identifier` field is mutually exclusive of the `url` field.
-url | `string` | A URI for the license used for the API. This MUST be in the form of a URI. The `url` field is mutually exclusive of the `identifier` field.
+| Field Name | Type | Description |
+| ------------------------------------------ | :------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| name | `string` | **REQUIRED**. The license name used for the API. |
+| identifier | `string` | An [SPDX](https://spdx.org/spdx-specification-21-web-version#h.jxpfx0ykyb60) license expression for the API. The `identifier` field is mutually exclusive of the `url` field. |
+| url | `string` | A URI for the license used for the API. This MUST be in the form of a URI. The `url` field is mutually exclusive of the `identifier` field. |
This object MAY be extended with [Specification Extensions](#specificationExtensions).
@@ -487,11 +493,11 @@ 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](https://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.
+| 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](https://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).
@@ -534,12 +540,12 @@ The following shows how multiple servers can be described, for example, at the O
```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
+ - 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:
@@ -556,10 +562,7 @@ The following shows how variables can be used for a server configuration:
"description": "this value is assigned by the service provider, in this example `gigantic-server.com`"
},
"port": {
- "enum": [
- "8443",
- "443"
- ],
+ "enum": ["8443", "443"],
"default": "8443"
},
"basePath": {
@@ -573,35 +576,34 @@ The following shows how variables can be used for a server configuration:
```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
+ - 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. The array MUST NOT be empty.
-default | `string` | **REQUIRED**. The default value to use for substitution, which SHALL be sent if an alternate value is _not_ supplied. Note this behavior is different than the [Schema Object's](#schemaObject) treatment of default values, because in those cases parameter values are optional. If the [`enum`](#serverVariableEnum) is defined, the value MUST exist in the enum's values.
-description | `string` | An optional description for the server variable. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
+| Field Name | Type | Description |
+| --------------------------------------------------- | :--------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| enum | [`string`] | An enumeration of string values to be used if the substitution options are from a limited set. The array MUST NOT be empty. |
+| default | `string` | **REQUIRED**. The default value to use for substitution, which SHALL be sent if an alternate value is _not_ supplied. Note this behavior is different than the [Schema Object's](#schemaObject) treatment of default values, because in those cases parameter values are optional. If the [`enum`](#serverVariableEnum) is defined, the value MUST exist in the enum's values. |
+| description | `string` | An optional description for the server variable. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
This object MAY be extended with [Specification Extensions](#specificationExtensions).
@@ -610,22 +612,20 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
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)] | 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).
- pathItems | Map[`string`, [Path Item Object](#pathItemObject)] | An object to hold reusable [Path Item Objects](#pathItemObject).
-
+| Field Name | Type | Description |
+| -------------------------------------------------------- | :----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
+| schemas | Map[`string`, [Schema Object](#schemaObject)] | 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). |
+| pathItems | Map[`string`, [Path Item Object](#pathItemObject)] | An object to hold reusable [Path Item Objects](#pathItemObject). |
This object MAY be extended with [Specification Extensions](#specificationExtensions).
@@ -818,13 +818,13 @@ components:
#### 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 Object MAY be empty, due to [Access Control List (ACL) constraints](#securityFiltering).
+The path is appended to the URL from the [Server Object](#serverObject) in order to construct the full URL. The Paths Object MAY be empty, due to [Access Control List (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 forward 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.
+| Field Pattern | Type | Description |
+| ------------------------------- | :---------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| /{path} | [Path Item Object](#pathItemObject) | A relative path to an individual endpoint. The field name MUST begin with a forward 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).
@@ -901,22 +901,21 @@ The path itself is still exposed to the documentation viewer but they will not k
##### Fixed Fields
-Field Name | Type | Description
----|:---:|---
-$ref | `string` | Allows for a referenced definition of this path item. The value MUST be in the form of a URI, and the referenced structure MUST be in the form of a [Path Item Object](#pathItemObject). In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined. See the rules for resolving [Relative References](#relativeReferencesURI).
_**Note:** The behavior of `$ref` with adjacent properties is likely to change in future versions of this specification to bring it into closer alignment with the behavior of the [Reference Object](#referenceObject)._
-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](https://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. If an alternative server object is specified at the Root level, it will be overridden by this value.
-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).
-
+| Field Name | Type | Description |
+| --------------------------------------------- | :----------------------------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| $ref | `string` | Allows for a referenced definition of this path item. The value MUST be in the form of a URI, and the referenced structure MUST be in the form of a [Path Item Object](#pathItemObject). In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined. See the rules for resolving [Relative References](#relativeReferencesURI).
_**Note:** The behavior of `$ref` with adjacent properties is likely to change in future versions of this specification to bring it into closer alignment with the behavior of the [Reference Object](#referenceObject)._ |
+| 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](https://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. If an alternative server object is specified at the Root level, it will be overridden by this value. |
+| 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).
@@ -993,15 +992,15 @@ get:
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
+ - name: id
+ in: path
+ description: ID of pet to use
+ required: true
+ schema:
+ type: array
+ items:
+ type: string
+ style: simple
```
#### Operation Object
@@ -1010,20 +1009,20 @@ 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](https://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. The operationId value is **case-sensitive**. 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 fully 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 (such as [GET](https://tools.ietf.org/html/rfc7231#section-4.3.1), [HEAD](https://tools.ietf.org/html/rfc7231#section-4.3.2) and [DELETE](https://tools.ietf.org/html/rfc7231#section-4.3.5)), `requestBody` is permitted but does not have well-defined semantics and SHOULD be avoided if possible.
-responses | [Responses Object](#responsesObject) | 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.
-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. To make security optional, an empty security requirement (`{}`) can be included in the array. 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.
+| 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](https://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. The operationId value is **case-sensitive**. 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 fully 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 (such as [GET](https://tools.ietf.org/html/rfc7231#section-4.3.1), [HEAD](https://tools.ietf.org/html/rfc7231#section-4.3.2) and [DELETE](https://tools.ietf.org/html/rfc7231#section-4.3.5)), `requestBody` is permitted but does not have well-defined semantics and SHOULD be avoided if possible. |
+| responses | [Responses Object](#responsesObject) | 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. |
+| 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. To make security optional, an empty security requirement (`{}`) can be included in the array. 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).
@@ -1031,9 +1030,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
```json
{
- "tags": [
- "pet"
- ],
+ "tags": ["pet"],
"summary": "Updates a pet in the store with form data",
"operationId": "updatePetWithForm",
"parameters": [
@@ -1085,10 +1082,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
},
"security": [
{
- "petstore_auth": [
- "write:pets",
- "read:pets"
- ]
+ "petstore_auth": ["write:pets", "read:pets"]
}
]
}
@@ -1096,30 +1090,30 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
```yaml
tags:
-- pet
+ - 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
+ - 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
+ 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.
@@ -1132,22 +1126,21 @@ responses:
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.
##### Fixed Fields
-Field Name | Type | Description
----|:---:|---
-description | `string` | A description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
-url | `string` | **REQUIRED**. The URI for the target documentation. This MUST be in the form of a URI.
+| Field Name | Type | Description |
+| ------------------------------------------------ | :------: | -------------------------------------------------------------------------------------------------------------------------------------- |
+| description | `string` | A description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| url | `string` | **REQUIRED**. The URI for the target documentation. This MUST be in the form of a URI. |
This object MAY be extended with [Specification Extensions](#specificationExtensions).
@@ -1174,11 +1167,13 @@ A unique parameter is defined by a combination of a [name](#parameterName) and [
See [Appendix E](#percentEncodingAndFormMediaTypes) for a detailed examination of percent-encoding concerns, including interactions with the `application/x-www-form-urlencoded` query string format.
##### 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.
+
+- 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
@@ -1190,14 +1185,14 @@ See [Appendix B](#dataTypeConversion) for a discussion of converting values of v
These fields MAY be used with either `content` or `schema`.
-Field Name | Type | Description
----|:---:|---
-name | `string` | **REQUIRED**. The name of the parameter. Parameter names are *case sensitive*.
-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](https://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. Default value is `false`.
- allowEmptyValue | `boolean` | If `true`, clients MAY pass a zero-length string value in place of parameters that would otherwise be omitted entirely, which the server SHOULD interpret as the parameter being unused. Default value is `false`. If [`style`](#parameterStyle) is used, and if [behavior is _n/a_ (cannot be serialized)](#style-examples), the value of `allowEmptyValue` SHALL be ignored. Interactions between this field and the parameter's [Schema Object](#schemaObject) are implementation-defined. This field is valid only for `query` parameters. Use of this property is NOT RECOMMENDED, and it is likely to be removed in a later revision.
+| Field Name | Type | Description |
+| ------------------------------------------------------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| name | `string` | **REQUIRED**. The name of the parameter. Parameter names are _case sensitive_.
|
+| 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](https://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. Default value is `false`. |
+| allowEmptyValue | `boolean` | If `true`, clients MAY pass a zero-length string value in place of parameters that would otherwise be omitted entirely, which the server SHOULD interpret as the parameter being unused. Default value is `false`. If [`style`](#parameterStyle) is used, and if [behavior is _n/a_ (cannot be serialized)](#style-examples), the value of `allowEmptyValue` SHALL be ignored. Interactions between this field and the parameter's [Schema Object](#schemaObject) are implementation-defined. This field is valid only for `query` parameters. Use of this property is NOT RECOMMENDED, and it is likely to be removed in a later revision. |
This object MAY be extended with [Specification Extensions](#specificationExtensions).
@@ -1211,14 +1206,14 @@ The `example` and `examples` fields are mutually exclusive, and if either is pre
Serializing with `schema` is NOT RECOMMENDED for `in: cookie` parameters, `in: header` parameters that use HTTP header parameters (name=value pairs following a `;`) in their values, or `in: header` parameters where values might have non-URL-safe characters; see [Appendix D](#serializingHeadersAndCookies) for details.
-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`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject` is undefined.
-allowReserved | `boolean` | When this is true, parameter values are serialized using reserved expansion, as defined by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#autoid-20), which allows [RFC3986's reserved character set](https://datatracker.ietf.org/doc/html/rfc3986#autoid-13), as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#autoid-24) (`[`, `]`, `#`), or have a special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see Appendices [C](#usingRFC6570Implementations) and [E](#percentEncodingAndFormMediaTypes) for details. This property only applies to parameters with an `in` value of `query`. The default value is `false`.
-schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter.
-example | Any | Example of the parameter's potential value; see [Working With Examples](#working-with-examples).
-examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the parameter's potential value; see [Working With Examples](#working-with-examples).
+| 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`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject` is undefined. |
+| allowReserved | `boolean` | When this is true, parameter values are serialized using reserved expansion, as defined by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#autoid-20), which allows [RFC3986's reserved character set](https://datatracker.ietf.org/doc/html/rfc3986#autoid-13), as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#autoid-24) (`[`, `]`, `#`), or have a special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see Appendices [C](#usingRFC6570Implementations) and [E](#percentEncodingAndFormMediaTypes) for details. This property only applies to parameters with an `in` value of `query`. The default value is `false`. |
+| schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. |
+| example | Any | Example of the parameter's potential value; see [Working With Examples](#working-with-examples). |
+| examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the parameter's potential value; see [Working With Examples](#working-with-examples). |
See also [Appendix C: Using RFC6570 Implementations](#usingRFC6570Implementations) for additional guidance.
@@ -1227,23 +1222,23 @@ See also [Appendix C: Using RFC6570 Implementations](#usingRFC6570Implementation
For more complex scenarios, the [`content`](#parameterContent) property can define the media type and schema of the parameter, as well as give examples of its use.
Using `content` with a `text/plain` media type is RECOMMENDED for `in: header` and `in: cookie` parameters where the `schema` strategy is not appropriate.
-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.
+| 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)
-simple | `primitive`, `array`, `object` | `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.
-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.
-spaceDelimited | `array`, `object` | `query` | Space separated array values or object properties and values. This option replaces `collectionFormat` equal to `ssv` from OpenAPI 2.0.
-pipeDelimited | `array`, `object` | `query` | Pipe separated array values or object properties and values. This option replaces `collectionFormat` equal to `pipes` from OpenAPI 2.0.
-deepObject | `object` | `query` | Allows objects with scalar properties to be represented using form parameters. The representation of array or object properties is not 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) |
+| simple | `primitive`, `array`, `object` | `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. |
+| 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. |
+| spaceDelimited | `array`, `object` | `query` | Space separated array values or object properties and values. This option replaces `collectionFormat` equal to `ssv` from OpenAPI 2.0. |
+| pipeDelimited | `array`, `object` | `query` | Pipe separated array values or object properties and values. This option replaces `collectionFormat` equal to `pipes` from OpenAPI 2.0. |
+| deepObject | `object` | `query` | Allows objects with scalar properties to be represented using form parameters. The representation of array or object properties is not defined. |
See [Appendix E](#percentEncodingAndFormMediaTypes) for a discussion of percent-encoding, including when delimiters need to be percent-encoded and options for handling collisions with percent-encoded data.
@@ -1259,29 +1254,29 @@ Assume a parameter named `color` has one of the following values:
The following table shows examples, as would be shown with the `example` or `examples` keywords, of the different serializations for each value.
-* The value _empty_ denotes the empty string, and is unrelated to the `allowEmptyValue` field
-* The behavior of combinations marked _n/a_ is undefined
-* The `undefined` replaces the `empty` column in previous versions of this specification in order to better align with [RFC6570 §2.3](https://www.rfc-editor.org/rfc/rfc6570.html#section-2.3) terminology, which describes certain values including but not limited to `null` as "undefined" values with special handling; notably, the empty string is _not_ undefined
-* For `form` and the non-RFC6570 query string styles `spaceDelimited`, `pipeDelimited`, and `deepObject`, each example is shown prefixed with `?` as if it were the only query parameter; see [Appendix C](#usingRFC6570Implementations) for more information on constructing query strings from multiple parameters, and [Appendix D](#serializingHeadersAndCookies) for warnings regarding `form` and cookie parameters
-* Note that the `?` prefix is not appropriate for serializing `application/x-www-form-urlencoded` HTTP message bodies, and MUST be stripped or (if constructing the string manually) not added when used in that context; see the [Encoding Object](#encodingObject) for more information
-* The examples are percent-encoded as required by RFC6570 and RFC3986; see [Appendix E](#percentEncodingAndFormMediaTypes) for a thorough discussion of percent-encoding concerns, including why unencoded `|` (`%7C`), `[` (`%5B`), and `]` (`%5D`) seem to work in some environments despite not being compliant.
-
-[`style`](#styleValues) | `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
-simple | false | _empty_ | blue | blue,black,brown | R,100,G,200,B,150
-simple | true | _empty_ | 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
-spaceDelimited | false | _n/a_ | _n/a_ | ?color=blue%20black%20brown | ?color=R%20100%20G%20200%20B%20150
-spaceDelimited | true | _n/a_ | _n/a_ | _n/a_ | _n/a_
-pipeDelimited | false | _n/a_ | _n/a_ | ?color=blue%7Cblack%7Cbrown | ?color=R%7C100%7CG%7C200%7CB%7C150
-pipeDelimited | true | _n/a_ | _n/a_ | _n/a_ | _n/a_
-deepObject | false | _n/a_ | _n/a_ | _n/a_ | _n/a_
-deepObject | true | _n/a_ | _n/a_ | _n/a_ | ?color%5BR%5D=100&color%5BG%5D=200&color%5BB%5D=150
+- The value _empty_ denotes the empty string, and is unrelated to the `allowEmptyValue` field
+- The behavior of combinations marked _n/a_ is undefined
+- The `undefined` replaces the `empty` column in previous versions of this specification in order to better align with [RFC6570 §2.3](https://www.rfc-editor.org/rfc/rfc6570.html#section-2.3) terminology, which describes certain values including but not limited to `null` as "undefined" values with special handling; notably, the empty string is _not_ undefined
+- For `form` and the non-RFC6570 query string styles `spaceDelimited`, `pipeDelimited`, and `deepObject`, each example is shown prefixed with `?` as if it were the only query parameter; see [Appendix C](#usingRFC6570Implementations) for more information on constructing query strings from multiple parameters, and [Appendix D](#serializingHeadersAndCookies) for warnings regarding `form` and cookie parameters
+- Note that the `?` prefix is not appropriate for serializing `application/x-www-form-urlencoded` HTTP message bodies, and MUST be stripped or (if constructing the string manually) not added when used in that context; see the [Encoding Object](#encodingObject) for more information
+- The examples are percent-encoded as required by RFC6570 and RFC3986; see [Appendix E](#percentEncodingAndFormMediaTypes) for a thorough discussion of percent-encoding concerns, including why unencoded `|` (`%7C`), `[` (`%5B`), and `]` (`%5D`) seem to work in some environments despite not being compliant.
+
+| [`style`](#styleValues) | `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 |
+| simple | false | _empty_ | blue | blue,black,brown | R,100,G,200,B,150 |
+| simple | true | _empty_ | 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 |
+| spaceDelimited | false | _n/a_ | _n/a_ | ?color=blue%20black%20brown | ?color=R%20100%20G%20200%20B%20150 |
+| spaceDelimited | true | _n/a_ | _n/a_ | _n/a_ | _n/a_ |
+| pipeDelimited | false | _n/a_ | _n/a_ | ?color=blue%7Cblack%7Cbrown | ?color=R%7C100%7CG%7C200%7CB%7C150 |
+| pipeDelimited | true | _n/a_ | _n/a_ | _n/a_ | _n/a_ |
+| deepObject | false | _n/a_ | _n/a_ | _n/a_ | _n/a_ |
+| deepObject | true | _n/a_ | _n/a_ | _n/a_ | ?color%5BR%5D=100&color%5BG%5D=200&color%5BB%5D=150 |
##### Parameter Object Examples
@@ -1318,6 +1313,7 @@ style: simple
```
A path parameter of a string value:
+
```json
{
"name": "username",
@@ -1340,6 +1336,7 @@ schema:
```
An optional query parameter of a string value, allowing multiple values by repeating the query parameter:
+
```json
{
"name": "id",
@@ -1371,6 +1368,7 @@ explode: true
```
A free-form query parameter, allowing undefined parameters of a specific type:
+
```json
{
"in": "query",
@@ -1379,7 +1377,7 @@ A free-form query parameter, allowing undefined parameters of a specific type:
"type": "object",
"additionalProperties": {
"type": "integer"
- },
+ }
},
"style": "form"
}
@@ -1405,10 +1403,7 @@ A complex parameter using `content` to define serialization:
"application/json": {
"schema": {
"type": "object",
- "required": [
- "lat",
- "long"
- ],
+ "required": ["lat", "long"],
"properties": {
"lat": {
"type": "number"
@@ -1445,18 +1440,19 @@ content:
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](https://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`.
+| Field Name | Type | Description |
+| ------------------------------------------------ | :--------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](https://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 schema definition.
+
```json
{
"description": "user to add to the system",
@@ -1466,7 +1462,7 @@ A request body with a referenced schema definition.
"$ref": "#/components/schemas/User"
},
"examples": {
- "user" : {
+ "user": {
"summary": "User Example",
"externalValue": "https://foo.bar/examples/user-example.json"
}
@@ -1477,7 +1473,7 @@ A request body with a referenced schema definition.
"$ref": "#/components/schemas/User"
},
"examples": {
- "user" : {
+ "user": {
"summary": "User example in XML",
"externalValue": "https://foo.bar/examples/user-example.xml"
}
@@ -1485,7 +1481,7 @@ A request body with a referenced schema definition.
},
"text/plain": {
"examples": {
- "user" : {
+ "user": {
"summary": "User example in Plain text",
"externalValue": "https://foo.bar/examples/user-example.txt"
}
@@ -1493,7 +1489,7 @@ A request body with a referenced schema definition.
},
"*/*": {
"examples": {
- "user" : {
+ "user": {
"summary": "User example in other format",
"externalValue": "https://foo.bar/examples/user-example.whatever"
}
@@ -1533,6 +1529,7 @@ content:
```
#### Media Type Object
+
Each Media Type Object provides schema and examples for the media type identified by its key.
When `example` or `examples` are provided, the example SHOULD match the specified schema and be in the correct format as specified by the media type and its encoding.
@@ -1540,12 +1537,13 @@ The `example` and `examples` fields are mutually exclusive, and if either is pre
See [Working With Examples](#working-with-examples) for further guidance regarding the different ways of specifying examples, including non-JSON/YAML values.
##### Fixed Fields
-Field Name | Type | Description
----|:---:|---
-schema | [Schema Object](#schemaObject) | The schema defining the content of the request, response, parameter, or header.
-example | Any | Example of the media type; see [Working With Examples](#working-with-examples).
-examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type; see [Working With Examples](#working-with-examples).
-encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and information providing more control over the serialization of the value. The key, being the property name, MUST exist in the schema as a property. The encoding attribute SHALL only apply to [Request Body Objects](#requestBodyObject), and only when the media type is `multipart` or `application/x-www-form-urlencoded`. If no Encoding Object is provided for a property, the behavior is determined by the default values documented for the Encoding Object.
+
+| Field Name | Type | Description |
+| ---------------------------------------- | :--------------------------------------------------------------------------------------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| schema | [Schema Object](#schemaObject) | The schema defining the content of the request, response, parameter, or header. |
+| example | Any | Example of the media type; see [Working With Examples](#working-with-examples). |
+| examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type; see [Working With Examples](#working-with-examples). |
+| encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and information providing more control over the serialization of the value. The key, being the property name, MUST exist in the schema as a property. The encoding attribute SHALL only apply to [Request Body Objects](#requestBodyObject), and only when the media type is `multipart` or `application/x-www-form-urlencoded`. If no Encoding Object is provided for a property, the behavior is determined by the default values documented for the Encoding Object. |
This object MAY be extended with [Specification Extensions](#specificationExtensions).
@@ -1558,7 +1556,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
"$ref": "#/components/schemas/Pet"
},
"examples": {
- "cat" : {
+ "cat": {
"summary": "An example of a cat",
"value": {
"name": "Fluffy",
@@ -1570,7 +1568,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
},
"dog": {
"summary": "An example of a dog with a cat's name",
- "value" : {
+ "value": {
"name": "Puma",
"petType": "Dog",
"color": "Black",
@@ -1589,7 +1587,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
```yaml
application/json:
schema:
- $ref: "#/components/schemas/Pet"
+ $ref: '#/components/schemas/Pet'
examples:
cat:
summary: An example of a cat
@@ -1608,14 +1606,14 @@ application/json:
gender: Female
breed: Mixed
frog:
- $ref: "#/components/examples/frog-example"
+ $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.
-In contrast with the 3.0 specification, the `format` keyword has no effect on the content-encoding of the schema. Instead, JSON Schema's `contentEncoding` and `contentMediaType` keywords are used. See [Working With Binary Data](#binaryData) for how to model various scenarios with these keywords, and how to migrate from the previous `format` usage.
+In contrast with the 3.0 specification, the `format` keyword has no effect on the content-encoding of the schema. Instead, JSON Schema's `contentEncoding` and `contentMediaType` keywords are used. See [Working With Binary Data](#binaryData) for how to model various scenarios with these keywords, and how to migrate from the previous `format` usage.
Examples:
@@ -1680,23 +1678,23 @@ See [Appendix E](#percentEncodingAndFormMediaTypes) for a detailed examination o
These fields MAY be used either with or without the RFC6570-style serialization fields defined in the next section below.
-Field Name | Type | Description
----|:---:|---
-contentType | `string` | The `Content-Type` for encoding a specific property. The value is a comma-separated list, each element of which is either a specific media type (e.g. `image/png`) or a wildcard media type (e.g. `image/*`). Default value depends on the property type as shown in the table below.
-headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | A map allowing additional information to be provided as headers. `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`.
+| Field Name | Type | Description |
+| --------------------------------------------- | :-----------------------------------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| contentType | `string` | The `Content-Type` for encoding a specific property. The value is a comma-separated list, each element of which is either a specific media type (e.g. `image/png`) or a wildcard media type (e.g. `image/*`). Default value depends on the property type as shown in the table below. |
+| headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | A map allowing additional information to be provided as headers. `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`. |
This object MAY be extended with [Specification Extensions](#specificationExtensions).
The default values for `contentType` are as follows, where an _n/a_ in the `contentEncoding` column means that the presence or value of `contentEncoding` is irrelevant:
-Property `type` | Property `contentEncoding` | Default `contentType`
---------------- | -------------------------- | ---------------------
-[_absent_](#binaryData) | _n/a_ | `application/octet-stream`
-`string` | _present_ | `application/octet-stream`
-`string` | _absent_ | `text/plain`
-`number`, `integer`, or `boolean` | _n/a_ | `text/plain`
-`object` | _n/a_ | `application/json`
-`array` | _n/a_ | according to the `type` of the `items` schema
+| Property `type` | Property `contentEncoding` | Default `contentType` |
+| --------------------------------- | -------------------------- | --------------------------------------------- |
+| [_absent_](#binaryData) | _n/a_ | `application/octet-stream` |
+| `string` | _present_ | `application/octet-stream` |
+| `string` | _absent_ | `text/plain` |
+| `number`, `integer`, or `boolean` | _n/a_ | `text/plain` |
+| `object` | _n/a_ | `application/json` |
+| `array` | _n/a_ | according to the `type` of the `items` schema |
Determining how to handle a `type` value of `null` depends on how `null` values are being serialized.
If `null` values are entirely omitted, then the `contentType` is irrelevant.
@@ -1704,11 +1702,11 @@ See [Appendix B](#dataTypeConversion) for a discussion of data type conversion o
###### Fixed Fields for RFC6570-style Serialization
-Field Name | Type | Description
----|:---:|---
-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. Note that the initial `?` used in query strings is not used in `application/x-www-form-urlencoded` message bodies, and MUST be removed (if using an RFC6570 implementation) or simply not added (if constructing the string manually). This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](#encodingContentType) (implicit or explicit) SHALL be ignored.
-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`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject` is undefined. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](#encodingContentType) (implicit or explicit) SHALL be ignored.
-allowReserved | `boolean` | When this is true, parameter values are serialized using reserved expansion, as defined by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#autoid-20), which allows [RFC3986's reserved character set](https://datatracker.ietf.org/doc/html/rfc3986#autoid-13), as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#autoid-24) (`[`, `]`, `#`), or have a special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see Appendices [C](#usingRFC6570Implementations) and [E](#percentEncodingAndFormMediaTypes) for details. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](#encodingContentType) (implicit or explicit) SHALL be ignored.
+| Field Name | Type | Description |
+| ------------------------------------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| 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. Note that the initial `?` used in query strings is not used in `application/x-www-form-urlencoded` message bodies, and MUST be removed (if using an RFC6570 implementation) or simply not added (if constructing the string manually). This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](#encodingContentType) (implicit or explicit) SHALL be ignored. |
+| 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`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject` is undefined. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](#encodingContentType) (implicit or explicit) SHALL be ignored. |
+| allowReserved | `boolean` | When this is true, parameter values are serialized using reserved expansion, as defined by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#autoid-20), which allows [RFC3986's reserved character set](https://datatracker.ietf.org/doc/html/rfc3986#autoid-13), as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#autoid-24) (`[`, `]`, `#`), or have a special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see Appendices [C](#usingRFC6570Implementations) and [E](#percentEncodingAndFormMediaTypes) for details. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](#encodingContentType) (implicit or explicit) SHALL be ignored. |
See also [Appendix C: Using RFC6570 Implementations](#usingRFC6570Implementations) for additional guidance, including on difficulties caused by the interaction between RFC6570's percent-encoding rules and the `multipart/form-data` media type.
@@ -1804,7 +1802,7 @@ However, this is not guaranteed, so it may be more interoperable to keep the pad
##### Encoding `multipart` Media Types
-It is common to use `multipart/form-data` as a `Content-Type` when transferring forms as request bodies. 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.
+It is common to use `multipart/form-data` as a `Content-Type` when transferring forms as request bodies. 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.
The `form-data` disposition and its `name` parameter are mandatory for `multipart/form-data` ([RFC7578 §4.2](https://www.rfc-editor.org/rfc/rfc7578.html#section-4.2)).
Array properties are handled by applying the same `name` to multiple parts, as is recommended by [RFC7578 §4.3](https://www.rfc-editor.org/rfc/rfc7578.html#section-4.3) for supplying multiple values per form field.
@@ -1875,7 +1873,7 @@ requestBody:
description: addresses in XML format
type: array
items:
- $ref: '#/components/schemas/Address'
+ $ref: '#/components/schemas/Address'
profileImage:
# default is application/octet-stream, but we can declare
# a more specific image type or types
@@ -1923,7 +1921,7 @@ 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
+The `default` MAY be used as a default response object for all HTTP codes
that are not covered individually by the Responses Object.
The Responses Object MUST contain at least one response code, and if only one
@@ -1931,15 +1929,16 @@ response code is provided 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.
+
+| 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. |
##### 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. 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]`. Only the following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code.
+| 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. 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]`. Only the following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response 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).
@@ -1988,16 +1987,18 @@ default:
```
#### Response Object
-Describes a single response from an API Operation, including design-time, static
+
+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 description of the response. [CommonMark syntax](https://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).
+
+| Field Name | Type | Description |
+| --------------------------------------------- | :-----------------------------------------------------------------------------------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| description | `string` | **REQUIRED**. A description of the response. [CommonMark syntax](https://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).
@@ -2133,9 +2134,10 @@ The key value used to identify the path item object is an expression, evaluated
To describe incoming requests from the API provider independent from another API call, use the [`webhooks`](#oasWebhooks) field.
##### 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.
+
+| 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).
@@ -2144,7 +2146,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
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.
+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:
@@ -2169,21 +2171,20 @@ Location: https://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 | https://example.org/subscribe/myevent?queryUrl=https://clientdomain.com/stillrunning
-$method | POST
-$request.path.eventType | myevent
-$request.query.queryUrl | https://clientdomain.com/stillrunning
-$request.header.content-Type | application/json
-$request.body#/failedUrl | https://clientdomain.com/failed
-$request.body#/successUrls/1 | https://clientdomain.com/medium
-$response.header.Location | https://example.org/subscription/1
-
+| Expression | Value |
+| ---------------------------- | :----------------------------------------------------------------------------------- |
+| $url | https://example.org/subscribe/myevent?queryUrl=https://clientdomain.com/stillrunning |
+| $method | POST |
+| $request.path.eventType | myevent |
+| $request.query.queryUrl | https://clientdomain.com/stillrunning |
+| $request.header.content-Type | application/json |
+| $request.body#/failedUrl | https://clientdomain.com/failed |
+| $request.body#/successUrls/1 | https://clientdomain.com/medium |
+| $response.header.Location | https://example.org/subscription/1 |
##### Callback Object Examples
-The following example uses the user provided `queryUrl` query string parameter to define the callback URL. This is similar to a [webhook](#oasWebhooks), but differs in that the callback only occurs because of the initial request that sent the `queryUrl`.
+The following example uses the user provided `queryUrl` query string parameter to define the callback URL. This is similar to a [webhook](#oasWebhooks), but differs in that the callback only occurs because of the initial request that sent the `queryUrl`.
```yaml
myCallback:
@@ -2225,12 +2226,13 @@ This object is typically used in properties named `examples` (plural), and is a
Examples allow demonstration of the usage of properties, parameters and objects within OpenAPI.
##### Fixed Fields
-Field Name | Type | Description
----|:---:|---
-summary | `string` | Short description for the example.
-description | `string` | Long description for the example. [CommonMark syntax](https://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 URI that identifies 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. See the rules for resolving [Relative References](#relativeReferencesURI).
+
+| Field Name | Type | Description |
+| ------------------------------------------------ | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| summary | `string` | Short description for the example. |
+| description | `string` | Long description for the example. [CommonMark syntax](https://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 URI that identifies 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. See the rules for resolving [Relative References](#relativeReferencesURI). |
This object MAY be extended with [Specification Extensions](#specificationExtensions).
@@ -2241,7 +2243,7 @@ Tooling implementations MAY choose to validate compatibility automatically, and
Example Objects can be used in both [Parameter Objects](#parameterObject) and [Media Type Objects](#mediaTypeObject).
In both Objects, this is done through the `examples` (plural) field.
-However, there are several other ways to provide examples: The `example` (singular) field that is mutually exclusive with `examples` in both Objects, and two keywords (the deprecated singular `example` and the current plural `examples`, which takes an array of examples) in the [Schema Object](#schemaObject) that appears in the `schema` field of both Objects.
+However, there are several other ways to provide examples: The `example` (singular) field that is mutually exclusive with `examples` in both Objects, and two keywords (the deprecated singular `example` and the current plural `examples`, which takes an array of examples) in the [Schema Object](#schemaObject) that appears in the `schema` field of both Objects.
Each of these fields has slightly different considerations.
The Schema Object's fields are used to show example values without regard to how they might be formatted as parameters or within media type representations.
@@ -2270,10 +2272,10 @@ requestBody:
examples:
foo:
summary: A foo example
- value: {"foo": "bar"}
+ value: { 'foo': 'bar' }
bar:
summary: A bar example
- value: {"bar": "baz"}
+ value: { 'bar': 'baz' }
application/xml:
examples:
xmlExample:
@@ -2345,7 +2347,6 @@ application/json:
In the above example, we can just show the JSON string (or any JSON value) as-is, rather than stuffing a serialized JSON value into a JSON string, which would have looked like `"\"json\""`.
-
In contrast, a JSON string encoded inside of a URL-style form body:
```json
@@ -2397,24 +2398,24 @@ The presence of a link does not guarantee the caller's ability to successfully i
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.
+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 URI identifying 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 description. See the rules for resolving [Relative References](#relativeReferencesURI).
-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 (optionally qualified with the parameter location, e.g. `path.id` for an `id` parameter in the path), whereas the value can be a constant or an expression to be evaluated and passed to the linked operation.
-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](https://spec.commonmark.org/) MAY be used for rich text representation.
-server | [Server Object](#serverObject) | A server object to be used by the target operation.
+| Field Name | Type | Description |
+| ------------------------------------------- | :------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| operationRef | `string` | A URI identifying 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 description. See the rules for resolving [Relative References](#relativeReferencesURI). |
+| 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 (optionally qualified with the parameter location, e.g. `path.id` for an `id` parameter in the path), whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. |
+| 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](https://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 OpenAPI description.
-Because of the potential for name clashes, the `operationRef` syntax is preferred
+Because of the potential for name clashes, the `operationRef` syntax is preferred
for multi-document OpenAPI descriptions.
Note that it is not possible to provide a constant value to `parameters` that matches the syntax of a runtime expression.
@@ -2428,12 +2429,12 @@ Computing a link from a request operation where the `$request.path.id` is used t
paths:
/users/{id}:
parameters:
- - name: id
- in: path
- required: true
- description: the user identifier, as userId
- schema:
- type: string
+ - name: id
+ in: path
+ required: true
+ description: the user identifier, as userId
+ schema:
+ type: string
get:
responses:
'200':
@@ -2456,12 +2457,12 @@ paths:
# 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
+ - name: userid
+ in: path
+ required: true
+ description: the user identifier, as userId
+ schema:
+ type: string
# linked operation
get:
operationId: getUserAddress
@@ -2483,14 +2484,13 @@ links:
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
+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
+As references to `operationId` MAY NOT be possible (the `operationId` is an optional
field in an [Operation Object](#operationObject)), references MAY also be made through a relative `operationRef`:
```yaml
@@ -2513,10 +2513,9 @@ links:
username: $response.body#/username
```
-Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when
+Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when
using JSON Pointer, and it is necessary to URL-encode `{` and `}` as `%7B` and `%7D`, respectively when using JSON Pointer as URI fragments.
-
##### Runtime Expressions
Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call.
@@ -2528,7 +2527,7 @@ The runtime expression is defined by the following [ABNF](https://tools.ietf.org
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
+ query-reference = "query." name
path-reference = "path." name
body-reference = "body" ["#" json-pointer ]
json-pointer = *( "/" reference-token )
@@ -2545,21 +2544,21 @@ The runtime expression is defined by the following [ABNF](https://tools.ietf.org
Here, `json-pointer` is taken from [RFC6901](https://tools.ietf.org/html/rfc6901), `char` from [RFC7159](https://tools.ietf.org/html/rfc7159#section-7) and `token` from [RFC7230](https://tools.ietf.org/html/rfc7230#section-3.2.6).
-The `name` identifier is case-sensitive, whereas `token` is not.
+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
+| 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.
@@ -2568,11 +2567,11 @@ Expressions can be embedded into string values by surrounding the expression wit
Describes a single header for [HTTP responses](#responseHeaders) and for [individual parts in `multipart` representations](#encodingHeaders); see the relevant [Response Object](#responseObject) and [Encoding Object](#encodingObject) documentation for restrictions on which headers can be described.
-The Header Object follows the structure of the [Parameter Object](#parameterObject), including determining its serialization strategy based on whether `schema` or `content` is present, with the following changes:
+The Header Object follows the structure of the [Parameter Object](#parameterObject), including determining its serialization strategy based on whether `schema` or `content` is present, 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)). This means that `allowEmptyValue` and `allowReserved` MUST NOT be used, and `style`, if used, MUST be limited to `simple`.
+1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, [`style`](#parameterStyle)). This means that `allowEmptyValue` and `allowReserved` MUST NOT be used, and `style`, if used, MUST be limited to `simple`.
##### Fixed Fields
@@ -2580,11 +2579,11 @@ The Header Object follows the structure of the [Parameter Object](#parameterObje
These fields MAY be used with either `content` or `schema`.
-Field Name | Type | Description
----|:---:|---
-description | `string` | A brief description of the header. This could contain examples of use. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
-required | `boolean` | Determines whether this header is mandatory. The default value is `false`.
- deprecated | `boolean` | Specifies that the header is deprecated and SHOULD be transitioned out of usage. Default value is `false`.
+| Field Name | Type | Description |
+| ------------------------------------------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| description | `string` | A brief description of the header. This could contain examples of use. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| required | `boolean` | Determines whether this header is mandatory. The default value is `false`. |
+| deprecated | `boolean` | Specifies that the header is deprecated and SHOULD be transitioned out of usage. Default value is `false`. |
This object MAY be extended with [Specification Extensions](#specificationExtensions).
@@ -2598,13 +2597,13 @@ Serializing with `schema` is NOT RECOMMENDED for headers with parameters (name=v
When `example` or `examples` are provided in conjunction with the `schema` object, the example SHOULD match the specified schema and follow the prescribed serialization strategy for the header.
The `example` and `examples` fields are mutually exclusive, and if either is present it SHALL _override_ any `example` in the schema.
-Field Name | Type | Description
----|:---:|---
-style | `string` | Describes how the header value will be serialized. The default (and only legal value for headers) is `simple`.
-explode | `boolean` | When this is true, header values of type `array` or `object` generate a single header whose value is a comma-separated list of the array items or key-value pairs of the map, see [Style Examples](#style-examples). For other data types this property has no effect. The default value is `false`.
-schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the header.
-example | Any | Example of the header's potential value; see [Working With Examples](#working-with-examples).
-examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the header's potential value; see [Working With Examples](#working-with-examples).
+| Field Name | Type | Description |
+| ------------------------------------- | :--------------------------------------------------------------------------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| style | `string` | Describes how the header value will be serialized. The default (and only legal value for headers) is `simple`. |
+| explode | `boolean` | When this is true, header values of type `array` or `object` generate a single header whose value is a comma-separated list of the array items or key-value pairs of the map, see [Style Examples](#style-examples). For other data types this property has no effect. The default value is `false`. |
+| schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the header. |
+| example | Any | Example of the header's potential value; see [Working With Examples](#working-with-examples). |
+| examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the header's potential value; see [Working With Examples](#working-with-examples). |
See also [Appendix C: Using RFC6570 Implementations](#usingRFC6570Implementations) for additional guidance.
@@ -2613,9 +2612,9 @@ See also [Appendix C: Using RFC6570 Implementations](#usingRFC6570Implementation
For more complex scenarios, the [`content`](#headerContent) property can define the media type and schema of the header, as well as give examples of its use.
Using `content` with a `text/plain` media type is RECOMMENDED for headers where the `schema` strategy is not appropriate.
-Field Name | Type | Description
----|:---:|---
-content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the header. The key is the media type and the value describes it. The map MUST only contain one entry.
+| Field Name | Type | Description |
+| ----------------------------------- | :--------------------------------------------------: | ----------------------------------------------------------------------------------------------------------------------------------------------- |
+| content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the header. The key is the media type and the value describes it. The map MUST only contain one entry. |
##### Header Object Example
@@ -2637,7 +2636,7 @@ X-Rate-Limit-Limit:
type: integer
```
-Requiring that a strong `ETag` header (with a value starting with `"` rather than `W/`) is present. Note the use of `content`, because using `schema` and `style` would require the `"` to be percent-encoded as `%22`:
+Requiring that a strong `ETag` header (with a value starting with `"` rather than `W/`) is present. Note the use of `content`, because using `schema` and `style` would require the `"` to be percent-encoded as `%22`:
```json
"ETag": {
@@ -2660,7 +2659,7 @@ ETag:
text/plain:
schema:
type: string
- pattern: ^"
+ pattern: ^"
```
#### Tag Object
@@ -2669,11 +2668,12 @@ Adds metadata to a single tag that is used by the [Operation Object](#operationO
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 description for the tag. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
-externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this tag.
+
+| Field Name | Type | Description |
+| ------------------------------------------ | :-----------------------------------------------------------: | ---------------------------------------------------------------------------------------------------------------------- |
+| name | `string` | **REQUIRED**. The name of the tag. |
+| description | `string` | A description for the tag. [CommonMark syntax](https://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).
@@ -2691,7 +2691,6 @@ name: pet
description: Pets operations
```
-
#### Reference Object
A simple object to allow referencing other components in the OpenAPI document, internally and externally.
@@ -2701,11 +2700,12 @@ The `$ref` string value contains a URI [RFC3986](https://tools.ietf.org/html/rfc
See the rules for resolving [Relative References](#relativeReferencesURI).
##### Fixed Fields
-Field Name | Type | Description
----|:---:|---
-$ref | `string` | **REQUIRED**. The reference identifier. This MUST be in the form of a URI.
-summary | `string` | A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a `summary` field, then this field has no effect.
-description | `string` | A description which by default SHOULD override that of the referenced component. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. If the referenced object-type does not allow a `description` field, then this field has no effect.
+
+| Field Name | Type | Description |
+| ---------------------------------------------- | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| $ref | `string` | **REQUIRED**. The reference identifier. This MUST be in the form of a URI. |
+| summary | `string` | A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a `summary` field, then this field has no effect. |
+| description | `string` | A description which by default SHOULD override that of the referenced component. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. If the referenced object-type does not allow a `description` field, then this field has no effect. |
This object cannot be extended with additional properties and any properties added SHALL be ignored.
@@ -2724,6 +2724,7 @@ $ref: '#/components/schemas/Pet'
```
##### Relative Schema Document Example
+
```json
{
"$ref": "Pet.json"
@@ -2735,6 +2736,7 @@ $ref: Pet.yaml
```
##### Relative Documents With Embedded Schema Example
+
```json
{
"$ref": "definitions.json#/Pet"
@@ -2773,25 +2775,26 @@ The OAS base vocabulary is comprised of the following keywords:
##### Fixed Fields
-Field Name | Type | Description
----|:---:|---
-discriminator | [Discriminator Object](#discriminatorObject) | Adds support for polymorphism. The discriminator is used to determine which of a set of schemas a payload is expected to satisfy. See [Composition and Inheritance](#schemaComposition) for more details.
-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:** The `example` property has been deprecated in favor of the JSON Schema `examples` keyword. Use of `example` is discouraged, and later versions of this specification may remove it.
+| Field Name | Type | Description |
+| ----------------------------------------------- | :-----------------------------------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| discriminator | [Discriminator Object](#discriminatorObject) | Adds support for polymorphism. The discriminator is used to determine which of a set of schemas a payload is expected to satisfy. See [Composition and Inheritance](#schemaComposition) for more details. |
+| 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:** The `example` property has been deprecated in favor of the JSON Schema `examples` keyword. Use of `example` is discouraged, and later versions of this specification may remove it. |
This object MAY be extended with [Specification Extensions](#specificationExtensions), though as noted, additional properties MAY omit the `x-` prefix within this object.
###### 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.
+`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`](#schemaDiscriminator) field.
When used, the `discriminator` indicates the name of the property that hints which schema definition is expected to validate 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](#discriminatorMapping) by overriding the property with a new value. If a new value exists, this takes precedence over the schema name.
@@ -2799,8 +2802,8 @@ There are two ways to define the value of a discriminator for an inheriting inst
Implementations MAY support defining generic or template data structures using JSON Schema's dynamic referencing feature:
-* `$dynamicAnchor` identifies a set of possible schemas (including a default placeholder schema) to which a `$dynamicRef` can resolve
-* `$dynamicRef` resolves to the first matching `$dynamicAnchor` encountered on its path from the schema entry point to the reference, as described in the JSON Schema specification
+- `$dynamicAnchor` identifies a set of possible schemas (including a default placeholder schema) to which a `$dynamicRef` can resolve
+- `$dynamicRef` resolves to the first matching `$dynamicAnchor` encountered on its path from the schema entry point to the reference, as described in the JSON Schema specification
An example is included in the "Schema Object Examples" section below, and further information can be found on the Learn OpenAPI site's ["Dynamic References"](https://learn.openapis.org/referencing/dynamic.html) page.
@@ -2841,9 +2844,7 @@ format: email
```json
{
"type": "object",
- "required": [
- "name"
- ],
+ "required": ["name"],
"properties": {
"name": {
"type": "string"
@@ -2863,7 +2864,7 @@ format: email
```yaml
type: object
required:
-- name
+ - name
properties:
name:
type: string
@@ -2925,9 +2926,7 @@ additionalProperties:
"type": "string"
}
},
- "required": [
- "name"
- ],
+ "required": ["name"],
"examples": [
{
"name": "Puma",
@@ -2946,10 +2945,10 @@ properties:
name:
type: string
required:
-- name
+ - name
examples:
-- name: Puma
- id: 1
+ - name: Puma
+ id: 1
```
###### Models with Composition
@@ -2960,10 +2959,7 @@ examples:
"schemas": {
"ErrorModel": {
"type": "object",
- "required": [
- "message",
- "code"
- ],
+ "required": ["message", "code"],
"properties": {
"message": {
"type": "string"
@@ -2982,9 +2978,7 @@ examples:
},
{
"type": "object",
- "required": [
- "rootCause"
- ],
+ "required": ["rootCause"],
"properties": {
"rootCause": {
"type": "string"
@@ -3004,8 +2998,8 @@ components:
ErrorModel:
type: object
required:
- - message
- - code
+ - message
+ - code
properties:
message:
type: string
@@ -3015,13 +3009,13 @@ components:
maximum: 600
ExtendedErrorModel:
allOf:
- - $ref: '#/components/schemas/ErrorModel'
- - type: object
- required:
- - rootCause
- properties:
- rootCause:
- type: string
+ - $ref: '#/components/schemas/ErrorModel'
+ - type: object
+ required:
+ - rootCause
+ properties:
+ rootCause:
+ type: string
```
###### Models with Polymorphism Support
@@ -3043,10 +3037,7 @@ components:
"type": "string"
}
},
- "required": [
- "name",
- "petType"
- ]
+ "required": ["name", "petType"]
},
"Cat": {
"description": "A representation of a cat. Note that `Cat` will be used as the discriminating value.",
@@ -3061,17 +3052,10 @@ components:
"type": "string",
"description": "The measured skill for hunting",
"default": "lazy",
- "enum": [
- "clueless",
- "lazy",
- "adventurous",
- "aggressive"
- ]
+ "enum": ["clueless", "lazy", "adventurous", "aggressive"]
}
},
- "required": [
- "huntingSkill"
- ]
+ "required": ["huntingSkill"]
}
]
},
@@ -3092,9 +3076,7 @@ components:
"minimum": 0
}
},
- "required": [
- "packSize"
- ]
+ "required": ["packSize"]
}
]
}
@@ -3116,38 +3098,38 @@ components:
petType:
type: string
required:
- - name
- - petType
- Cat: # "Cat" will be used as the discriminating value
+ - name
+ - petType
+ Cat: # "Cat" will be used as the discriminating 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 discriminating value
+ - $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 discriminating 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
+ - $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
```
###### Generic Data Structure Model
@@ -3242,8 +3224,8 @@ components:
objWithTypedArray:
$id: obj_with_typed_array
type: object
- required:
- - dataType
+ required:
+ - dataType
- data
properties:
dataType:
@@ -3272,14 +3254,16 @@ The Discriminator Object does this by implicitly or explicitly associating the p
Note that `discriminator` MUST NOT change the validation outcome of the schema.
##### Fixed Fields
-Field Name | Type | Description
----|:---:|---
-propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminating value. This property SHOULD be required in the payload schema, as the behavior when the property is absent is undefined.
- mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or URI references.
+
+| Field Name | Type | Description |
+| ------------------------------------------- | :---------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminating value. This property SHOULD be required in the payload schema, as the behavior when the property is absent is undefined. |
+| mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or URI references. |
This object MAY be extended with [Specification Extensions](#specificationExtensions).
##### Conditions for Using the Discriminator Object
+
The Discriminator Object is legal only when using one of the composite keywords `oneOf`, `anyOf`, `allOf`.
In both the `oneOf` and `anyOf` use cases, where those keywords are adjacent to `discriminator`, all possible schemas MUST be listed explicitly.
@@ -3292,6 +3276,7 @@ This is because `discriminator` cannot change the validation outcome, and no sta
The behavior of any configuration of `oneOf`, `anyOf`, `allOf` and `discriminator` that is not described above is undefined.
##### Options for Mapping Values to Schemas
+
The value of the property named in `propertyName` is used as the name of the associated schema under the [Components Object](#componentsObject), _unless_ a `mapping` is present for that value.
The `mapping` entry maps a specific property value to either a different schema component name, or to a schema identified by a URI.
When using implicit or explicit schema component names, inline `oneOf` or `anyOf` subschemas are not considered.
@@ -3310,9 +3295,9 @@ In OAS 3.x, a response payload MAY be described to be exactly one of any number
```yaml
MyResponseType:
oneOf:
- - $ref: '#/components/schemas/Cat'
- - $ref: '#/components/schemas/Dog'
- - $ref: '#/components/schemas/Lizard'
+ - $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`. Deserialization of a `oneOf` can be a costly operation, as it requires determining which schema matches the payload and thus should be used in deserialization. This problem also exists for `anyOf` schemas. A `discriminator` MAY be used as a "hint" to improve the efficiency of selection of the matching schema. The `discriminator` field cannot change the validation result of the `oneOf`, it can only help make the deserialization more efficient and provide better error messaging. We can specify the exact field that tells us which schema is expected to match the instance:
@@ -3320,14 +3305,14 @@ which means the payload _MUST_, by validation, match exactly one of the schemas
```yaml
MyResponseType:
oneOf:
- - $ref: '#/components/schemas/Cat'
- - $ref: '#/components/schemas/Dog'
- - $ref: '#/components/schemas/Lizard'
+ - $ref: '#/components/schemas/Cat'
+ - $ref: '#/components/schemas/Dog'
+ - $ref: '#/components/schemas/Lizard'
discriminator:
propertyName: petType
```
-The expectation now is that a property with name `petType` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OpenAPI description. Thus the response payload:
+The expectation now is that a property with name `petType` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OpenAPI description. Thus the response payload:
```json
{
@@ -3343,10 +3328,10 @@ In scenarios where the value of the discriminator field does not match the schem
```yaml
MyResponseType:
oneOf:
- - $ref: '#/components/schemas/Cat'
- - $ref: '#/components/schemas/Dog'
- - $ref: '#/components/schemas/Lizard'
- - $ref: https://gigantic-server.com/schemas/Monster/schema.json
+ - $ref: '#/components/schemas/Cat'
+ - $ref: '#/components/schemas/Dog'
+ - $ref: '#/components/schemas/Lizard'
+ - $ref: https://gigantic-server.com/schemas/Monster/schema.json
discriminator:
propertyName: petType
mapping:
@@ -3354,7 +3339,7 @@ MyResponseType:
monster: https://gigantic-server.com/schemas/Monster/schema.json
```
-Here the discriminating value of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `#/components/schemas/dog`. If the discriminating value does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail.
+Here the discriminating value of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `#/components/schemas/dog`. If the discriminating value does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail.
When used in conjunction with the `anyOf` construct, the use of the discriminator can avoid ambiguity for serializers/deserializers where multiple schemas may satisfy a single payload.
@@ -3366,7 +3351,7 @@ components:
Pet:
type: object
required:
- - petType
+ - petType
properties:
petType:
type: string
@@ -3376,28 +3361,28 @@ components:
dog: Dog
Cat:
allOf:
- - $ref: '#/components/schemas/Pet'
- - type: object
- # all other properties specific to a `Cat`
- properties:
- name:
- type: string
+ - $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
+ - $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
+ - $ref: '#/components/schemas/Pet'
+ - type: object
+ # all other properties specific to a `Lizard`
+ properties:
+ lovesRocks:
+ type: boolean
```
Validated against the `Pet` schema, a payload like this:
@@ -3409,7 +3394,7 @@ Validated against the `Pet` schema, a payload like this:
}
```
-will indicate that the `#/components/schemas/Cat` schema is expected to match. Likewise this payload:
+will indicate that the `#/components/schemas/Cat` schema is expected to match. Likewise this payload:
```json
{
@@ -3420,30 +3405,30 @@ will indicate that the `#/components/schemas/Cat` schema is expected to match.
will map to `#/components/schemas/Dog` because the `dog` entry in the `mapping` element maps to `Dog` which is the schema name for `#/components/schemas/Dog`.
-
#### 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.
+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 a non-relative 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, `form‑urlencoded
-[RFC1866 §8.2.1 form‑urlencoded](https://datatracker.ietf.org/doc/html/rfc1866#section-8.2.1) | 11/1995 | content-based serialization | RFC1738 | obsoleted by [HTML 4.01 §17.13.4.1](https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1), [WHATWG URL §5](https://url.spec.whatwg.org/#urlencoded-serializing)
+| Specification | Date | OAS Usage | Percent-Encoding | Notes |
+| -------------------------------------------------------------------------------------------------------- | ------- | --------------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [RFC3986 URI Generic Syntax](https://datatracker.ietf.org/doc/html/rfc3986) | 01/2005 | URI/URL syntax | RFC3986 | obsoletes RFC1738, RFC2396 |
+| [RFC6570 URI Template](https://datatracker.ietf.org/doc/html/rfc6570) | 03/2012 | style-based serialization | RFC3986 | does not use `+` for form‑urlencoded
|
+| [RFC1866 §8.2.1 form‑urlencoded](https://datatracker.ietf.org/doc/html/rfc1866#section-8.2.1) | 11/1995 | content-based serialization | RFC1738 | obsoleted by [HTML 4.01 §17.13.4.1](https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1), [WHATWG URL §5](https://url.spec.whatwg.org/#urlencoded-serializing) |
Style-based serialization is used in the [Parameter Object](#parameterObject) when `schema` is present, and in the [Encoding Object](#encodingObject) when at least one of `style`, `explode`, or `allowReserved` is present.
See [Appendix C](#usingRFC6570Implementations) for more details of RFC6570's two different approaches to percent-encoding, including an example involving `+`.
From 32657fdd530a22e5cf72cc2fa41e2051c0421ef6 Mon Sep 17 00:00:00 2001
From: Lorna Mitchell
`format: binary` | `contentMediaType: image/png` | if redundant, can be omitted, often resulting in an empty Schema Object |
| `type: string`
`format: byte` | `type: string`
`contentMediaType: image/png`
`contentEncoding: base64` | note that `base64url` can be used to avoid re-encoding the base64 string to be URL-safe |
-### 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](https://spec.commonmark.org/0.27/). Tooling MAY choose to ignore some CommonMark or extension features to address security concerns.
@@ -318,29 +318,29 @@ Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown
While the framing of CommonMark 0.27 as a minimum requirement means that tooling MAY choose to implement extensions on top of it, note that any such extensions are by definition implementation-defined and will not be interoperable.
OpenAPI Description authors SHOULD consider how text using such extensions will be rendered by tools that offer only the minimum support.
-### Relative References in API Description URIs
+### Relative References in API Description URIs
URIs used as references within an OpenAPI Description, or to external documentation or other supplementary information such as a license, are resolved as _identifiers_, and described by this specification as **_URIs_**.
-As noted under [Parsing Documents](#parsingDocuments), this specification inherits JSON Schema draft 2020-12's requirements for loading documents and associating them with their expected URIs, which might not match their current location.
+As noted under [Parsing Documents](#parsing-documents), this specification inherits JSON Schema draft 2020-12's requirements for loading documents and associating them with their expected URIs, which might not match their current location.
This feature is used both for working in development or test environments without having to change the URIs, and for working within restrictive network configurations or security policies.
Note that some URI fields are named `url` for historical reasons, but the descriptive text for those fields uses the correct "URI" terminology.
Unless specified otherwise, all properties that are URIs MAY be relative references as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-4.2).
-Relative references in [Schema Objects](#schemaObject), including any that appear as `$id` values, use the nearest parent `$id` as a Base URI, as described by [JSON Schema Specification Draft 2020-12](https://tools.ietf.org/html/draft-bhutton-json-schema-00#section-8.2).
+Relative references in [Schema Objects](#schema-object), including any that appear as `$id` values, use the nearest parent `$id` as a Base URI, as described by [JSON Schema Specification Draft 2020-12](https://tools.ietf.org/html/draft-bhutton-json-schema-00#section-8.2).
Relative URI references in other Objects, and in Schema Objects where no parent schema contains an `$id`, MUST be resolved using the referring document's base URI, which is determined in accordance with [RFC3986 §5.1.2 – 5.1.4](https://tools.ietf.org/html/rfc3986#section-5.1.2).
In practice, this is usually the retrieval URI of the document, which MAY be determined based on either its current actual location or a user-supplied expected location.
If a URI contains a fragment identifier, then the fragment should be resolved per the fragment resolution mechanism of the referenced document. If the representation of the referenced document is JSON or YAML, then the fragment identifier SHOULD be interpreted as a JSON-Pointer as per [RFC6901](https://tools.ietf.org/html/rfc6901).
-### Relative References in API URLs
+### Relative References in API URLs
API endpoints are by definition accessed as locations, and are described by this specification as **_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).
-Unless specified otherwise, relative references are resolved using the URLs defined in the [Server Object](#serverObject) as a Base URL. Note that these themselves MAY be relative to the referring document.
+Unless specified otherwise, relative references are resolved using the URLs defined in the [Server Object](#server-object) as a Base URL. Note that these themselves MAY be relative to the referring document.
Relative references in CommonMark hyperlinks are resolved in their rendered context, which might differ from the context of the API description.
@@ -353,28 +353,28 @@ If the JSON Schema differs from this section, then this section MUST be consider
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 object of the [OpenAPI document](#oasDocument).
+This is the root object of the [OpenAPI document](#openapi-description).
##### Fixed Fields
| Field Name | Type | Description |
| ----------------------------------------------------- | :-----------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| openapi | `string` | **REQUIRED**. This string MUST be the [version number](#versions) of the OpenAPI Specification that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling 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. |
-| jsonSchemaDialect | `string` | The default value for the `$schema` keyword within [Schema Objects](#schemaObject) contained within this OAS document. This MUST be in the form of a URI. |
-| 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) | The available paths and operations for the API. |
-| webhooks | Map[`string`, [Path Item Object](#pathItemObject)] | The incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. Closely related to the `callbacks` feature, this section describes requests initiated other than by an API call, for example by an out of band registration. The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses. An [example](../examples/v3.1/webhook-example.yaml) is available. |
-| components | [Components Object](#componentsObject) | An element to hold various schemas for the document. |
-| 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. To make security optional, an empty security requirement (`{}`) can be included in the array. |
-| tags | [[Tag Object](#tagObject)] | A list of tags used by the document 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. |
+| openapi | `string` | **REQUIRED**. This string MUST be the [version number](#versions) of the OpenAPI Specification that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling to interpret the OpenAPI document. This is _not_ related to the API [`info.version`](#info-version) string. |
+| info | [Info Object](#info-object) | **REQUIRED**. Provides metadata about the API. The metadata MAY be used by tooling as required. |
+| jsonSchemaDialect | `string` | The default value for the `$schema` keyword within [Schema Objects](#schema-object) contained within this OAS document. This MUST be in the form of a URI. |
+| servers | [[Server Object](#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](#server-object) with a [url](#server-url) value of `/`. |
+| paths | [Paths Object](#paths-object) | The available paths and operations for the API. |
+| webhooks | Map[`string`, [Path Item Object](#path-item-object)] | The incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. Closely related to the `callbacks` feature, this section describes requests initiated other than by an API call, for example by an out of band registration. The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses. An [example](../examples/v3.1/webhook-example.yaml) is available. |
+| components | [Components Object](#components-object) | An element to hold various schemas for the document. |
+| security | [[Security Requirement Object](#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. To make security optional, an empty security requirement (`{}`) can be included in the array. |
+| tags | [[Tag Object](#tag-object)] | A list of tags used by the document 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](#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](#external-documentation-object) | Additional external documentation. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#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.
@@ -383,15 +383,15 @@ The metadata MAY be used by the clients if needed, and MAY be presented in editi
| Field Name | Type | Description |
| ----------------------------------------------- | :------------------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| title | `string` | **REQUIRED**. The title of the API. |
-| summary | `string` | A short summary of the API. |
-| description | `string` | A description of the API. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
-| termsOfService | `string` | A URI for the Terms of Service for the API. This MUST be in the form of a URI. |
-| 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 version of the API being described). |
+| title | `string` | **REQUIRED**. The title of the API. |
+| summary | `string` | A short summary of the API. |
+| description | `string` | A description of the API. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| termsOfService | `string` | A URI for the Terms of Service for the API. This MUST be in the form of a URI. |
+| contact | [Contact Object](#contact-object) | The contact information for the exposed API. |
+| license | [License Object](#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](#oas-version) or the version of the API being described). |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### Info Object Example
@@ -429,7 +429,7 @@ license:
version: 1.0.1
```
-#### Contact Object
+#### Contact Object
Contact information for the exposed API.
@@ -437,11 +437,11 @@ Contact information for the exposed API.
| Field Name | Type | Description |
| -------------------------------- | :------: | --------------------------------------------------------------------------------------------------- |
-| name | `string` | The identifying name of the contact person/organization. |
-| url | `string` | The URI for the contact information. This MUST be in the form of a URI. |
-| email | `string` | The email address of the contact person/organization. This MUST be in the form of an email address. |
+| name | `string` | The identifying name of the contact person/organization. |
+| url | `string` | The URI for the contact information. This MUST be in the form of a URI. |
+| email | `string` | The email address of the contact person/organization. This MUST be in the form of an email address. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### Contact Object Example
@@ -459,7 +459,7 @@ url: https://www.example.com/support
email: support@example.com
```
-#### License Object
+#### License Object
License information for the exposed API.
@@ -467,11 +467,11 @@ License information for the exposed API.
| Field Name | Type | Description |
| ------------------------------------------ | :------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| name | `string` | **REQUIRED**. The license name used for the API. |
-| identifier | `string` | An [SPDX](https://spdx.org/spdx-specification-21-web-version#h.jxpfx0ykyb60) license expression for the API. The `identifier` field is mutually exclusive of the `url` field. |
-| url | `string` | A URI for the license used for the API. This MUST be in the form of a URI. The `url` field is mutually exclusive of the `identifier` field. |
+| name | `string` | **REQUIRED**. The license name used for the API. |
+| identifier | `string` | An [SPDX](https://spdx.org/spdx-specification-21-web-version#h.jxpfx0ykyb60) license expression for the API. The `identifier` field is mutually exclusive of the `url` field. |
+| url | `string` | A URI for the license used for the API. This MUST be in the form of a URI. The `url` field is mutually exclusive of the `identifier` field. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### License Object Example
@@ -487,7 +487,7 @@ name: Apache 2.0
identifier: Apache-2.0
```
-#### Server Object
+#### Server Object
An object representing a Server.
@@ -495,11 +495,11 @@ An object representing a Server.
| 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](https://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. |
+| 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](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| variables | Map[`string`, [Server Variable Object](#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](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### Server Object Example
@@ -517,7 +517,7 @@ 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):
+The following shows how multiple servers can be described, for example, at the OpenAPI Object's [`servers`](#oas-servers):
```json
{
@@ -593,7 +593,7 @@ servers:
default: v2
```
-#### Server Variable Object
+#### Server Variable Object
An object representing a Server Variable for server URL template substitution.
@@ -601,13 +601,13 @@ An object representing a Server Variable for server URL template substitution.
| Field Name | Type | Description |
| --------------------------------------------------- | :--------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| enum | [`string`] | An enumeration of string values to be used if the substitution options are from a limited set. The array MUST NOT be empty. |
-| default | `string` | **REQUIRED**. The default value to use for substitution, which SHALL be sent if an alternate value is _not_ supplied. Note this behavior is different than the [Schema Object's](#schemaObject) treatment of default values, because in those cases parameter values are optional. If the [`enum`](#serverVariableEnum) is defined, the value MUST exist in the enum's values. |
-| description | `string` | An optional description for the server variable. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| enum | [`string`] | An enumeration of string values to be used if the substitution options are from a limited set. The array MUST NOT be empty. |
+| default | `string` | **REQUIRED**. The default value to use for substitution, which SHALL be sent if an alternate value is _not_ supplied. Note this behavior is different than the [Schema Object's](#schema-object) treatment of default values, because in those cases parameter values are optional. If the [`enum`](#server-variable-enum) is defined, the value MUST exist in the enum's values. |
+| description | `string` | An optional description for the server variable. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#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.
@@ -616,18 +616,18 @@ All objects defined within the components object will have no effect on the API
| Field Name | Type | Description |
| -------------------------------------------------------- | :----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
-| schemas | Map[`string`, [Schema Object](#schemaObject)] | 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). |
-| pathItems | Map[`string`, [Path Item Object](#pathItemObject)] | An object to hold reusable [Path Item Objects](#pathItemObject). |
-
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+| schemas | Map[`string`, [Schema Object](#schema-object)] | An object to hold reusable [Schema Objects](#schema-object). |
+| responses | Map[`string`, [Response Object](#response-object) \| [Reference Object](#reference-object)] | An object to hold reusable [Response Objects](#response-object). |
+| parameters | Map[`string`, [Parameter Object](#parameter-object) \| [Reference Object](#reference-object)] | An object to hold reusable [Parameter Objects](#parameter-object). |
+| examples | Map[`string`, [Example Object](#example-object) \| [Reference Object](#reference-object)] | An object to hold reusable [Example Objects](#example-object). |
+| requestBodies | Map[`string`, [Request Body Object](#request-body-object) \| [Reference Object](#reference-object)] | An object to hold reusable [Request Body Objects](#request-body-object). |
+| headers | Map[`string`, [Header Object](#header-object) \| [Reference Object](#reference-object)] | An object to hold reusable [Header Objects](#header-object). |
+| securitySchemes | Map[`string`, [Security Scheme Object](#security-scheme-object) \| [Reference Object](#reference-object)] | An object to hold reusable [Security Scheme Objects](#security-scheme-object). |
+| links | Map[`string`, [Link Object](#link-object) \| [Reference Object](#reference-object)] | An object to hold reusable [Link Objects](#link-object). |
+| callbacks | Map[`string`, [Callback Object](#callback-object) \| [Reference Object](#reference-object)] | An object to hold reusable [Callback Objects](#callback-object). |
+| pathItems | Map[`string`, [Path Item Object](#path-item-object)] | An object to hold reusable [Path Item Objects](#path-item-object). |
+
+This object MAY be extended with [Specification Extensions](#specification-extensions).
All the fixed fields declared above are objects that MUST use keys that match the regular expression: `^[a-zA-Z0-9\.\-_]+$`.
@@ -815,18 +815,18 @@ components:
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](#serverObject) in order to construct the full URL. The Paths Object MAY be empty, due to [Access Control List (ACL) constraints](#securityFiltering).
+The path is appended to the URL from the [Server Object](#server-object) in order to construct the full URL. The Paths Object MAY be empty, due to [Access Control List (ACL) constraints](#security-filtering).
##### 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 forward 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. |
+| /{path} | [Path Item Object](#path-item-object) | A relative path to an individual endpoint. The field name MUST begin with a forward slash (`/`). The path is **appended** (no relative URL resolution) to the expanded URL from the [Server Object](#server-object)'s `url` field in order to construct the full URL. [Path templating](#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](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### Path Templating Matching
@@ -893,31 +893,31 @@ The following may lead to ambiguous resolution:
$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](#securityFiltering).
+A Path Item MAY be empty, due to [ACL constraints](#security-filtering).
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 a referenced definition of this path item. The value MUST be in the form of a URI, and the referenced structure MUST be in the form of a [Path Item Object](#pathItemObject). In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined. See the rules for resolving [Relative References](#relativeReferencesURI).
_**Note:** The behavior of `$ref` with adjacent properties is likely to change in future versions of this specification to bring it into closer alignment with the behavior of the [Reference Object](#referenceObject)._ |
-| 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](https://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. If an alternative server object is specified at the Root level, it will be overridden by this value. |
-| 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).
+| $ref | `string` | Allows for a referenced definition of this path item. The value MUST be in the form of a URI, and the referenced structure MUST be in the form of a [Path Item Object](#path-item-object). In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined. See the rules for resolving [Relative References](#relative-references-in-api-description-uris).
_**Note:** The behavior of `$ref` with adjacent properties is likely to change in future versions of this specification to bring it into closer alignment with the behavior of the [Reference Object](#reference-object)._ |
+| 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](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| get | [Operation Object](#operation-object) | A definition of a GET operation on this path. |
+| put | [Operation Object](#operation-object) | A definition of a PUT operation on this path. |
+| post | [Operation Object](#operation-object) | A definition of a POST operation on this path. |
+| delete | [Operation Object](#operation-object) | A definition of a DELETE operation on this path. |
+| options | [Operation Object](#operation-object) | A definition of a OPTIONS operation on this path. |
+| head | [Operation Object](#operation-object) | A definition of a HEAD operation on this path. |
+| patch | [Operation Object](#operation-object) | A definition of a PATCH operation on this path. |
+| trace | [Operation Object](#operation-object) | A definition of a TRACE operation on this path. |
+| servers | [[Server Object](#server-object)] | An alternative `server` array to service all operations in this path. If an alternative server object is specified at the Root level, it will be overridden by this value. |
+| parameters | [[Parameter Object](#parameter-object) \| [Reference 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](#parameter-name) and [location](#parameter-in). The list can use the [Reference Object](#reference-object) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#components-parameters). |
+
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### Path Item Object Example
@@ -1003,7 +1003,7 @@ parameters:
style: simple
```
-#### Operation Object
+#### Operation Object
Describes a single API operation on a path.
@@ -1011,20 +1011,20 @@ Describes a single API operation on a path.
| 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](https://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. The operationId value is **case-sensitive**. 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 fully 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 (such as [GET](https://tools.ietf.org/html/rfc7231#section-4.3.1), [HEAD](https://tools.ietf.org/html/rfc7231#section-4.3.2) and [DELETE](https://tools.ietf.org/html/rfc7231#section-4.3.5)), `requestBody` is permitted but does not have well-defined semantics and SHOULD be avoided if possible. |
-| responses | [Responses Object](#responsesObject) | 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. |
-| 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. To make security optional, an empty security requirement (`{}`) can be included in the array. 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).
+| 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](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| externalDocs | [External Documentation Object](#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. The operationId value is **case-sensitive**. 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](#parameter-object) \| [Reference Object](#reference-object)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#path-item-parameters), 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](#parameter-name) and [location](#parameter-in). The list can use the [Reference Object](#reference-object) to link to parameters that are defined at the [OpenAPI Object's components/parameters](#components-parameters). |
+| requestBody | [Request Body Object](#request-body-object) \| [Reference Object](#reference-object) | The request body applicable for this operation. The `requestBody` is fully 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 (such as [GET](https://tools.ietf.org/html/rfc7231#section-4.3.1), [HEAD](https://tools.ietf.org/html/rfc7231#section-4.3.2) and [DELETE](https://tools.ietf.org/html/rfc7231#section-4.3.5)), `requestBody` is permitted but does not have well-defined semantics and SHOULD be avoided if possible. |
+| responses | [Responses Object](#responses-object) | The list of possible responses as they are returned from executing this operation. |
+| callbacks | Map[`string`, [Callback Object](#callback-object) \| [Reference 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](#callback-object) that describes a request that may be initiated by the API provider and the expected responses. |
+| 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](#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. To make security optional, an empty security requirement (`{}`) can be included in the array. This definition overrides any declared top-level [`security`](#oas-security). To remove a top-level security declaration, an empty array can be used. |
+| servers | [[Server Object](#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](#specification-extensions).
##### Operation Object Example
@@ -1131,7 +1131,7 @@ security:
- read:pets
```
-#### External Documentation Object
+#### External Documentation Object
Allows referencing an external resource for extended documentation.
@@ -1139,10 +1139,10 @@ Allows referencing an external resource for extended documentation.
| Field Name | Type | Description |
| ------------------------------------------------ | :------: | -------------------------------------------------------------------------------------------------------------------------------------- |
-| description | `string` | A description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
-| url | `string` | **REQUIRED**. The URI for the target documentation. This MUST be in the form of a URI. |
+| description | `string` | A description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| url | `string` | **REQUIRED**. The URI for the target documentation. This MUST be in the form of a URI. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### External Documentation Object Example
@@ -1158,19 +1158,19 @@ 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](#parameterName) and [location](#parameterIn).
+A unique parameter is defined by a combination of a [name](#parameter-name) and [location](#parameter-in).
-See [Appendix E](#percentEncodingAndFormMediaTypes) for a detailed examination of percent-encoding concerns, including interactions with the `application/x-www-form-urlencoded` query string format.
+See [Appendix E](#appendix-e-percent-encoding-and-form-media-types) for a detailed examination of percent-encoding concerns, including interactions with the `application/x-www-form-urlencoded` query string format.
##### 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`.
+* path - Used together with [Path Templating](#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](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.
@@ -1179,7 +1179,7 @@ There are four possible parameter locations specified by the `in` field:
The rules for serialization of the parameter are specified in one of two ways.
Parameter Objects MUST include either a `content` field or a `schema` field, but not both.
-See [Appendix B](#dataTypeConversion) for a discussion of converting values of various types to string representations.
+See [Appendix B](#appendix-b-data-type-conversion) for a discussion of converting values of various types to string representations.
###### Common Fixed Fields
@@ -1187,50 +1187,50 @@ These fields MAY be used with either `content` or `schema`.
| Field Name | Type | Description |
| ------------------------------------------------------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| name | `string` | **REQUIRED**. The name of the parameter. Parameter names are _case sensitive_.
|
-| 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](https://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. Default value is `false`. |
-| allowEmptyValue | `boolean` | If `true`, clients MAY pass a zero-length string value in place of parameters that would otherwise be omitted entirely, which the server SHOULD interpret as the parameter being unused. Default value is `false`. If [`style`](#parameterStyle) is used, and if [behavior is _n/a_ (cannot be serialized)](#style-examples), the value of `allowEmptyValue` SHALL be ignored. Interactions between this field and the parameter's [Schema Object](#schemaObject) are implementation-defined. This field is valid only for `query` parameters. Use of this property is NOT RECOMMENDED, and it is likely to be removed in a later revision. |
+| name | `string` | **REQUIRED**. The name of the parameter. Parameter names are _case sensitive_.
|
+| 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](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameter-in) 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. Default value is `false`. |
+| allowEmptyValue | `boolean` | If `true`, clients MAY pass a zero-length string value in place of parameters that would otherwise be omitted entirely, which the server SHOULD interpret as the parameter being unused. Default value is `false`. If [`style`](#parameter-style) is used, and if [behavior is _n/a_ (cannot be serialized)](#style-examples), the value of `allowEmptyValue` SHALL be ignored. Interactions between this field and the parameter's [Schema Object](#schema-object) are implementation-defined. This field is valid only for `query` parameters. Use of this property is NOT RECOMMENDED, and it is likely to be removed in a later revision. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
Note that while `"Cookie"` as a `name` is not forbidden with `in: header`, the effect of defining a cookie parameter that way is undefined; use `in: cookie` instead.
###### Fixed Fields for use with `schema`
-For simpler scenarios, a [`schema`](#parameterSchema) and [`style`](#parameterStyle) can describe the structure and syntax of the parameter.
+For simpler scenarios, a [`schema`](#parameter-schema) and [`style`](#parameter-style) can describe the structure and syntax of the parameter.
When `example` or `examples` are provided in conjunction with the `schema` object, the example SHOULD match the specified schema and follow the prescribed serialization strategy for the parameter.
The `example` and `examples` fields are mutually exclusive, and if either is present it SHALL _override_ any `example` in the schema.
-Serializing with `schema` is NOT RECOMMENDED for `in: cookie` parameters, `in: header` parameters that use HTTP header parameters (name=value pairs following a `;`) in their values, or `in: header` parameters where values might have non-URL-safe characters; see [Appendix D](#serializingHeadersAndCookies) for details.
+Serializing with `schema` is NOT RECOMMENDED for `in: cookie` parameters, `in: header` parameters that use HTTP header parameters (name=value pairs following a `;`) in their values, or `in: header` parameters where values might have non-URL-safe characters; see [Appendix D](#appendix-d-serializing-headers-and-cookies) for details.
| 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`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject` is undefined. |
-| allowReserved | `boolean` | When this is true, parameter values are serialized using reserved expansion, as defined by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#autoid-20), which allows [RFC3986's reserved character set](https://datatracker.ietf.org/doc/html/rfc3986#autoid-13), as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#autoid-24) (`[`, `]`, `#`), or have a special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see Appendices [C](#usingRFC6570Implementations) and [E](#percentEncodingAndFormMediaTypes) for details. This property only applies to parameters with an `in` value of `query`. The default value is `false`. |
-| schema | [Schema Object](#schemaObject) | The schema defining the type used for the parameter. |
-| example | Any | Example of the parameter's potential value; see [Working With Examples](#working-with-examples). |
-| examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the parameter's potential value; see [Working With Examples](#working-with-examples). |
+| 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`](#parameter-style) is `form`, the default value is `true`. For all other styles, the default value is `false`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject` is undefined. |
+| allowReserved | `boolean` | When this is true, parameter values are serialized using reserved expansion, as defined by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#autoid-20), which allows [RFC3986's reserved character set](https://datatracker.ietf.org/doc/html/rfc3986#autoid-13), as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#autoid-24) (`[`, `]`, `#`), or have a special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see Appendices [C](#appendix-c-using-rfc6570-implementations) and [E](#appendix-e-percent-encoding-and-form-media-types) for details. This property only applies to parameters with an `in` value of `query`. The default value is `false`. |
+| schema | [Schema Object](#schema-object) | The schema defining the type used for the parameter. |
+| example | Any | Example of the parameter's potential value; see [Working With Examples](#working-with-examples). |
+| examples | Map[ `string`, [Example Object](#example-object) \| [Reference Object](#reference-object)] | Examples of the parameter's potential value; see [Working With Examples](#working-with-examples). |
-See also [Appendix C: Using RFC6570 Implementations](#usingRFC6570Implementations) for additional guidance.
+See also [Appendix C: Using RFC6570 Implementations](#appendix-c-using-rfc6570-implementations) for additional guidance.
###### Fixed Fields for use with `content`
-For more complex scenarios, the [`content`](#parameterContent) property can define the media type and schema of the parameter, as well as give examples of its use.
+For more complex scenarios, the [`content`](#parameter-content) property can define the media type and schema of the parameter, as well as give examples of its use.
Using `content` with a `text/plain` media type is RECOMMENDED for `in: header` and `in: cookie` parameters where the `schema` strategy is not appropriate.
| 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. |
+| content | Map[`string`, [Media Type Object](#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
+##### Style Values
In order to support common ways of serializing simple parameters, a set of `style` values are defined.
-| `style` | [`type`](#dataTypes) | `in` | Comments |
+| `style` | [`type`](#data-types) | `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) |
@@ -1240,7 +1240,7 @@ In order to support common ways of serializing simple parameters, a set of `styl
| pipeDelimited | `array`, `object` | `query` | Pipe separated array values or object properties and values. This option replaces `collectionFormat` equal to `pipes` from OpenAPI 2.0. |
| deepObject | `object` | `query` | Allows objects with scalar properties to be represented using form parameters. The representation of array or object properties is not defined. |
-See [Appendix E](#percentEncodingAndFormMediaTypes) for a discussion of percent-encoding, including when delimiters need to be percent-encoded and options for handling collisions with percent-encoded data.
+See [Appendix E](#appendix-e-percent-encoding-and-form-media-types) for a discussion of percent-encoding, including when delimiters need to be percent-encoded and options for handling collisions with percent-encoded data.
##### Style Examples
@@ -1257,11 +1257,11 @@ The following table shows examples, as would be shown with the `example` or `exa
* The value _empty_ denotes the empty string, and is unrelated to the `allowEmptyValue` field
* The behavior of combinations marked _n/a_ is undefined
* The `undefined` replaces the `empty` column in previous versions of this specification in order to better align with [RFC6570 §2.3](https://www.rfc-editor.org/rfc/rfc6570.html#section-2.3) terminology, which describes certain values including but not limited to `null` as "undefined" values with special handling; notably, the empty string is _not_ undefined
-* For `form` and the non-RFC6570 query string styles `spaceDelimited`, `pipeDelimited`, and `deepObject`, each example is shown prefixed with `?` as if it were the only query parameter; see [Appendix C](#usingRFC6570Implementations) for more information on constructing query strings from multiple parameters, and [Appendix D](#serializingHeadersAndCookies) for warnings regarding `form` and cookie parameters
-* Note that the `?` prefix is not appropriate for serializing `application/x-www-form-urlencoded` HTTP message bodies, and MUST be stripped or (if constructing the string manually) not added when used in that context; see the [Encoding Object](#encodingObject) for more information
-* The examples are percent-encoded as required by RFC6570 and RFC3986; see [Appendix E](#percentEncodingAndFormMediaTypes) for a thorough discussion of percent-encoding concerns, including why unencoded `|` (`%7C`), `[` (`%5B`), and `]` (`%5D`) seem to work in some environments despite not being compliant.
+* For `form` and the non-RFC6570 query string styles `spaceDelimited`, `pipeDelimited`, and `deepObject`, each example is shown prefixed with `?` as if it were the only query parameter; see [Appendix C](#appendix-c-using-rfc6570-implementations) for more information on constructing query strings from multiple parameters, and [Appendix D](#appendix-d-serializing-headers-and-cookies) for warnings regarding `form` and cookie parameters
+* Note that the `?` prefix is not appropriate for serializing `application/x-www-form-urlencoded` HTTP message bodies, and MUST be stripped or (if constructing the string manually) not added when used in that context; see the [Encoding Object](#encoding-object) for more information
+* The examples are percent-encoded as required by RFC6570 and RFC3986; see [Appendix E](#appendix-e-percent-encoding-and-form-media-types) for a thorough discussion of percent-encoding concerns, including why unencoded `|` (`%7C`), `[` (`%5B`), and `]` (`%5D`) seem to work in some environments despite not being compliant.
-| [`style`](#styleValues) | `explode` | `empty` | `string` | `array` | `object` |
+| [`style`](#style-values) | `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 |
@@ -1435,7 +1435,7 @@ content:
type: number
```
-#### Request Body Object
+#### Request Body Object
Describes a single request body.
@@ -1443,11 +1443,11 @@ Describes a single request body.
| Field Name | Type | Description |
| ------------------------------------------------ | :--------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](https://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`. |
+| description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| content | Map[`string`, [Media Type Object](#media-type-object)] | **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).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### Request Body Examples
@@ -1528,7 +1528,7 @@ content:
externalValue: https://foo.bar/examples/user-example.whatever
```
-#### Media Type Object
+#### Media Type Object
Each Media Type Object provides schema and examples for the media type identified by its key.
@@ -1540,12 +1540,12 @@ See [Working With Examples](#working-with-examples) for further guidance regardi
| Field Name | Type | Description |
| ---------------------------------------- | :--------------------------------------------------------------------------------------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| schema | [Schema Object](#schemaObject) | The schema defining the content of the request, response, parameter, or header. |
-| example | Any | Example of the media type; see [Working With Examples](#working-with-examples). |
-| examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type; see [Working With Examples](#working-with-examples). |
-| encoding | Map[`string`, [Encoding Object](#encodingObject)] | A map between a property name and information providing more control over the serialization of the value. The key, being the property name, MUST exist in the schema as a property. The encoding attribute SHALL only apply to [Request Body Objects](#requestBodyObject), and only when the media type is `multipart` or `application/x-www-form-urlencoded`. If no Encoding Object is provided for a property, the behavior is determined by the default values documented for the Encoding Object. |
+| schema | [Schema Object](#schema-object) | The schema defining the content of the request, response, parameter, or header. |
+| example | Any | Example of the media type; see [Working With Examples](#working-with-examples). |
+| examples | Map[ `string`, [Example Object](#example-object) \| [Reference Object](#reference-object)] | Examples of the media type; see [Working With Examples](#working-with-examples). |
+| encoding | Map[`string`, [Encoding Object](#encoding-object)] | A map between a property name and information providing more control over the serialization of the value. The key, being the property name, MUST exist in the schema as a property. The encoding attribute SHALL only apply to [Request Body Objects](#request-body-object), and only when the media type is `multipart` or `application/x-www-form-urlencoded`. If no Encoding Object is provided for a property, the behavior is determined by the default values documented for the Encoding Object. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### Media Type Examples
@@ -1613,7 +1613,7 @@ application/json:
In contrast with the 2.0 specification, `file` input/output content in OpenAPI is described with the same semantics as any other schema type.
-In contrast with the 3.0 specification, the `format` keyword has no effect on the content-encoding of the schema. Instead, JSON Schema's `contentEncoding` and `contentMediaType` keywords are used. See [Working With Binary Data](#binaryData) for how to model various scenarios with these keywords, and how to migrate from the previous `format` usage.
+In contrast with the 3.0 specification, the `format` keyword has no effect on the content-encoding of the schema. Instead, JSON Schema's `contentEncoding` and `contentMediaType` keywords are used. See [Working With Binary Data](#working-with-binary-data) for how to model various scenarios with these keywords, and how to migrate from the previous `format` usage.
Examples:
@@ -1662,15 +1662,15 @@ See [Encoding the `x-www-form-urlencoded` Media Type](#encoding-the-x-www-form-u
See [Encoding `multipart` Media Types](#encoding-multipart-media-types) for further guidance and examples, both with and without the `encoding` attribute.
-#### Encoding Object
+#### Encoding Object
A single encoding definition applied to a single schema property.
-See [Appendix B](#dataTypeConversion) for a discussion of converting values of various types to string representations.
+See [Appendix B](#appendix-b-data-type-conversion) for a discussion of converting values of various types to string representations.
Properties are correlated with `multipart` parts using the `name` parameter to `Content-Disposition: form-data`, and with `application/x-www-form-urlencoded` using the query string parameter names.
In both cases, their order is implementation-defined.
-See [Appendix E](#percentEncodingAndFormMediaTypes) for a detailed examination of percent-encoding concerns for form media types.
+See [Appendix E](#appendix-e-percent-encoding-and-form-media-types) for a detailed examination of percent-encoding concerns for form media types.
##### Fixed Fields
@@ -1680,16 +1680,16 @@ These fields MAY be used either with or without the RFC6570-style serialization
| Field Name | Type | Description |
| --------------------------------------------- | :-----------------------------------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| contentType | `string` | The `Content-Type` for encoding a specific property. The value is a comma-separated list, each element of which is either a specific media type (e.g. `image/png`) or a wildcard media type (e.g. `image/*`). Default value depends on the property type as shown in the table below. |
-| headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | A map allowing additional information to be provided as headers. `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`. |
+| contentType | `string` | The `Content-Type` for encoding a specific property. The value is a comma-separated list, each element of which is either a specific media type (e.g. `image/png`) or a wildcard media type (e.g. `image/*`). Default value depends on the property type as shown in the table below. |
+| headers | Map[`string`, [Header Object](#header-object) \| [Reference Object](#reference-object)] | A map allowing additional information to be provided as headers. `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`. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
The default values for `contentType` are as follows, where an _n/a_ in the `contentEncoding` column means that the presence or value of `contentEncoding` is irrelevant:
| Property `type` | Property `contentEncoding` | Default `contentType` |
| --------------------------------- | -------------------------- | --------------------------------------------- |
-| [_absent_](#binaryData) | _n/a_ | `application/octet-stream` |
+| [_absent_](#working-with-binary-data) | _n/a_ | `application/octet-stream` |
| `string` | _present_ | `application/octet-stream` |
| `string` | _absent_ | `text/plain` |
| `number`, `integer`, or `boolean` | _n/a_ | `text/plain` |
@@ -1698,31 +1698,31 @@ The default values for `contentType` are as follows, where an _n/a_ in the `cont
Determining how to handle a `type` value of `null` depends on how `null` values are being serialized.
If `null` values are entirely omitted, then the `contentType` is irrelevant.
-See [Appendix B](#dataTypeConversion) for a discussion of data type conversion options.
+See [Appendix B](#appendix-b-data-type-conversion) for a discussion of data type conversion options.
###### Fixed Fields for RFC6570-style Serialization
| Field Name | Type | Description |
| ------------------------------------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| 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. Note that the initial `?` used in query strings is not used in `application/x-www-form-urlencoded` message bodies, and MUST be removed (if using an RFC6570 implementation) or simply not added (if constructing the string manually). This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](#encodingContentType) (implicit or explicit) SHALL be ignored. |
-| 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`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject` is undefined. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](#encodingContentType) (implicit or explicit) SHALL be ignored. |
-| allowReserved | `boolean` | When this is true, parameter values are serialized using reserved expansion, as defined by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#autoid-20), which allows [RFC3986's reserved character set](https://datatracker.ietf.org/doc/html/rfc3986#autoid-13), as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#autoid-24) (`[`, `]`, `#`), or have a special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see Appendices [C](#usingRFC6570Implementations) and [E](#percentEncodingAndFormMediaTypes) for details. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](#encodingContentType) (implicit or explicit) SHALL be ignored. |
+| style | `string` | Describes how a specific property value will be serialized depending on its type. See [Parameter Object](#parameter-object) for details on the [`style`](#parameter-style) property. The behavior follows the same values as `query` parameters, including default values. Note that the initial `?` used in query strings is not used in `application/x-www-form-urlencoded` message bodies, and MUST be removed (if using an RFC6570 implementation) or simply not added (if constructing the string manually). This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](#encoding-content-type) (implicit or explicit) SHALL be ignored. |
+| 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`](#encoding-style) is `form`, the default value is `true`. For all other styles, the default value is `false`. Note that despite `false` being the default for `deepObject`, the combination of `false` with `deepObject` is undefined. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](#encoding-content-type) (implicit or explicit) SHALL be ignored. |
+| allowReserved | `boolean` | When this is true, parameter values are serialized using reserved expansion, as defined by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570#autoid-20), which allows [RFC3986's reserved character set](https://datatracker.ietf.org/doc/html/rfc3986#autoid-13), as well as percent-encoded triples, to pass through unchanged, while still percent-encoding all other disallowed characters (including `%` outside of percent-encoded triples). Applications are still responsible for percent-encoding reserved characters that are [not allowed in the query string](https://datatracker.ietf.org/doc/html/rfc3986#autoid-24) (`[`, `]`, `#`), or have a special meaning in `application/x-www-form-urlencoded` (`-`, `&`, `+`); see Appendices [C](#appendix-c-using-rfc6570-implementations) and [E](#appendix-e-percent-encoding-and-form-media-types) for details. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](#encoding-content-type) (implicit or explicit) SHALL be ignored. |
-See also [Appendix C: Using RFC6570 Implementations](#usingRFC6570Implementations) for additional guidance, including on difficulties caused by the interaction between RFC6570's percent-encoding rules and the `multipart/form-data` media type.
+See also [Appendix C: Using RFC6570 Implementations](#appendix-c-using-rfc6570-implementations) for additional guidance, including on difficulties caused by the interaction between RFC6570's percent-encoding rules and the `multipart/form-data` media type.
Note that the presence of at least one of `style`, `explode`, or `allowReserved` with an explicit value is equivalent to using `schema` with `in: query` Parameter Objects.
The absence of all three of those fields is the equivalent of using `content`, but with the media type specified in `contentType` rather than through a Media Type Object.
##### Encoding the `x-www-form-urlencoded` Media Type
-To submit content using form url encoding via [RFC1866](https://tools.ietf.org/html/rfc1866), use the `application/x-www-form-urlencoded` media type in the [Media Type Object](#mediaTypeObject) under the [Request Body Object](#requestBodyObject).
+To submit content using form url encoding via [RFC1866](https://tools.ietf.org/html/rfc1866), use the `application/x-www-form-urlencoded` media type in the [Media Type Object](#media-type-object) under the [Request Body Object](#request-body-object).
This configuration means that the request body MUST be encoded per [RFC1866](https://tools.ietf.org/html/rfc1866) when passed to the server, after any complex objects have been serialized to a string representation.
-See [Appendix E](#percentEncodingAndFormMediaTypes) for a detailed examination of percent-encoding concerns for form media types.
+See [Appendix E](#appendix-e-percent-encoding-and-form-media-types) for a detailed examination of percent-encoding concerns for form media types.
###### Example: URL Encoded Form with JSON Values
-When there is no [`encoding` field](#mediaTypeEncoding), the serialization strategy is based on the Encoding Object's default values:
+When there is no [`encoding` field](#media-type-encoding), the serialization strategy is based on the Encoding Object's default values:
```yaml
requestBody:
@@ -1757,7 +1757,7 @@ Assuming the most compact representation of the JSON value (with unnecessary whi
id=f81d4fae-7dec-11d0-a765-00a0c91e6bf6&address=%7B%22streetAddress%22:%22123+Example+Dr.%22,%22city%22:%22Somewhere%22,%22state%22:%22CA%22,%22zip%22:%2299999%2B1234%22%7D
```
-Note that the `id` keyword is treated as `text/plain` per the [Encoding Object](#encodingObject)'s default behavior, and is serialized as-is.
+Note that the `id` keyword is treated as `text/plain` per the [Encoding Object](#encoding-object)'s default behavior, and is serialized as-is.
If it were treated as `application/json`, then the serialized value would be a JSON string including quotation marks, which would be percent-encoded as `%22`.
Here is the `id` parameter (without `address`) serialized as `application/json` instead of `text/plain`, and then encoded per RFC1866:
@@ -1815,13 +1815,13 @@ Note that there are significant restrictions on what headers can be used with `m
Note also that `Content-Transfer-Encoding` is deprecated for `multipart/form-data` ([RFC7578 §4.7](https://www.rfc-editor.org/rfc/rfc7578.html#section-4.7)) where binary data is supported, as it is in HTTP.
-+Using `contentEncoding` for a multipart field is equivalent to specifying an [Encoding Object](#encodingObject) with a `headers` field containing `Content-Transfer-Encoding` with a schema that requires the value used in `contentEncoding`.
++Using `contentEncoding` for a multipart field is equivalent to specifying an [Encoding Object](#encoding-object) with a `headers` field containing `Content-Transfer-Encoding` with a schema that requires the value used in `contentEncoding`.
+If `contentEncoding` is used for a multipart field that has an Encoding Object with a `headers` field containing `Content-Transfer-Encoding` with a schema that disallows the value from `contentEncoding`, the result is undefined for serialization and parsing.
-Note that as stated in [Working with Binary Data](#binaryData), if the Encoding Object's `contentType`, whether set explicitly or implicitly through its default value rules, disagrees with the `contentMediaType` in a Schema Object, the `contentMediaType` SHALL be ignored.
+Note that as stated in [Working with Binary Data](#working-with-binary-data), if the Encoding Object's `contentType`, whether set explicitly or implicitly through its default value rules, disagrees with the `contentMediaType` in a Schema Object, the `contentMediaType` SHALL be ignored.
Because of this, and because the Encoding Object's `contentType` defaulting rules do not take the Schema Object's`contentMediaType` into account, the use of `contentMediaType` with an Encoding Object is NOT RECOMMENDED.
-See [Appendix E](#percentEncodingAndFormMediaTypes) for a detailed examination of percent-encoding concerns for form media types.
+See [Appendix E](#appendix-e-percent-encoding-and-form-media-types) for a detailed examination of percent-encoding concerns for form media types.
###### Example: Basic Multipart Form
@@ -1911,9 +1911,9 @@ requestBody:
items: {}
```
-As seen in the [Encoding Object's `contentType` field documentation](#encodingContentType), the empty schema for `items` indicates a media type of `application/octet-stream`.
+As seen in the [Encoding Object's `contentType` field documentation](#encoding-content-type), the empty schema for `items` indicates a media type of `application/octet-stream`.
-#### Responses Object
+#### Responses Object
A container for the expected responses of an operation.
The container maps a HTTP response code to the expected response.
@@ -1932,15 +1932,15 @@ call.
| 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. |
+| default | [Response Object](#response-object) \| [Reference Object](#reference-object) | The documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. |
##### 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. 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]`. Only the following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code. |
+| [HTTP Status Code](#http-status-codes) | [Response Object](#response-object) \| [Reference Object](#reference-object) | Any [HTTP status code](#http-status-codes) can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. 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]`. Only the following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response 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).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### Responses Object Example
@@ -1986,7 +1986,7 @@ default:
$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.
@@ -1995,12 +1995,12 @@ Describes a single response from an API Operation, including design-time, static
| Field Name | Type | Description |
| --------------------------------------------- | :-----------------------------------------------------------------------------------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| description | `string` | **REQUIRED**. A description of the response. [CommonMark syntax](https://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). |
+| description | `string` | **REQUIRED**. A description of the response. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| headers | Map[`string`, [Header Object](#header-object) \| [Reference Object](#reference-object)] | 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](#media-type-object)] | 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](#link-object) \| [Reference 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](#components-object). |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### Response Object Examples
@@ -2125,27 +2125,27 @@ Response with no return value:
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](#pathItemObject) that describes a set of requests that may be initiated by the API provider and the expected responses.
+Each value in the map is a [Path Item Object](#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 path item object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
-To describe incoming requests from the API provider independent from another API call, use the [`webhooks`](#oasWebhooks) field.
+To describe incoming requests from the API provider independent from another API call, use the [`webhooks`](#oas-webhooks) field.
##### 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. |
+| {expression} | [Path Item Object](#path-item-object) | 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).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### 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.
+The key that identifies the [Path Item Object](#path-item-object) is a [runtime expression](#runtime-expressions) 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.
+However, using a [runtime expression](#runtime-expressions) 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:
@@ -2184,7 +2184,7 @@ The following examples show how the various expressions evaluate, assuming the c
##### Callback Object Examples
-The following example uses the user provided `queryUrl` query string parameter to define the callback URL. This is similar to a [webhook](#oasWebhooks), but differs in that the callback only occurs because of the initial request that sent the `queryUrl`.
+The following example uses the user provided `queryUrl` query string parameter to define the callback URL. This is similar to a [webhook](#oas-webhooks), but differs in that the callback only occurs because of the initial request that sent the `queryUrl`.
```yaml
myCallback:
@@ -2218,10 +2218,10 @@ transactionCallback:
description: callback successfully processed
```
-#### Example Object
+#### Example Object
An object grouping an internal or external example value with basic `summary` and `description` metadata.
-This object is typically used in properties named `examples` (plural), and is a [referenceable](#referenceObject) alternative to older `example` (singular) fields that do not support referencing or metadata.
+This object is typically used in properties named `examples` (plural), and is a [referenceable](#reference-object) alternative to older `example` (singular) fields that do not support referencing or metadata.
Examples allow demonstration of the usage of properties, parameters and objects within OpenAPI.
@@ -2229,28 +2229,28 @@ Examples allow demonstration of the usage of properties, parameters and objects
| Field Name | Type | Description |
| ------------------------------------------------ | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| summary | `string` | Short description for the example. |
-| description | `string` | Long description for the example. [CommonMark syntax](https://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 URI that identifies 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. See the rules for resolving [Relative References](#relativeReferencesURI). |
+| summary | `string` | Short description for the example. |
+| description | `string` | Long description for the example. [CommonMark syntax](https://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 URI that identifies 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. See the rules for resolving [Relative References](#relative-references-in-api-description-uris). |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
In all cases, the example value SHOULD be compatible with the schema of its associated value.
Tooling implementations MAY choose to validate compatibility automatically, and reject the example value(s) if incompatible.
#### Working With Examples
-Example Objects can be used in both [Parameter Objects](#parameterObject) and [Media Type Objects](#mediaTypeObject).
+Example Objects can be used in both [Parameter Objects](#parameter-object) and [Media Type Objects](#media-type-object).
In both Objects, this is done through the `examples` (plural) field.
-However, there are several other ways to provide examples: The `example` (singular) field that is mutually exclusive with `examples` in both Objects, and two keywords (the deprecated singular `example` and the current plural `examples`, which takes an array of examples) in the [Schema Object](#schemaObject) that appears in the `schema` field of both Objects.
+However, there are several other ways to provide examples: The `example` (singular) field that is mutually exclusive with `examples` in both Objects, and two keywords (the deprecated singular `example` and the current plural `examples`, which takes an array of examples) in the [Schema Object](#schema-object) that appears in the `schema` field of both Objects.
Each of these fields has slightly different considerations.
The Schema Object's fields are used to show example values without regard to how they might be formatted as parameters or within media type representations.
The `examples` array is part of JSON Schema and is the preferred way to include examples in the Schema Object, while `example` is retained purely for compatibility with older versions of the OpenAPI Specification.
The mutually exclusive fields in the Parameter or Media Type Objects are used to show example values which SHOULD both match the schema and be formatted as they would appear as a serialized parameter or within a media type representation.
-The exact serialization and encoding is determined by various fields in the Parameter Object, or in the Media Type Object's [Encoding Object](#encodingObject).
+The exact serialization and encoding is determined by various fields in the Parameter Object, or in the Media Type Object's [Encoding Object](#encoding-object).
Because examples using these fields represent the final serialized form of the data, they SHALL _override_ any `example` in the corresponding Schema Object.
The singular `example` field in the Parameter or Media Type object is concise and convenient for simple examples, but does not offer any other advantages over using Example Objects under `examples`.
@@ -2391,27 +2391,27 @@ application/x-www-form-urlencoded:
In this example, the JSON string had to be serialized before encoding it into the URL form value, so the example includes the quotation marks that are part of the JSON serialization, which are then URL percent-encoded.
-#### 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](#runtimeExpression) is used for accessing values in an operation and using them as parameters while invoking the linked operation.
+For computing links, and providing instructions to execute them, a [runtime expression](#runtime-expressions) 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 URI identifying 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 description. See the rules for resolving [Relative References](#relativeReferencesURI). |
-| 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 (optionally qualified with the parameter location, e.g. `path.id` for an `id` parameter in the path), whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. |
-| 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](https://spec.commonmark.org/) MAY be used for rich text representation. |
-| server | [Server Object](#serverObject) | A server object to be used by the target operation. |
+| operationRef | `string` | A URI identifying an OAS operation. This field is mutually exclusive of the `operationId` field, and MUST point to an [Operation Object](#operation-object). Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operation-object) in the OpenAPI description. See the rules for resolving [Relative References](#relative-references-in-api-description-uris). |
+| 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}](#runtime-expressions)] | 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 (optionally qualified with the parameter location, e.g. `path.id` for an `id` parameter in the path), whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. |
+| requestBody | Any \| [{expression}](#runtime-expressions) | A literal value or [{expression}](#runtime-expressions) to use as a request body when calling the target operation. |
+| description | `string` | A description of the link. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| server | [Server Object](#server-object) | A server object to be used by the target operation. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#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 OpenAPI description.
@@ -2491,7 +2491,7 @@ solely by the existence of a relationship.
##### OperationRef Examples
As references to `operationId` MAY NOT be possible (the `operationId` is an optional
-field in an [Operation Object](#operationObject)), references MAY also be made through a relative `operationRef`:
+field in an [Operation Object](#operation-object)), references MAY also be made through a relative `operationRef`:
```yaml
links:
@@ -2516,10 +2516,10 @@ links:
Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when
using JSON Pointer, and it is necessary to URL-encode `{` and `}` as `%7B` and `%7D`, respectively when using JSON Pointer as URI fragments.
-##### 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](#linkObject) and [Callback Objects](#callbackObject).
+This mechanism is used by [Link Objects](#link-object) and [Callback Objects](#callback-object).
The runtime expression is defined by the following [ABNF](https://tools.ietf.org/html/rfc5234) syntax
@@ -2548,7 +2548,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
| Source Location | example expression | notes |
| --------------------- | :------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -2563,15 +2563,15 @@ The table below provides examples of runtime expressions and examples of their u
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
-Describes a single header for [HTTP responses](#responseHeaders) and for [individual parts in `multipart` representations](#encodingHeaders); see the relevant [Response Object](#responseObject) and [Encoding Object](#encodingObject) documentation for restrictions on which headers can be described.
+Describes a single header for [HTTP responses](#response-headers) and for [individual parts in `multipart` representations](#encoding-headers); see the relevant [Response Object](#response-object) and [Encoding Object](#encoding-object) documentation for restrictions on which headers can be described.
-The Header Object follows the structure of the [Parameter Object](#parameterObject), including determining its serialization strategy based on whether `schema` or `content` is present, with the following changes:
+The Header Object follows the structure of the [Parameter Object](#parameter-object), including determining its serialization strategy based on whether `schema` or `content` is present, 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)). This means that `allowEmptyValue` and `allowReserved` MUST NOT be used, and `style`, if used, MUST be limited to `simple`.
+1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, [`style`](#parameter-style)). This means that `allowEmptyValue` and `allowReserved` MUST NOT be used, and `style`, if used, MUST be limited to `simple`.
##### Fixed Fields
@@ -2581,40 +2581,40 @@ These fields MAY be used with either `content` or `schema`.
| Field Name | Type | Description |
| ------------------------------------------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| description | `string` | A brief description of the header. This could contain examples of use. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
-| required | `boolean` | Determines whether this header is mandatory. The default value is `false`. |
-| deprecated | `boolean` | Specifies that the header is deprecated and SHOULD be transitioned out of usage. Default value is `false`. |
+| description | `string` | A brief description of the header. This could contain examples of use. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| required | `boolean` | Determines whether this header is mandatory. The default value is `false`. |
+| deprecated | `boolean` | Specifies that the header is deprecated and SHOULD be transitioned out of usage. Default value is `false`. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
###### Fixed Fields for use with `schema`
-For simpler scenarios, a [`schema`](#headerSchema) and [`style`](#headerStyle) can describe the structure and syntax of the header.
+For simpler scenarios, a [`schema`](#header-schema) and [`style`](#header-style) can describe the structure and syntax of the header.
When `example` or `examples` are provided in conjunction with the `schema` object, the example MUST follow the prescribed serialization strategy for the header.
-Serializing with `schema` is NOT RECOMMENDED for headers with parameters (name=value pairs following a `;`) in their values, or where values might have non-URL-safe characters; see [Appendix D](#serializingHeadersAndCookies) for details.
+Serializing with `schema` is NOT RECOMMENDED for headers with parameters (name=value pairs following a `;`) in their values, or where values might have non-URL-safe characters; see [Appendix D](#appendix-d-serializing-headers-and-cookies) for details.
When `example` or `examples` are provided in conjunction with the `schema` object, the example SHOULD match the specified schema and follow the prescribed serialization strategy for the header.
The `example` and `examples` fields are mutually exclusive, and if either is present it SHALL _override_ any `example` in the schema.
| Field Name | Type | Description |
| ------------------------------------- | :--------------------------------------------------------------------------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| style | `string` | Describes how the header value will be serialized. The default (and only legal value for headers) is `simple`. |
-| explode | `boolean` | When this is true, header values of type `array` or `object` generate a single header whose value is a comma-separated list of the array items or key-value pairs of the map, see [Style Examples](#style-examples). For other data types this property has no effect. The default value is `false`. |
-| schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the header. |
-| example | Any | Example of the header's potential value; see [Working With Examples](#working-with-examples). |
-| examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the header's potential value; see [Working With Examples](#working-with-examples). |
+| style | `string` | Describes how the header value will be serialized. The default (and only legal value for headers) is `simple`. |
+| explode | `boolean` | When this is true, header values of type `array` or `object` generate a single header whose value is a comma-separated list of the array items or key-value pairs of the map, see [Style Examples](#style-examples). For other data types this property has no effect. The default value is `false`. |
+| schema | [Schema Object](#schema-object) \| [Reference Object](#reference-object) | The schema defining the type used for the header. |
+| example | Any | Example of the header's potential value; see [Working With Examples](#working-with-examples). |
+| examples | Map[ `string`, [Example Object](#example-object) \| [Reference Object](#reference-object)] | Examples of the header's potential value; see [Working With Examples](#working-with-examples). |
-See also [Appendix C: Using RFC6570 Implementations](#usingRFC6570Implementations) for additional guidance.
+See also [Appendix C: Using RFC6570 Implementations](#appendix-c-using-rfc6570-implementations) for additional guidance.
###### Fixed Fields for use with `content`
-For more complex scenarios, the [`content`](#headerContent) property can define the media type and schema of the header, as well as give examples of its use.
+For more complex scenarios, the [`content`](#header-content) property can define the media type and schema of the header, as well as give examples of its use.
Using `content` with a `text/plain` media type is RECOMMENDED for headers where the `schema` strategy is not appropriate.
| Field Name | Type | Description |
| ----------------------------------- | :--------------------------------------------------: | ----------------------------------------------------------------------------------------------------------------------------------------------- |
-| content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the header. The key is the media type and the value describes it. The map MUST only contain one entry. |
+| content | Map[`string`, [Media Type Object](#media-type-object)] | A map containing the representations for the header. The key is the media type and the value describes it. The map MUST only contain one entry. |
##### Header Object Example
@@ -2662,20 +2662,20 @@ ETag:
pattern: ^"
```
-#### Tag Object
+#### Tag Object
-Adds metadata to a single tag that is used by the [Operation Object](#operationObject).
+Adds metadata to a single tag that is used by the [Operation Object](#operation-object).
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 description for the tag. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
-| externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this tag. |
+| name | `string` | **REQUIRED**. The name of the tag. |
+| description | `string` | A description for the tag. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
+| externalDocs | [External Documentation Object](#external-documentation-object) | Additional external documentation for this tag. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### Tag Object Example
@@ -2691,25 +2691,25 @@ name: pet
description: Pets operations
```
-#### Reference Object
+#### Reference Object
A simple object to allow referencing other components in the OpenAPI document, internally and externally.
The `$ref` string value contains a URI [RFC3986](https://tools.ietf.org/html/rfc3986), which identifies the value being referenced.
-See the rules for resolving [Relative References](#relativeReferencesURI).
+See the rules for resolving [Relative References](#relative-references-in-api-description-uris).
##### Fixed Fields
| Field Name | Type | Description |
| ---------------------------------------------- | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| $ref | `string` | **REQUIRED**. The reference identifier. This MUST be in the form of a URI. |
-| summary | `string` | A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a `summary` field, then this field has no effect. |
-| description | `string` | A description which by default SHOULD override that of the referenced component. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. If the referenced object-type does not allow a `description` field, then this field has no effect. |
+| $ref | `string` | **REQUIRED**. The reference identifier. This MUST be in the form of a URI. |
+| summary | `string` | A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a `summary` field, then this field has no effect. |
+| description | `string` | A description which by default SHOULD override that of the referenced component. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. If the referenced object-type does not allow a `description` field, then this field has no effect. |
This object cannot be extended with additional properties and any properties added SHALL be ignored.
-Note that this restriction on additional properties is a difference between Reference Objects and [Schema Objects](#schemaObject) that contain a `$ref` keyword.
+Note that this restriction on additional properties is a difference between Reference Objects and [Schema Objects](#schema-object) that contain a `$ref` keyword.
##### Reference Object Example
@@ -2747,7 +2747,7 @@ $ref: Pet.yaml
$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 a superset of the [JSON Schema Specification Draft 2020-12](https://tools.ietf.org/html/draft-bhutton-json-schema-00). The empty schema (which allows any instance to validate) MAY be represented by the `boolean` value `true` and a schema which allows no instance to validate MAY be represented by the `boolean` value `false`.
@@ -2759,44 +2759,44 @@ Where JSON Schema indicates that behavior is defined by the application (e.g. fo
##### Properties
-The OpenAPI Schema Object [dialect](https://tools.ietf.org/html/draft-bhutton-json-schema-00#section-4.3.3) is defined as requiring the [OAS base vocabulary](#baseVocabulary), in addition to the vocabularies as specified in the JSON Schema draft 2020-12 [general purpose meta-schema](https://tools.ietf.org/html/draft-bhutton-json-schema-00#section-8).
+The OpenAPI Schema Object [dialect](https://tools.ietf.org/html/draft-bhutton-json-schema-00#section-4.3.3) is defined as requiring the [OAS base vocabulary](#oas-base-vocabulary), in addition to the vocabularies as specified in the JSON Schema draft 2020-12 [general purpose meta-schema](https://tools.ietf.org/html/draft-bhutton-json-schema-00#section-8).
-The OpenAPI Schema Object dialect for this version of the specification is identified by the URI `https://spec.openapis.org/oas/3.1/dialect/base` (the "OAS dialect schema id").
+The OpenAPI Schema Object dialect for this version of the specification is identified by the URI `https://spec.openapis.org/oas/3.1/dialect/base` (the "OAS dialect schema id").
The following properties are taken from the JSON Schema specification but their definitions have been extended by the OAS:
* description - [CommonMark syntax](https://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.
+* format - See [Data Type Formats](#data-type-format) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats.
In addition to the JSON Schema properties comprising the OAS dialect, the Schema Object supports keywords from any other vocabularies, or entirely arbitrary properties.
JSON Schema implementations MAY choose to treat keywords defined by the OpenAPI Specification's base vocabulary as [unknown keywords](https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-4.3.1), due to its inclusion in the OAS dialect with a [`$vocabulary`](https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.1.2) value of `false`.
The OAS base vocabulary is comprised of the following keywords:
-##### Fixed Fields
+##### Fixed Fields
| Field Name | Type | Description |
| ----------------------------------------------- | :-----------------------------------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| discriminator | [Discriminator Object](#discriminatorObject) | Adds support for polymorphism. The discriminator is used to determine which of a set of schemas a payload is expected to satisfy. See [Composition and Inheritance](#schemaComposition) for more details. |
-| 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:** The `example` property has been deprecated in favor of the JSON Schema `examples` keyword. Use of `example` is discouraged, and later versions of this specification may remove it. |
+| discriminator | [Discriminator Object](#discriminator-object) | Adds support for polymorphism. The discriminator is used to determine which of a set of schemas a payload is expected to satisfy. See [Composition and Inheritance](#composition-and-inheritance-polymorphism) for more details. |
+| xml | [XML Object](#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](#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:** The `example` property has been deprecated in favor of the JSON Schema `examples` keyword. Use of `example` is discouraged, and later versions of this specification may remove it. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions), though as noted, additional properties MAY omit the `x-` prefix within this object.
+This object MAY be extended with [Specification Extensions](#specification-extensions), though as noted, additional properties MAY omit the `x-` prefix within this object.
-###### 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.
-To support polymorphism, the OpenAPI Specification adds the [`discriminator`](#schemaDiscriminator) field.
+To support polymorphism, the OpenAPI Specification adds the [`discriminator`](#schema-discriminator) field.
When used, the `discriminator` indicates the name of the property that hints which schema definition is expected to validate 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](#discriminatorMapping) by overriding the property with a new value. If a new value exists, this takes precedence over the schema name.
+* [Override the schema name](#discriminator-mapping) by overriding the property with a new value. If a new value exists, this takes precedence over the schema name.
###### Generic (Template) Data Structures
@@ -2809,8 +2809,8 @@ An example is included in the "Schema Object Examples" section below, and furthe
###### 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.
+The [xml](#schema-xml) property allows extra definitions when translating the JSON definition to XML.
+The [XML Object](#xml-object) contains additional information about the available options.
###### Specifying Schema Dialects
@@ -2820,7 +2820,7 @@ The `$schema` keyword MAY be present in any Schema Object that is a [schema reso
To allow use of a different default `$schema` value for all Schema Objects contained within an OAS document, a `jsonSchemaDialect` value may be set within the OpenAPI Object. If this default is not set, then the OAS dialect schema id MUST be used for these Schema Objects. The value of `$schema` within a resource root Schema Object always overrides any default.
-For standalone JSON Schema documents that do not set `$schema`, or for Schema Objects in OpenAPI description documents that are _not_ [complete documents](#documentStructure), the dialect SHOULD be assumed to be the OAS dialect.
+For standalone JSON Schema documents that do not set `$schema`, or for Schema Objects in OpenAPI description documents that are _not_ [complete documents](#openapi-description-structure), the dialect SHOULD be assumed to be the OAS dialect.
However, for maximum interoperability, it is RECOMMENDED that OpenAPI description authors explicitly set the dialect through `$schema` in such documents.
##### Schema Object Examples
@@ -3245,7 +3245,7 @@ components:
$ref: array_of_numbers
```
-#### Discriminator Object
+#### Discriminator Object
When request bodies or response payloads may be one of a number of different schemas, a Discriminator Object gives a hint about the expected schema of the document.
This hint can be used to aid in serialization, deserialization, and validation.
@@ -3257,10 +3257,10 @@ Note that `discriminator` MUST NOT change the validation outcome of the schema.
| Field Name | Type | Description |
| ------------------------------------------- | :---------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminating value. This property SHOULD be required in the payload schema, as the behavior when the property is absent is undefined. |
-| mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or URI references. |
+| propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminating value. This property SHOULD be required in the payload schema, as the behavior when the property is absent is undefined. |
+| mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or URI references. |
-This object MAY be extended with [Specification Extensions](#specificationExtensions).
+This object MAY be extended with [Specification Extensions](#specification-extensions).
##### Conditions for Using the Discriminator Object
@@ -3277,7 +3277,7 @@ The behavior of any configuration of `oneOf`, `anyOf`, `allOf` and `discriminato
##### Options for Mapping Values to Schemas
-The value of the property named in `propertyName` is used as the name of the associated schema under the [Components Object](#componentsObject), _unless_ a `mapping` is present for that value.
+The value of the property named in `propertyName` is used as the name of the associated schema under the [Components Object](#components-object), _unless_ a `mapping` is present for that value.
The `mapping` entry maps a specific property value to either a different schema component name, or to a schema identified by a URI.
When using implicit or explicit schema component names, inline `oneOf` or `anyOf` subschemas are not considered.
The behavior of a `mapping` value that is both a valid schema name and a valid relative URI reference is implementation-defined, but it is RECOMMENDED that it be treated as a schema name.
@@ -3286,9 +3286,9 @@ To ensure that an ambiguous value (e.g. `"foo"`) is treated as a relative URI re
Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison.
However, the exact nature of such conversions are implementation-defined.
-##### Examples
+##### Examples
-For these examples, assume all schemas are in the entry OpenAPI document; for handling of `discriminator` in referenced documents see [Resolving Implicit Connections](#resolvingImplicitConnections).
+For these examples, assume all schemas are in the entry OpenAPI document; for handling of `discriminator` in referenced documents see [Resolving Implicit Connections](#resolving-implicit-connections).
In OAS 3.x, a response payload MAY be described to be exactly one of any number of types:
@@ -3405,7 +3405,7 @@ will indicate that the `#/components/schemas/Cat` schema is expected to match. L
will map to `#/components/schemas/Dog` because the `dog` entry in the `mapping` element maps to `Dog` which is the schema name for `#/components/schemas/Dog`.
-#### XML Object
+#### XML Object
A metadata object that allows for more fine-tuned XML model definitions.
@@ -3416,13 +3416,13 @@ See examples for expected behavior.
| 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 a non-relative 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, `form‑urlencoded
|
| [RFC1866 §8.2.1 form‑urlencoded](https://datatracker.ietf.org/doc/html/rfc1866#section-8.2.1) | 11/1995 | content-based serialization | RFC1738 | obsoleted by [HTML 4.01 §17.13.4.1](https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1), [WHATWG URL §5](https://url.spec.whatwg.org/#urlencoded-serializing) |
-Style-based serialization is used in the [Parameter Object](#parameterObject) when `schema` is present, and in the [Encoding Object](#encodingObject) when at least one of `style`, `explode`, or `allowReserved` is present.
-See [Appendix C](#usingRFC6570Implementations) for more details of RFC6570's two different approaches to percent-encoding, including an example involving `+`.
+Style-based serialization is used in the [Parameter Object](#parameter-object) when `schema` is present, and in the [Encoding Object](#encoding-object) when at least one of `style`, `explode`, or `allowReserved` is present.
+See [Appendix C](#appendix-c-using-rfc6570-implementations) for more details of RFC6570's two different approaches to percent-encoding, including an example involving `+`.
-Content-based serialization is defined by the [Media Type Object](#mediaTypeObject), and used with the [Parameter Object](#parameterObject) when the `content` field is present, and with the [Encoding Object](#encodingObject) based on the `contentType` field when the style fields listed in the previous section are absent.
+Content-based serialization is defined by the [Media Type Object](#media-type-object), and used with the [Parameter Object](#parameter-object) when the `content` field is present, and with the [Encoding Object](#encoding-object) based on the `contentType` field when the style fields listed in the previous section are absent.
Each part is encoded based on the media type (e.g. `text/plain` or `application/json`), and must then be percent-encoded for use in a `form-urlencoded` string.
Note that content-based serialization for `form-data` does not expect or require percent-encoding in the data, only in per-part header values.
@@ -4570,3 +4570,4 @@ Code that relies on leaving these delimiters unencoded, while using regular perc
For maximum interoperability, it is RECOMMENDED to either define and document an additional escape convention while percent-encoding the delimiters for these styles, or to avoid these styles entirely.
The exact method of additional encoding/escaping is left to the API designer, and is expected to be performed before serialization and encoding described in this specification, and reversed after this specification's encoding and serialization steps are reversed.
This keeps it outside of the processes governed by this specification.
+
From c5a0fa66a8f8cb3b855b3d3d8c138a9049afd4c7 Mon Sep 17 00:00:00 2001
From: Lorna Mitchell form‑urlencoded
|
-| [RFC1866 §8.2.1 form‑urlencoded](https://datatracker.ietf.org/doc/html/rfc1866#section-8.2.1) | 11/1995 | content-based serialization | RFC1738 | obsoleted by [HTML 4.01 §17.13.4.1](https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1), [WHATWG URL §5](https://url.spec.whatwg.org/#urlencoded-serializing) |
+| [RFC3986](https://datatracker.ietf.org/doc/html/rfc3986) | 01/2005 | URI/URL syntax | [[RFC3986]] | obsoletes [[RFC1738]], [[RFC2396]] |
+| [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570) | 03/2012 | style-based serialization | [[RFC3986]] | does not use `+` for form‑urlencoded
|
+| [RFC1866](https://datatracker.ietf.org/doc/html/rfc1866#section-8.2.1) | 11/1995 | content-based serialization | [[RFC1738]] | obsoleted by [[HTML401]] [Section 17.13.4.1](https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1), [[URL]] [Section 5](https://url.spec.whatwg.org/#urlencoded-serializing) |
Style-based serialization is used in the [Parameter Object](#parameter-object) when `schema` is present, and in the [Encoding Object](#encoding-object) when at least one of `style`, `explode`, or `allowReserved` is present.
See [Appendix C](#appendix-c-using-rfc6570-implementations) for more details of RFC6570's two different approaches to percent-encoding, including an example involving `+`.
From 5c2368c7eece20ccf421b3d857ce04c04a4edc6e Mon Sep 17 00:00:00 2001
From: Ralf Handl OpenAPI Specification v30.0.1
What is the OpenAPI Specification?
The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP 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.
Text for first chapter
+This is the conformance section
+Text for first section
+Text for first subsection
+Version | +Date | +
---|---|
30.0.1 | +3001-04-01 | +
Copyright © 3001 the Linux Foundation
Text for first chapter
+This is the conformance section
+Text for first section
+Text for first subsection
+Version | +Date | +
---|---|
30.0.1 | +3001-04-01 | +
Copyright © ${options.publishDate.getFullYear()} the Linux Foundation
`; diff --git a/tests/md2html/fixtures/.gitattributes b/tests/md2html/fixtures/.gitattributes new file mode 100644 index 0000000000..9a582600c1 --- /dev/null +++ b/tests/md2html/fixtures/.gitattributes @@ -0,0 +1 @@ +*.html text eol=lf \ No newline at end of file diff --git a/tests/md2html/fixtures/basic-new.html b/tests/md2html/fixtures/basic-new.html index cc8807fc74..5280441b47 100644 --- a/tests/md2html/fixtures/basic-new.html +++ b/tests/md2html/fixtures/basic-new.html @@ -1,69 +1,4 @@ -Copyright © 3001 the Linux Foundation
Copyright © 3001 the Linux Foundation
Text for first chapter
Copyright © 3001 the Linux Foundation
Copyright © 3001 the Linux Foundation
Text for first chapter
Text for first section
Text for first subsection
+
+{
+ "foo": true
+}
+
+
+text/plain
+
+
+no language
+