From 45971dfe66be360b731cc4456b1839644b16b6ee Mon Sep 17 00:00:00 2001
From: Ron
+in | `string` | **REQUIRED**. The location of the parameter. Possible values are "query", "header", "path" or "cookie".
+description | `string` | A brief description of the parameter. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation.
+required | `boolean` | Determines whether this parameter is mandatory. If the [parameter location](#parameterIn) is "path", this property is **REQUIRED** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`.
+ deprecated | `boolean` | Specifies that a parameter is deprecated and SHOULD be transitioned out of usage.
+ allowEmptyValue | `boolean` | Sets the ability to pass empty-valued parameters. This is valid only for `query` parameters and allows sending a parameter with an empty value. Default value is `false`. If [`style`](#parameterStyle) is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored.
+
+The rules for serialization of the parameter are specified in one of two ways.
+For simpler scenarios, a [`schema`](#parameterSchema) and [`style`](#parameterStyle) can describe the structure and syntax of the parameter.
+
+Field Name | Type | Description
+---|:---:|---
+style | `string` | Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`.
+explode | `boolean` | When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When [`style`](#parameterStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`.
+allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`.
+schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the parameter.
+example | Any | Example of the media type. The example SHOULD match the specified schema and encoding properties if present. The `example` field is mutually exclusive of the `examples` field. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema. To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.
+examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example SHOULD contain a value in the correct format as specified in the parameter encoding. The `examples` field is mutually exclusive of the `example` field. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema.
+
+For more complex scenarios, the [`content`](#parameterContent) property can define the media type and schema of the parameter.
+A parameter MUST contain either a `schema` property, or a `content` property, but not both.
+When `example` or `examples` are provided in conjunction with the `schema` object, the example MUST follow the prescribed serialization strategy for the parameter.
+
+
+Field Name | Type | Description
+---|:---:|---
+content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.
+
+##### Style Values
+
+In order to support common ways of serializing simple parameters, a set of `style` values are defined.
+
+`style` | [`type`](#dataTypes) | `in` | Comments
+----------- | ------ | -------- | --------
+matrix | `primitive`, `array`, `object` | `path` | Path-style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.7)
+label | `primitive`, `array`, `object` | `path` | Label style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.5)
+form | `primitive`, `array`, `object` | `query`, `cookie` | Form style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.8). This option replaces `collectionFormat` with a `csv` (when `explode` is false) or `multi` (when `explode` is true) value from OpenAPI 2.0.
+simple | `array` | `path`, `header` | Simple style parameters defined by [RFC6570](https://tools.ietf.org/html/rfc6570#section-3.2.2). This option replaces `collectionFormat` with a `csv` value from OpenAPI 2.0.
+spaceDelimited | `array` | `query` | Space separated array values. This option replaces `collectionFormat` equal to `ssv` from OpenAPI 2.0.
+pipeDelimited | `array` | `query` | Pipe separated array values. This option replaces `collectionFormat` equal to `pipes` from OpenAPI 2.0.
+deepObject | `object` | `query` | Provides a simple way of rendering nested objects using form parameters.
+
+
+##### Style Examples
+
+Assume a parameter named `color` has one of the following values:
+
+```
+ string -> "blue"
+ array -> ["blue","black","brown"]
+ object -> { "R": 100, "G": 200, "B": 150 }
+```
+The following table shows examples of rendering differences for each value.
+
+[`style`](#dataTypeFormat) | `explode` | `empty` | `string` | `array` | `object`
+----------- | ------ | -------- | -------- | --------|-------
+matrix | false | ;color | ;color=blue | ;color=blue,black,brown | ;color=R,100,G,200,B,150
+matrix | true | ;color | ;color=blue | ;color=blue;color=black;color=brown | ;R=100;G=200;B=150
+label | false | . | .blue | .blue.black.brown | .R.100.G.200.B.150
+label | true | . | .blue | .blue.black.brown | .R=100.G=200.B=150
+form | false | color= | color=blue | color=blue,black,brown | color=R,100,G,200,B,150
+form | true | color= | color=blue | color=blue&color=black&color=brown | R=100&G=200&B=150
+simple | false | n/a | blue | blue,black,brown | R,100,G,200,B,150
+simple | true | n/a | blue | blue,black,brown | R=100,G=200,B=150
+spaceDelimited | false | n/a | n/a | blue%20black%20brown | R%20100%20G%20200%20B%20150
+pipeDelimited | false | n/a | n/a | blue\|black\|brown | R\|100\|G\|200|G\|150
+deepObject | true | n/a | n/a | n/a | color[R]=100&color[G]=200&color[B]=150
+
+This object MAY be extended with [Specification Extensions](#specificationExtensions).
+
+##### Parameter Object Examples
+
+A header parameter with an array of 64 bit integer numbers:
+
+```json
+{
+ "name": "token",
+ "in": "header",
+ "description": "token to be passed as a header",
+ "required": true,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "integer",
+ "format": "int64"
+ }
+ },
+ "style": "simple"
+}
+```
+
+```yaml
+name: token
+in: header
+description: token to be passed as a header
+required: true
+schema:
+ type: array
+ items:
+ type: integer
+ format: int64
+style: simple
+```
+
+A path parameter of a string value:
+```json
+{
+ "name": "username",
+ "in": "path",
+ "description": "username to fetch",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+}
+```
+
+```yaml
+name: username
+in: path
+description: username to fetch
+required: true
+schema:
+ type: string
+```
+
+An optional query parameter of a string value, allowing multiple values by repeating the query parameter:
+```json
+{
+ "name": "id",
+ "in": "query",
+ "description": "ID of the object to fetch",
+ "required": false,
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "style": "form",
+ "explode": true
+}
+```
+
+```yaml
+name: id
+in: query
+description: ID of the object to fetch
+required: false
+schema:
+ type: array
+ items:
+ type: string
+style: form
+explode: true
+```
+
+A free-form query parameter, allowing undefined parameters of a specific type:
+```json
+{
+ "in": "query",
+ "name": "freeForm",
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "integer"
+ },
+ },
+ "style": "form"
+}
+```
+
+```yaml
+in: query
+name: freeForm
+schema:
+ type: object
+ additionalProperties:
+ type: integer
+style: form
+```
+
+A complex parameter using `content` to define serialization:
+
+```json
+{
+ "in": "query",
+ "name": "coordinates",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "required": [
+ "lat",
+ "long"
+ ],
+ "properties": {
+ "lat": {
+ "type": "number"
+ },
+ "long": {
+ "type": "number"
+ }
+ }
+ }
+ }
+ }
+}
+```
+
+```yaml
+in: query
+name: coordinates
+content:
+ application/json:
+ schema:
+ type: object
+ required:
+ - lat
+ - long
+ properties:
+ lat:
+ type: number
+ long:
+ type: number
+```
+
+#### Request Body Object
+
+Describes a single request body.
+
+##### Fixed Fields
+Field Name | Type | Description
+---|:---:|---
+description | `string` | A brief description of the request body. This could contain examples of use. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation.
+content | Map[`string`, [Media Type Object](#mediaTypeObject)] | **REQUIRED**. The content of the request body. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
+required | `boolean` | Determines if the request body is required in the request. Defaults to `false`.
+
+
+This object MAY be extended with [Specification Extensions](#specificationExtensions).
+
+##### Request Body Examples
+
+A request body with a referenced model definition.
+```json
+{
+ "description": "user to add to the system",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/User"
+ },
+ "examples": {
+ "user" : {
+ "summary": "User Example",
+ "externalValue": "http://foo.bar/examples/user-example.json"
+ }
+ }
+ },
+ "application/xml": {
+ "schema": {
+ "$ref": "#/components/schemas/User"
+ },
+ "examples": {
+ "user" : {
+ "summary": "User example in XML",
+ "externalValue": "http://foo.bar/examples/user-example.xml"
+ }
+ }
+ },
+ "text/plain": {
+ "examples": {
+ "user" : {
+ "summary": "User example in Plain text",
+ "externalValue": "http://foo.bar/examples/user-example.txt"
+ }
+ }
+ },
+ "*/*": {
+ "examples": {
+ "user" : {
+ "summary": "User example in other format",
+ "externalValue": "http://foo.bar/examples/user-example.whatever"
+ }
+ }
+ }
+ }
+}
+```
+
+```yaml
+description: user to add to the system
+content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/User'
+ examples:
+ user:
+ summary: User Example
+ externalValue: 'http://foo.bar/examples/user-example.json'
+ 'application/xml':
+ schema:
+ $ref: '#/components/schemas/User'
+ examples:
+ user:
+ summary: User Example in XML
+ externalValue: 'http://foo.bar/examples/user-example.xml'
+ 'text/plain':
+ examples:
+ user:
+ summary: User example in text plain format
+ externalValue: 'http://foo.bar/examples/user-example.txt'
+ '*/*':
+ examples:
+ user:
+ summary: User example in other format
+ externalValue: 'http://foo.bar/examples/user-example.whatever'
+```
+
+A body parameter that is an array of string values:
+```json
+{
+ "description": "user to add to the system",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+}
+```
+
+```yaml
+description: user to add to the system
+required: true
+content:
+ text/plain:
+ schema:
+ type: array
+ items:
+ type: string
+```
+
+
+#### Media Type Object
+Each Media Type Object provides schema and examples for the media type identified by its key.
+
+##### Fixed Fields
+Field Name | Type | Description
+---|:---:|---
+schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body.
+example | Any | Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` 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
+
+```js
+{
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Pet"
+ },
+ "examples": {
+ "cat" : {
+ "summary": "An example of a cat",
+ "value":
+ {
+ "name": "Fluffy",
+ "petType": "Cat",
+ "color": "White",
+ "gender": "male",
+ "breed": "Persian"
+ }
+ },
+ "dog": {
+ "summary": "An example of a dog with a cat's name",
+ "value" : {
+ "name": "Puma",
+ "petType": "Dog",
+ "color": "Black",
+ "gender": "Female",
+ "breed": "Mixed"
+ },
+ "frog": {
+ "$ref": "#/components/examples/frog-example"
+ }
+ }
+ }
+ }
+}
+```
+
+```yaml
+application/json:
+ schema:
+ $ref: "#/components/schemas/Pet"
+ examples:
+ cat:
+ summary: An example of a cat
+ value:
+ name: Fluffy
+ petType: Cat
+ color: White
+ gender: male
+ breed: Persian
+ dog:
+ summary: An example of a dog with a cat's name
+ value:
+ name: Puma
+ petType: Dog
+ color: Black
+ gender: Female
+ breed: Mixed
+ frog:
+ $ref: "#/components/examples/frog-example"
+```
+
+##### Considerations for File Uploads
+
+In contrast with the 2.0 specification, `file` input/output content in OpenAPI is described with the same semantics as any other schema type. Specifically:
+
+```yaml
+# content transferred with base64 encoding
+schema:
+ type: string
+ format: base64
+```
+
+```yaml
+# content transferred in binary (octet-stream):
+schema:
+ type: string
+ format: binary
+```
+
+These examples apply to either input payloads of file uploads or response payloads.
+
+A `requestBody` for submitting a file in a `POST` operation may look like the following example:
+
+```yaml
+requestBody:
+ content:
+ application/octet-stream:
+ # any media type is accepted, functionally equivalent to `*/*`
+ schema:
+ # a binary file of any type
+ type: string
+ format: binary
+```
+
+In addition, specific media types MAY be specified:
+
+```yaml
+# multiple, specific media types may be specified:
+requestBody:
+ content:
+ # a binary file of type png or jpeg
+ 'image/jpeg':
+ schema:
+ type: string
+ format: binary
+ 'image/png':
+ schema:
+ type: string
+ format: binary
+```
+
+To upload multiple files, a `multipart` media type MUST be used:
+
+```yaml
+requestBody:
+ content:
+ multipart/form-data:
+ schema:
+ properties:
+ # The property name 'file' will be used for all files.
+ file:
+ type: array
+ items:
+ type: string
+ format: binary
+
+```
+
+##### Support for x-www-form-urlencoded Request Bodies
+
+To submit content using form url encoding via [RFC1866](https://tools.ietf.org/html/rfc1866), the following
+definition may be used:
+
+```yaml
+requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ type: object
+ properties:
+ id:
+ type: string
+ format: uuid
+ address:
+ # complex types are stringified to support RFC 1866
+ type: object
+ properties: {}
+```
+
+In this example, the contents in the `requestBody` MUST be stringified per [RFC1866](https://tools.ietf.org/html/rfc1866/) when passed to the server. In addition, the `address` field complex object will be stringified.
+
+When passing complex objects in the `application/x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the [`Encoding Object`](#encodingObject)'s [`style`](#encodingStyle) property as `form`.
+
+##### Special Considerations for `multipart` Content
+
+It is common to use `multipart/form-data` as a `Content-Type` when transferring request bodies to operations. In contrast to 2.0, a `schema` is REQUIRED to define the input parameters to the operation when using `multipart` content. This supports complex structures as well as supporting mechanisms for multiple file uploads.
+
+When passing in `multipart` types, boundaries MAY be used to separate sections of the content being transferred — thus, the following default `Content-Type`s are defined for `multipart`:
+
+* If the property is a primitive, or an array of primitive values, the default Content-Type is `text/plain`
+* If the property is complex, or an array of complex values, the default Content-Type is `application/json`
+* If the property is a `type: string` with `format: binary` or `format: base64` (aka a file object), the default Content-Type is `application/octet-stream`
+
+
+Examples:
+
+```yaml
+requestBody:
+ content:
+ multipart/form-data:
+ schema:
+ type: object
+ properties:
+ id:
+ type: string
+ format: uuid
+ address:
+ # default Content-Type for objects is `application/json`
+ type: object
+ properties: {}
+ profileImage:
+ # default Content-Type for string/binary is `application/octet-stream`
+ type: string
+ format: binary
+ children:
+ # default Content-Type for arrays is based on the `inner` type (text/plain here)
+ type: array
+ items:
+ type: string
+ addresses:
+ # default Content-Type for arrays is based on the `inner` type (object shown, so `application/json` in this example)
+ type: array
+ items:
+ type: '#/components/schemas/Address'
+```
+
+An `encoding` attribute is introduced to give you control over the serialization of parts of `multipart` request bodies. This attribute is _only_ applicable to `multipart` and `application/x-www-form-urlencoded` request bodies.
+
+#### Encoding Object
+
+A single encoding definition applied to a single schema property.
+
+##### Fixed Fields
+Field Name | Type | Description
+---|:---:|---
+contentType | `string` | The Content-Type for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. The value can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types.
+headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | A map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a `multipart`.
+style | `string` | Describes how a specific property value will be serialized depending on its type. See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values as `query` parameters, including default values. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`.
+explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`.
+allowReserved | `boolean` | Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`.
+
+This object MAY be extended with [Specification Extensions](#specificationExtensions).
+
+##### Encoding Object Example
+
+```yaml
+requestBody:
+ content:
+ multipart/mixed:
+ schema:
+ type: object
+ properties:
+ id:
+ # default is text/plain
+ type: string
+ format: uuid
+ address:
+ # default is application/json
+ type: object
+ properties: {}
+ historyMetadata:
+ # need to declare XML format!
+ description: metadata in XML format
+ type: object
+ properties: {}
+ profileImage:
+ # default is application/octet-stream, need to declare an image type only!
+ type: string
+ format: binary
+ encoding:
+ historyMetadata:
+ # require XML Content-Type in utf-8 encoding
+ contentType: application/xml; charset=utf-8
+ profileImage:
+ # only accept png/jpeg
+ contentType: image/png, image/jpeg
+ headers:
+ X-Rate-Limit-Limit:
+ description: The number of allowed requests in the current period
+ schema:
+ type: integer
+```
+
+#### Responses Object
+
+A container for the expected responses of an operation.
+The container maps a HTTP response code to the expected response.
+
+The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance.
+However, documentation is expected to cover a successful operation response and any known errors.
+
+The `default` MAY be used as a default response object for all HTTP codes
+that are not covered individually by the specification.
+
+The `Responses Object` MUST contain at least one response code, and it
+SHOULD be the response for a successful operation call.
+
+##### Fixed Fields
+Field Name | Type | Description
+---|:---:|---
+default | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | The documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. A [Reference Object](#referenceObject) can link to a response that the [OpenAPI Object's components/responses](#componentsResponses) section defines.
+
+##### Patterned Fields
+Field Pattern | Type | Description
+---|:---:|---
+[HTTP Status Code](#httpCodes) | [Response Object](#responseObject) \| [Reference Object](#referenceObject) | Any [HTTP status code](#httpCodes) can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A [Reference Object](#referenceObject) can link to a response that is defined in the [OpenAPI Object's components/responses](#componentsResponses) section. This field MUST be enclosed in quotation marks (for example, "200") for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character `X`. For example, `2XX` represents all response codes between `[200-299]`. The following range definitions are allowed: `1XX`, `2XX`, `3XX`, `4XX`, and `5XX`. If a response range is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code.
+
+
+This object MAY be extended with [Specification Extensions](#specificationExtensions).
+
+##### Responses Object Example
+
+A 200 response for a successful operation and a default response for others (implying an error):
+
+```json
+{
+ "200": {
+ "description": "a pet to be returned",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Pet"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unexpected error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorModel"
+ }
+ }
+ }
+ }
+}
+```
+
+```yaml
+'200':
+ description: a pet to be returned
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+default:
+ description: Unexpected error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorModel'
+```
+
+#### Response Object
+Describes a single response from an API Operation, including design-time, static
+`links` to operations based on the response.
+
+##### Fixed Fields
+Field Name | Type | Description
+---|:---:|---
+description | `string` | **REQUIRED**. A short description of the response. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation.
+headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | Maps a header name to its definition. [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name `"Content-Type"`, it SHALL be ignored.
+content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing descriptions of potential response payloads. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
+links | Map[`string`, [Link Object](#linkObject) \| [Reference Object](#referenceObject)] | A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for [Component Objects](#componentsObject).
+
+This object MAY be extended with [Specification Extensions](#specificationExtensions).
+
+##### Response Object Examples
+
+Response of an array of a complex type:
+
+```json
+{
+ "description": "A complex object array response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/VeryComplexType"
+ }
+ }
+ }
+ }
+}
+```
+
+```yaml
+description: A complex object array response
+content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/VeryComplexType'
+```
+
+Response with a string type:
+
+```json
+{
+ "description": "A simple string response",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+
+}
+```
+
+```yaml
+description: A simple string response
+content:
+ text/plain:
+ schema:
+ type: string
+```
+
+Plain text response with headers:
+
+```json
+{
+ "description": "A simple string response",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ },
+ "headers": {
+ "X-Rate-Limit-Limit": {
+ "description": "The number of allowed requests in the current period",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "X-Rate-Limit-Remaining": {
+ "description": "The number of remaining requests in the current period",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "X-Rate-Limit-Reset": {
+ "description": "The number of seconds left in the current period",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ }
+}
+```
+
+```yaml
+description: A simple string response
+content:
+ text/plain:
+ schema:
+ type: string
+ example: 'whoa!'
+headers:
+ X-Rate-Limit-Limit:
+ description: The number of allowed requests in the current period
+ schema:
+ type: integer
+ X-Rate-Limit-Remaining:
+ description: The number of remaining requests in the current period
+ schema:
+ type: integer
+ X-Rate-Limit-Reset:
+ description: The number of seconds left in the current period
+ schema:
+ type: integer
+```
+
+Response with no return value:
+
+```json
+{
+ "description": "object created"
+}
+```
+
+```yaml
+description: object created
+```
+
+#### Callback Object
+
+A map of possible out-of band callbacks related to the parent operation.
+Each value in the map is a [Path Item Object](#pathItemObject) that describes a set of requests that may be initiated by the API provider and the expected responses.
+The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
+
+##### Patterned Fields
+Field Pattern | Type | Description
+---|:---:|---
+{expression} | [Path Item Object](#pathItemObject) | A Path Item Object used to define a callback request and expected responses. A [complete example](../examples/v3.0/callback-example.yaml) is available.
+
+This object MAY be extended with [Specification Extensions](#specificationExtensions).
+
+##### Key Expression
+
+The key that identifies the [Path Item Object](#pathItemObject) is a [runtime expression](#runtimeExpression) that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request.
+A simple example might be `$request.body#/url`.
+However, using a [runtime expression](#runtimeExpression) the complete HTTP message can be accessed.
+This includes accessing any part of a body that a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901) can reference.
+
+For example, given the following HTTP request:
+
+```http
+POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1
+Host: example.org
+Content-Type: application/json
+Content-Length: 187
+
+{
+ "failedUrl" : "http://clientdomain.com/failed",
+ "successUrls" : [
+ "http://clientdomain.com/fast",
+ "http://clientdomain.com/medium",
+ "http://clientdomain.com/slow"
+ ]
+}
+
+201 Created
+Location: http://example.org/subscription/1
+```
+
+The following examples show how the various expressions evaluate, assuming the callback operation has a path parameter named `eventType` and a query parameter named `queryUrl`.
+
+Expression | Value
+---|:---
+$url | http://example.org/subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning
+$method | POST
+$request.path.eventType | myevent
+$request.query.queryUrl | http://clientdomain.com/stillrunning
+$request.header.content-Type | application/json
+$request.body#/failedUrl | http://clientdomain.com/stillrunning
+$request.body#/successUrls/2 | http://clientdomain.com/medium
+$response.header.Location | http://example.org/subscription/1
+
+
+##### Callback Object Example
+
+The following example shows a callback to the URL specified by the `id` and `email` property in the request body.
+
+```yaml
+myWebhook:
+ 'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
+ post:
+ requestBody:
+ description: Callback payload
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/SomePayload'
+ responses:
+ '200':
+ description: webhook successfully processed and no retries will be performed
+```
+
+
+#### Example Object
+
+##### Fixed Fields
+Field Name | Type | Description
+---|:---:|---
+summary | `string` | Short description for the example.
+description | `string` | Long description for the example. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation.
+value | Any | Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary.
+externalValue | `string` | A URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The `value` field and `externalValue` field are mutually exclusive.
+
+This object MAY be extended with [Specification Extensions](#specificationExtensions).
+
+In all cases, the example value is expected to be compatible with the type schema
+of its associated value. Tooling implementations MAY choose to
+validate compatibility automatically, and reject the example value(s) if incompatible.
+
+##### Example Object Example
+
+```yaml
+# in a model
+schemas:
+ properties:
+ name:
+ type: string
+ examples:
+ name:
+ $ref: http://example.org/petapi-examples/openapi.json#/components/examples/name-example
+
+# in a request body:
+ requestBody:
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/Address'
+ examples:
+ foo:
+ summary: A foo example
+ value: {"foo": "bar"}
+ bar:
+ summary: A bar example
+ value: {"bar": "baz"}
+ 'application/xml':
+ examples:
+ xmlExample:
+ summary: This is an example in XML
+ externalValue: 'http://example.org/examples/address-example.xml'
+ 'text/plain':
+ examples:
+ textExample:
+ summary: This is a text example
+ externalValue: 'http://foo.bar/examples/address-example.txt'
+
+
+# in a parameter
+ parameters:
+ - name: 'zipCode'
+ in: 'query'
+ schema:
+ type: 'string'
+ format: 'zip-code'
+ examples:
+ zip-example:
+ $ref: '#/components/examples/zip-example'
+
+# in a response
+ responses:
+ '200':
+ description: your car appointment has been booked
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SuccessResponse'
+ examples:
+ confirmation-success:
+ $ref: '#/components/examples/confirmation-success'
+```
+
+
+#### Link Object
+
+The `Link object` represents a possible design-time link for a response.
+The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.
+
+Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response.
+
+For computing links, and providing instructions to execute them, a [runtime expression](#runtimeExpression) is used for accessing values in an operation and using them as parameters while invoking the linked operation.
+
+##### Fixed Fields
+
+Field Name | Type | Description
+---|:---:|---
+operationRef | `string` | A relative or absolute reference to an OAS operation. This field is mutually exclusive of the `operationId` field, and MUST point to an [Operation Object](#operationObject). Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OpenAPI definition.
+operationId | `string` | The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive of the `operationRef` field.
+parameters | Map[`string`, Any \| [{expression}](#runtimeExpression)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the [parameter location](#parameterIn) `[{in}.]{name}` for operations that use the same parameter name in different locations (e.g. path.id).
+requestBody | Any \| [{expression}](#runtimeExpression) | A literal value or [{expression}](#runtimeExpression) to use as a request body when calling the target operation.
+description | `string` | A description of the link. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation.
+server | [Server Object](#serverObject) | A server object to be used by the target operation.
+
+This object MAY be extended with [Specification Extensions](#specificationExtensions).
+
+A linked operation MUST be identified using either an `operationRef` or `operationId`.
+In the case of an `operationId`, it MUST be unique and resolved in the scope of the OAS document.
+Because of the potential for name clashes, the `operationRef` syntax is preferred
+for specifications with external references.
+
+##### Examples
+
+Computing a link from a request operation where the `$request.path.id` is used to pass a request parameter to the linked operation.
+
+```yaml
+paths:
+ /users/{id}:
+ parameters:
+ - name: id
+ in: path
+ required: true
+ description: the user identifier, as userId
+ schema:
+ type: string
+ get:
+ responses:
+ '200':
+ description: the user being returned
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ uuid: # the unique user id
+ type: string
+ format: uuid
+ links:
+ address:
+ # the target link operationId
+ operationId: getUserAddress
+ parameters:
+ # get the `id` field from the request path parameter named `id`
+ userId: $request.path.id
+ # the path item of the linked operation
+ /users/{userid}/address:
+ parameters:
+ - name: userid
+ in: path
+ required: true
+ description: the user identifier, as userId
+ schema:
+ type: string
+ # linked operation
+ get:
+ operationId: getUserAddress
+ responses:
+ '200':
+ description: the user's address
+```
+
+When a runtime expression fails to evaluate, no parameter value is passed to the target operation.
+
+Values from the response body can be used to drive a linked operation.
+
+```yaml
+links:
+ address:
+ operationId: getUserAddressByUUID
+ parameters:
+ # get the `uuid` field from the `uuid` field in the response body
+ userUuid: $response.body#/uuid
+```
+
+Clients follow all links at their discretion.
+Neither permissions, nor the capability to make a successful call to that link, is guaranteed
+solely by the existence of a relationship.
+
+
+##### OperationRef Examples
+
+As references to `operationId` MAY NOT be possible (the `operationId` is an optional
+value), references MAY also be made through a relative `operationRef`:
+
+```yaml
+links:
+ UserRepositories:
+ # returns array of '#/components/schemas/repository'
+ operationRef: '#/paths/~12.0~1repositories~1{username}/get'
+ parameters:
+ username: $response.body#/username
+```
+
+or an absolute `operationRef`:
+
+```yaml
+links:
+ UserRepositories:
+ # returns array of '#/components/schemas/repository'
+ operationRef: 'https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get'
+ parameters:
+ username: $response.body#/username
+```
+
+Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when
+using JSON references.
+
+
+##### Runtime Expressions
+
+Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call.
+This mechanism is used by [Link Objects](#linkObject) and [Callback Objects](#callbackObject).
+
+The runtime expression is defined by the following [ABNF](https://tools.ietf.org/html/rfc5234) syntax
+
+```
+ expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source )
+ source = ( header-reference | query-reference | path-reference | body-reference )
+ header-reference = "header." token
+ query-reference = "query." name
+ path-reference = "path." name
+ body-reference = "body" ["#" fragment]
+ fragment = a JSON Pointer [RFC 6901](https://tools.ietf.org/html/rfc6901)
+ name = *( char )
+ char = as per RFC [7159](https://tools.ietf.org/html/rfc7159#section-7)
+ token = as per RFC [7230](https://tools.ietf.org/html/rfc7230#section-3.2.6)
+```
+
+The `name` identifier is case-sensitive, whereas `token` is not.
+
+The table below provides examples of runtime expressions and examples of their use in a value:
+
+##### Examples
+
+Source Location | example expression | notes
+---|:---|:---|
+HTTP Method | `$method` | The allowable values for the `$method` will be those for the HTTP operation.
+Requested media type | `$request.header.accept` |
+Request parameter | `$request.path.id` | Request parameters MUST be declared in the `parameters` section of the parent operation or they cannot be evaluated. This includes request headers.
+Request body property | `$request.body#/user/uuid` | In operations which accept payloads, references may be made to portions of the `requestBody` or the entire body.
+Request URL | `$url` |
+Response value | `$response.body#/status` | In operations which return payloads, references may be made to portions of the response body or the entire body.
+Response header | `$response.header.Server` | Single header values only are available
+
+Runtime expressions preserve the type of the referenced value.
+Expressions can be embedded into string values by surrounding the expression with `{}` curly braces.
+
+#### Header Object
+
+The Header Object follows the structure of the [Parameter Object](#parameterObject) with the following changes:
+
+1. `name` MUST NOT be specified, it is given in the corresponding `headers` map.
+1. `in` MUST NOT be specified, it is implicitly in `header`.
+1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, [`style`](#parameterStyle)).
+
+##### Header Object Example
+
+A simple header of type `integer`:
+
+```json
+{
+ "description": "The number of allowed requests in the current period",
+ "schema": {
+ "type": "integer"
+ }
+}
+```
+
+```yaml
+description: The number of allowed requests in the current period
+schema:
+ type: integer
+```
+
+#### Tag Object
+
+Adds metadata to a single tag that is used by the [Operation Object](#operationObject).
+It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.
+
+##### Fixed Fields
+Field Name | Type | Description
+---|:---:|---
+name | `string` | **REQUIRED**. The name of the tag.
+description | `string` | A short description for the tag. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation.
+externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this tag.
+
+This object MAY be extended with [Specification Extensions](#specificationExtensions).
+
+##### Tag Object Example
+
+```json
+{
+ "name": "pet",
+ "description": "Pets operations"
+}
+```
+
+```yaml
+name: pet
+description: Pets operations
+```
+
+
+#### Reference Object
+
+A simple object to allow referencing other components in the specification, internally and externally.
+
+The Reference Object is defined by [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) and follows the same structure, behavior and rules.
+
+For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.
+
+##### Fixed Fields
+Field Name | Type | Description
+---|:---:|---
+$ref | `string` | **REQUIRED**. The reference string.
+
+This object cannot be extended with additional properties and any properties added SHALL be ignored.
+
+##### Reference Object Example
+
+```json
+{
+ "$ref": "#/components/schemas/Pet"
+}
+```
+
+```yaml
+$ref: '#/components/schemas/Pet'
+```
+
+##### Relative Schema Document Example
+```json
+{
+ "$ref": "Pet.json"
+}
+```
+
+```yaml
+$ref: Pet.yaml
+```
+
+##### Relative Documents With Embedded Schema Example
+```json
+{
+ "$ref": "definitions.json#/Pet"
+}
+```
+
+```yaml
+$ref: definitions.yaml#/Pet
+```
+
+#### Schema Object
+
+The Schema Object allows the definition of input and output data types.
+These types can be objects, but also primitives and arrays.
+This object is an extended subset of the [JSON Schema Specification Wright Draft 00](http://json-schema.org/).
+
+For more information about the properties, see [JSON Schema Core](https://tools.ietf.org/html/draft-wright-json-schema-00) and [JSON Schema Validation](https://tools.ietf.org/html/draft-wright-json-schema-validation-00).
+Unless stated otherwise, the property definitions follow the JSON Schema.
+
+##### Properties
+
+The following properties are taken directly from the JSON Schema definition and follow the same specifications:
+
+- title
+- multipleOf
+- maximum
+- exclusiveMaximum
+- minimum
+- exclusiveMinimum
+- maxLength
+- minLength
+- pattern (This string SHOULD be a valid regular expression, according to the [ECMA 262 regular expression](https://www.ecma-international.org/ecma-262/5.1/#sec-7.8.5) dialect)
+- maxItems
+- minItems
+- uniqueItems
+- maxProperties
+- minProperties
+- required
+- enum
+
+The following properties are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification.
+- type - Value MUST be a string. Multiple types via an array are not supported.
+- allOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.
+- oneOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.
+- anyOf - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.
+- not - Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.
+- items - Value MUST be an object and not an array. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema. `items` MUST be present if the `type` is `array`.
+- properties - Property definitions MUST be a [Schema Object](#schemaObject) and not a standard JSON Schema (inline or referenced).
+- additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a [Schema Object](#schemaObject) and not a standard JSON Schema.
+- description - [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation.
+- format - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats.
+- default - The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. For example, if `type` is `string`, then `default` can be `"foo"` but cannot be `1`.
+
+Alternatively, any time a Schema Object can be used, a [Reference Object](#referenceObject) can be used in its place. This allows referencing definitions instead of defining them inline.
+
+Additional properties defined by the JSON Schema specification that are not mentioned here are strictly unsupported.
+
+Other than the JSON Schema subset fields, the following fields MAY be used for further schema documentation:
+
+##### Fixed Fields
+Field Name | Type | Description
+---|:---:|---
+nullable | `boolean` | Allows sending a `null` value for the defined schema. Default value is `false`.
+discriminator | [Discriminator Object](#discriminatorObject) | Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. See [Composition and Inheritance](#schemaComposition) for more details.
+readOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as `readOnly` being `true` and is in the `required` list, the `required` will take effect on the response only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`.
+writeOnly | `boolean` | Relevant only for Schema `"properties"` definitions. Declares the property as "write only". Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as `writeOnly` being `true` and is in the `required` list, the `required` will take effect on the request only. A property MUST NOT be marked as both `readOnly` and `writeOnly` being `true`. Default value is `false`.
+xml | [XML Object](#xmlObject) | This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property.
+externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation for this schema.
+example | Any | A free-form property to include an example of an instance for this schema. To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary.
+ deprecated | `boolean` | Specifies that a schema is deprecated and SHOULD be transitioned out of usage. Default value is `false`.
+
+This object MAY be extended with [Specification Extensions](#specificationExtensions).
+
+###### Composition and Inheritance (Polymorphism)
+
+The OpenAPI Specification allows combining and extending model definitions using the `allOf` property of JSON Schema, in effect offering model composition.
+`allOf` takes an array of object definitions that are validated *independently* but together compose a single object.
+
+While composition offers model extensibility, it does not imply a hierarchy between the models.
+To support polymorphism, the OpenAPI Specification adds the `discriminator` field.
+When used, the `discriminator` will be the name of the property that decides which schema definition validates the structure of the model.
+As such, the `discriminator` field MUST be a required field.
+There are two ways to define the value of a discriminator for an inheriting instance.
+- Use the schema name.
+- Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name.
+As such, inline schema definitions, which do not have a given id, *cannot* be used in polymorphism.
+
+###### XML Modeling
+
+The [xml](#schemaXml) property allows extra definitions when translating the JSON definition to XML.
+The [XML Object](#xmlObject) contains additional information about the available options.
+
+##### Schema Object Examples
+
+###### Primitive Sample
+
+```json
+{
+ "type": "string",
+ "format": "email"
+}
+```
+
+```yaml
+type: string
+format: email
+```
+
+###### Simple Model
+
+```json
+{
+ "type": "object",
+ "required": [
+ "name"
+ ],
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "address": {
+ "$ref": "#/components/schemas/Address"
+ },
+ "age": {
+ "type": "integer",
+ "format": "int32",
+ "minimum": 0
+ }
+ }
+}
+```
+
+```yaml
+type: object
+required:
+- name
+properties:
+ name:
+ type: string
+ address:
+ $ref: '#/components/schemas/Address'
+ age:
+ type: integer
+ format: int32
+ minimum: 0
+```
+
+###### Model with Map/Dictionary Properties
+
+For a simple string to string mapping:
+
+```json
+{
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+}
+```
+
+```yaml
+type: object
+additionalProperties:
+ type: string
+```
+
+For a string to model mapping:
+
+```json
+{
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/ComplexModel"
+ }
+}
+```
+
+```yaml
+type: object
+additionalProperties:
+ $ref: '#/components/schemas/ComplexModel'
+```
+
+###### Model with Example
+
+```json
+{
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "name": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "name"
+ ],
+ "example": {
+ "name": "Puma",
+ "id": 1
+ }
+}
+```
+
+```yaml
+type: object
+properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+required:
+- name
+example:
+ name: Puma
+ id: 1
+```
+
+###### Models with Composition
+
+```json
+{
+ "components": {
+ "schemas": {
+ "ErrorModel": {
+ "type": "object",
+ "required": [
+ "message",
+ "code"
+ ],
+ "properties": {
+ "message": {
+ "type": "string"
+ },
+ "code": {
+ "type": "integer",
+ "minimum": 100,
+ "maximum": 600
+ }
+ }
+ },
+ "ExtendedErrorModel": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/ErrorModel"
+ },
+ {
+ "type": "object",
+ "required": [
+ "rootCause"
+ ],
+ "properties": {
+ "rootCause": {
+ "type": "string"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+}
+```
+
+```yaml
+components:
+ schemas:
+ ErrorModel:
+ type: object
+ required:
+ - message
+ - code
+ properties:
+ message:
+ type: string
+ code:
+ type: integer
+ minimum: 100
+ maximum: 600
+ ExtendedErrorModel:
+ allOf:
+ - $ref: '#/components/schemas/ErrorModel'
+ - type: object
+ required:
+ - rootCause
+ properties:
+ rootCause:
+ type: string
+```
+
+###### Models with Polymorphism Support
+
+```json
+{
+ "components": {
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "discriminator": {
+ "propertyName": "petType"
+ },
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "petType": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "name",
+ "petType"
+ ]
+ },
+ "Cat": {
+ "description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/Pet"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "huntingSkill": {
+ "type": "string",
+ "description": "The measured skill for hunting",
+ "default": "lazy",
+ "enum": [
+ "clueless",
+ "lazy",
+ "adventurous",
+ "aggressive"
+ ]
+ }
+ },
+ "required": [
+ "huntingSkill"
+ ]
+ }
+ ]
+ },
+ "Dog": {
+ "description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/Pet"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "packSize": {
+ "type": "integer",
+ "format": "int32",
+ "description": "the size of the pack the dog is from",
+ "default": 0,
+ "minimum": 0
+ }
+ },
+ "required": [
+ "packSize"
+ ]
+ }
+ ]
+ }
+ }
+ }
+}
+```
+
+```yaml
+components:
+ schemas:
+ Pet:
+ type: object
+ discriminator:
+ propertyName: petType
+ properties:
+ name:
+ type: string
+ petType:
+ type: string
+ required:
+ - name
+ - petType
+ Cat: ## "Cat" will be used as the discriminator value
+ description: A representation of a cat
+ allOf:
+ - $ref: '#/components/schemas/Pet'
+ - type: object
+ properties:
+ huntingSkill:
+ type: string
+ description: The measured skill for hunting
+ enum:
+ - clueless
+ - lazy
+ - adventurous
+ - aggressive
+ required:
+ - huntingSkill
+ Dog: ## "Dog" will be used as the discriminator value
+ description: A representation of a dog
+ allOf:
+ - $ref: '#/components/schemas/Pet'
+ - type: object
+ properties:
+ packSize:
+ type: integer
+ format: int32
+ description: the size of the pack the dog is from
+ default: 0
+ minimum: 0
+ required:
+ - packSize
+```
+
+#### Discriminator Object
+
+When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.
+
+When using the discriminator, _inline_ schemas will not be considered.
+
+##### Fixed Fields
+Field Name | Type | Description
+---|:---:|---
+propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminator value.
+ mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or references.
+
+The discriminator attribute is legal only when using one of the composite keywords `oneOf`, `anyOf`, `allOf`.
+
+In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:
+
+```
+MyResponseType:
+ oneOf:
+ - $ref: '#/components/schemas/Cat'
+ - $ref: '#/components/schemas/Dog'
+ - $ref: '#/components/schemas/Lizard'
+```
+
+which means the payload _MUST_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. In this case, a discriminator MAY act as a "hint" to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use:
+
+
+```
+MyResponseType:
+ oneOf:
+ - $ref: '#/components/schemas/Cat'
+ - $ref: '#/components/schemas/Dog'
+ - $ref: '#/components/schemas/Lizard'
+ discriminator:
+ propertyName: pet_type
+```
+
+The expectation now is that a property with name `pet_type` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload:
+
+```
+{
+ "id": 12345,
+ "pet_type": "Cat"
+}
+```
+
+Will indicate that the `Cat` schema be used in conjunction with this payload.
+
+In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional `mapping` definition MAY be used:
+
+```
+MyResponseType:
+ oneOf:
+ - $ref: '#/components/schemas/Cat'
+ - $ref: '#/components/schemas/Dog'
+ - $ref: '#/components/schemas/Lizard'
+ - $ref: 'https://gigantic-server.com/schemas/Monster/schema.json'
+ discriminator:
+ propertyName: pet_type
+ mapping:
+ dog: '#/components/schemas/Dog'
+ monster: 'https://gigantic-server.com/schemas/Monster/schema.json'
+```
+
+Here the discriminator _value_ of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `Dog`. If the discriminator _value_ does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Mapping keys MUST be string values, but tooling MAY convert response values to strings for comparison.
+
+When used in conjunction with the `anyOf` construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload.
+
+In both the `oneOf` and `anyOf` use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an `allOf` construct may be used as an alternate schema.
+
+For example:
+
+```
+components:
+ schemas:
+ Pet:
+ type: object
+ required:
+ - pet_type
+ properties:
+ pet_type:
+ type: string
+ discriminator:
+ propertyName: pet_type
+ mapping:
+ cachorro: Dog
+ Cat:
+ allOf:
+ - $ref: '#/components/schemas/Pet'
+ - type: object
+ # all other properties specific to a `Cat`
+ properties:
+ name:
+ type: string
+ Dog:
+ allOf:
+ - $ref: '#/components/schemas/Pet'
+ - type: object
+ # all other properties specific to a `Dog`
+ properties:
+ bark:
+ type: string
+ Lizard:
+ allOf:
+ - $ref: '#/components/schemas/Pet'
+ - type: object
+ # all other properties specific to a `Lizard`
+ properties:
+ lovesRocks:
+ type: boolean
+```
+
+a payload like this:
+
+```
+{
+ "pet_type": "Cat",
+ "name": "misty"
+}
+```
+
+will indicate that the `Cat` schema be used. Likewise this schema:
+
+```
+{
+ "pet_type": "cachorro",
+ "bark": "soft"
+}
+```
+
+will map to `Dog` because of the definition in the `mappings` element.
+
+
+#### XML Object
+
+A metadata object that allows for more fine-tuned XML model definitions.
+
+When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information.
+See examples for expected behavior.
+
+##### Fixed Fields
+Field Name | Type | Description
+---|:---:|---
+name | `string` | Replaces the name of the element/attribute used for the described schema property. When defined within `items`, it will affect the name of the individual XML elements within the list. When defined alongside `type` being `array` (outside the `items`), it will affect the wrapping element and only if `wrapped` is `true`. If `wrapped` is `false`, it will be ignored.
+namespace | `string` | The URI of the namespace definition. Value MUST be in the form of an absolute URI.
+prefix | `string` | The prefix to be used for the [name](#xmlName).
+attribute | `boolean` | Declares whether the property definition translates to an attribute instead of an element. Default value is `false`.
+wrapped | `boolean` | MAY be used only for an array definition. Signifies whether the array is wrapped (for example, `
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
+