Skip to content

Commit baf1061

Browse files
committed
Merge branch 'jasonh-n-austin-OpenAPI.next' into OpenAPI.next
2 parents 15accef + acd715b commit baf1061

File tree

1 file changed

+94
-66
lines changed

1 file changed

+94
-66
lines changed

versions/3.0.md

Lines changed: 94 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ Field Name | Type | Description
346346
<a name="pathItemHost"></a>host | `string` | The host (name or ip) serving the path. This optional value will override the top-level [host](#oasHost) if present. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the `host` is not included, the host serving the documentation is to be used (including the port). The `host` does not support [path templating](#pathTemplating).
347347
<a name="pathItemBasePath"></a>basePath | `string` | The base path on which the API is served, which is relative to the [`host`](#pathItemHost). This optional value will override the top-level [basePath](#oasBasePath) if present. If it is not included, the API is served directly under the `host`. The value MUST start with a leading slash (`/`). The `basePath` does not support [path templating](#pathTemplating).
348348
<a name="pathItemSchemes"></a>schemes | [`string`] | The transfer protocol of the API. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. This optional value will override the top-level [schemes](#oasSchemes) if present. If the `schemes` is not included, the default scheme to be used is the one used to access the OpenAPI definition itself.
349-
<a name="pathItemParameters"></a>parameters | [[Parameter Object](#parameterObject) <span>&#124;</span> [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 parameters](#oasParameters). There can be one "body" parameter at most.
349+
<a name="pathItemParameters"></a>parameters | [[Parameter Object](#parameterObject) <span>&#124;</span> [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 parameters](#oasParameters).
350350

351351
##### Patterned Fields
352352

@@ -445,7 +445,8 @@ Field Name | Type | Description
445445
<a name="operationId"></a>operationId | `string` | Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions.
446446
<a name="operationConsumes"></a>consumes | [`string`] | A list of MIME types the operation can consume. This overrides the [`consumes`](#oasConsumes) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes).
447447
<a name="operationProduces"></a>produces | [`string`] | A list of MIME types the operation can produce. This overrides the [`produces`](#oasProduces) definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](#mimeTypes).
448-
<a name="operationParameters"></a>parameters | [[Parameter Object](#parameterObject) <span>&#124;</span> [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 parameters](#oasParameters). There can be one "body" parameter at most.
448+
<a name="operationParameters"></a>parameters | [[Parameter Object](#parameterObject) <span>&#124;</span> [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 parameters](#oasParameters).
449+
<a name="operationRequestBody"></a>requestBody | [[Request Body Object](#requestBodyObject) <span>&#124;</span> [Reference Object](#referenceObject)] | The request body applicable for this operation.
449450
<a name="operationResponses"></a>responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation.
450451
<a name="operationSchemes"></a>schemes | [`string`] | The transfer protocol for the operation. Values MUST be from the list: `"http"`, `"https"`, `"ws"`, `"wss"`. The value overrides the OpenAPI Object [`schemes`](#oasSchemes) definition.
451452
<a name="operationDeprecated"></a>deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`.
@@ -595,25 +596,24 @@ Describes a single operation parameter.
595596

596597
A unique parameter is defined by a combination of a [name](#parameterName) and [___location](#parameterIn).
597598

598-
There are six possible parameter types.
599+
There are five possible parameter types.
599600
* 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`.
600601
* Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`.
601602
* Header - Custom headers that are expected as part of the request.
602-
* Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be *one* body parameter. The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation.
603603
* Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded`, `multipart/form-data` or both are used as the content type of the request (in the OpenAPI Specification's definition, the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4):
604604
* `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple parameters that are being transferred.
605605
* `multipart/form-data` - each parameter takes a section in the payload with an internal header. For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is `submit-name`. This type of form parameters is more commonly used for file transfers.
606606

607607
* Cookie - Used to pass a specific cookie value to the API.
608608

609609

610-
For complex parameter schemas, a serialization strategy is required. For parameter of type `in: body`, the serialization will be handled by the `consumes` attribute. For all other types, a serialization strategy must be declared.
610+
For complex parameter schemas, a serialization strategy is required. For all types, a serialization strategy must be declared.
611611

612612
##### Fixed Fields
613613
Field Name | Type | Description
614614
---|:---:|---
615615
<a name="parameterName"></a>name | `string` | **Required.** The name of the parameter. Parameter names are *case sensitive*. <ul><li>If [`in`](#parameterIn) is `"path"`, the `name` field MUST correspond to the associated path segment from the [path](#pathsPath) field in the [Paths Object](#pathsObject). See [Path Templating](#pathTemplating) for further information.<li>For all other cases, the `name` corresponds to the parameter name used based on the [`in`](#parameterIn) property.</ul>
616-
<a name="parameterIn"></a>in | `string` | **Required.** The ___location of the parameter. Possible values are "query", "header", "path", "formData", "body", or "cookie".
616+
<a name="parameterIn"></a>in | `string` | **Required.** The ___location of the parameter. Possible values are "query", "header", "path", "formData" or "cookie".
617617
<a name="parameterDescription"></a>description | `string` | A brief description of the parameter. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation.
618618
<a name="parameterRequired"></a>required | `boolean` | Determines whether this parameter is mandatory. If the parameter is [`in`](#parameterIn) "path", this property is **required** and its value MUST be `true`. Otherwise, the property MAY be included and its default value is `false`.
619619
<a name="parameterDeprecated"></a> deprecated | `boolean` | Specifies that a parameter is deprecated and should be transitioned out of usage.
@@ -628,59 +628,6 @@ Field Pattern | Type | Description
628628

629629
##### Parameter Object Examples
630630

631-
###### Body Parameters
632-
633-
A body parameter with a referenced schema definition (normally for a model definition):
634-
```js
635-
{
636-
"name": "user",
637-
"in": "body",
638-
"description": "user to add to the system",
639-
"required": true,
640-
"schema": {
641-
"$ref": "#/definitions/User"
642-
}
643-
}
644-
```
645-
646-
```yaml
647-
name: user
648-
in: body
649-
description: user to add to the system
650-
required: true
651-
schema:
652-
$ref: '#/definitions/User'
653-
```
654-
655-
A body parameter that is an array of string values:
656-
```js
657-
{
658-
"name": "user",
659-
"in": "body",
660-
"description": "user to add to the system",
661-
"required": true,
662-
"schema": {
663-
"type": "array",
664-
"items": {
665-
"type": "string"
666-
}
667-
}
668-
}
669-
```
670-
671-
```yaml
672-
name: user
673-
in: body
674-
description: user to add to the system
675-
required: true
676-
schema:
677-
type: array
678-
items:
679-
type: string
680-
```
681-
682-
###### Other Parameters
683-
684631
A header parameter with an array of 64 bit integer numbers:
685632

686633
```js
@@ -786,9 +733,88 @@ schema:
786733
type: file
787734
```
788735

736+
#### <a name="requestBodyObject"></a>Request Body Object
737+
738+
Describes a single request body.
739+
740+
The `Content-Type` of the request body must be specified by the `consumes` attribute, either at the [top-level](#oasConsumes) or [operation level](#operationConsumes).
741+
742+
##### Fixed Fields
743+
Field Name | Type | Description
744+
---|:---:|---
745+
<a name="requestBodyDescription"></a>description | `string` | A brief description of the request body. This could contain examples of use. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation.
746+
<a name="requestBodySchema"></a>schema | [Schema Object](#schemaObject) | The schema defining the type used for the request body.
747+
<a name="requestBodyExamples"></a>examples | [Examples Object](#examplesObject) | Examples of the request body, referenced by mime type.
748+
<a name="requestBodyRequired"></a>required | `boolean` | Determines if the request body is required in the request. Defaults to `true`.
749+
750+
751+
##### Patterned Fields
752+
Field Pattern | Type | Description
753+
---|:---:|---
754+
<a name="parameterExtensions"></a>^x- | Any | Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example, `x-internal-id`. The value can be `null`, a primitive, an array or an object. See [Vendor Extensions](#vendorExtensions) for further details.
755+
756+
757+
##### Request Body Examples
758+
759+
A request body with a referenced model definition.
760+
```js
761+
{
762+
"description": "user to add to the system",
763+
"schema": {
764+
"$ref": "#/definitions/User"
765+
},
766+
"examples": {
767+
"application/json": {
768+
"$ref": 'http://foo.bar#/examples/address-example.json'
769+
'application/xml':
770+
$ref: 'http://foo.bar#/examples/address-example.xml'
771+
'text/plain':
772+
$ref: 'http://foo.bar#/examples/address-example.txt'
773+
default:
774+
$ref: 'http://foo.bar#/examples/address-example.whatever'
775+
}
776+
```
777+
778+
```yaml
779+
description: user to add to the system
780+
schema:
781+
$ref: '#/definitions/User'
782+
examples:
783+
'application/json':
784+
$ref: 'http://foo.bar/examples/user-example.json'
785+
'application/xml':
786+
$ref: 'http://foo.bar/examples/user-example.xml'
787+
'text/plain':
788+
$ref: 'http://foo.bar/examples/user-example.txt'
789+
default:
790+
$ref: 'http://foo.bar/examples/user-example.whatever'
791+
```
792+
793+
A body parameter that is an array of string values:
794+
```js
795+
{
796+
"description": "user to add to the system",
797+
"schema": {
798+
"type": "array",
799+
"items": {
800+
"type": "string"
801+
}
802+
}
803+
}
804+
```
805+
806+
```yaml
807+
description: user to add to the system
808+
required: true
809+
schema:
810+
type: array
811+
items:
812+
type: string
813+
```
814+
789815
#### <a name="itemsObject"></a>Items Object
790816

791-
A limited subset of JSON-Schema's items object. It is used by parameter definitions that are not located [`in`](#parameterIn) `"body"`.
817+
A limited subset of JSON-Schema's items object. It is used by parameter definitions.
792818

793819
##### Fixed Fields
794820
Field Name | Type | Description
@@ -1060,7 +1086,7 @@ X-Rate-Limit-Reset:
10601086

10611087
#### <a name="exampleObject"></a>Example Object
10621088

1063-
Allows sharing examples for operation responses.
1089+
Allows sharing examples for operation requests and responses.
10641090

10651091
##### Patterned Fields
10661092
Field Pattern | Type | Description
@@ -1069,7 +1095,7 @@ Field Pattern | Type | Description
10691095

10701096
##### Example Object Example
10711097

1072-
Example response for application/json mimetype of a Pet data type:
1098+
Example request or response for application/json mimetype of a Pet data type:
10731099

10741100
```js
10751101
{
@@ -1184,10 +1210,8 @@ definitions:
11841210
example:
11851211
$ref: http://foo.bar#/examples/name-example
11861212
1187-
# in a parameter, note the plural `examples` as the content-type is set by `consumes`:
1188-
parameters:
1189-
- name: address
1190-
in: body
1213+
# in a request body, note the plural `examples` as the content-type is set by `consumes`:
1214+
requestBody:
11911215
schema:
11921216
$ref: '#/definitions/Address'
11931217
examples:
@@ -1199,6 +1223,10 @@ definitions:
11991223
$ref: 'http://foo.bar#/examples/address-example.txt'
12001224
default:
12011225
$ref: 'http://foo.bar#/examples/address-example.whatever'
1226+
1227+
# in a parameter
1228+
1229+
parameters:
12021230
- name: 'zip'
12031231
in: 'query'
12041232
type: 'string'

0 commit comments

Comments
 (0)