You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: versions/3.0.md
+27-11Lines changed: 27 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -1351,7 +1351,7 @@ Field Name | Type | Description
1351
1351
<a name="mediaTypeSchema"></a>schema | [Schema Object](#schemaObject) \| [Reference Object](#referenceObject) | The schema defining the type used for the request body.
1352
1352
<a name="mediaTypeExample"></a>example | Any | Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The `example` object is mutually exclusive of the `examples` object. Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL _override_ the example provided by the schema.
1353
1353
<a name="mediaTypeExamples"></a>examples | Map[ `string`, [Example Object](#exampleObject) \| [Reference Object](#referenceObject)] | Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The `examples` object is mutually exclusive of the `example` object. Furthermore, if referencing a `schema` which contains an example, the `examples` value SHALL _override_ the example provided by the schema.
1354
-
<a name="mediaTypeEncoding"></a>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 SHOULD only apply to `requestBody` objects when the content type is `multipart`.
1354
+
<a name="mediaTypeEncoding"></a>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`.
1355
1355
1356
1356
This object can be extended with [Specification Extensions](#specificationExtensions).
1357
1357
@@ -1420,8 +1420,7 @@ application/json:
1420
1420
1421
1421
##### Considerations for File Uploads
1422
1422
1423
-
In contrast with the 2.0 specification, `file` input/output content in OpenAPI is
1424
-
described with the same semantics as any other schema type. Specifically:
1423
+
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:
1425
1424
1426
1425
```yaml
1427
1426
# content transferred with base64 encoding
@@ -1463,6 +1462,23 @@ requestBody:
1463
1462
format: binary
1464
1463
```
1465
1464
1465
+
To upload multiple files, a `multipart` media type MUST be used:
1466
+
1467
+
```yaml
1468
+
requestBody:
1469
+
content:
1470
+
multipart/form-data:
1471
+
schema:
1472
+
properties:
1473
+
# The property name 'file' will be used for all files.
1474
+
file:
1475
+
type: array
1476
+
items:
1477
+
type: string
1478
+
format: binary
1479
+
1480
+
```
1481
+
1466
1482
##### Support for x-www-form-urlencoded Request Bodies
1467
1483
1468
1484
To submit content using form url encoding via [RFC1866](https://tools.ietf.org/html/rfc1866), the following
@@ -1471,7 +1487,7 @@ definition may be used:
1471
1487
```yaml
1472
1488
requestBody:
1473
1489
content:
1474
-
x-www-form-urlencoded:
1490
+
application/x-www-form-urlencoded:
1475
1491
schema:
1476
1492
type: object
1477
1493
properties:
@@ -1486,13 +1502,13 @@ requestBody:
1486
1502
1487
1503
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.
1488
1504
1489
-
When passing complex objects in the `x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the `parameterContent` section as `form`.
1505
+
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`.
1490
1506
1491
1507
##### Special Considerations for `multipart` Content
1492
1508
1493
1509
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.
1494
1510
1495
-
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/*`:
1511
+
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`:
1496
1512
1497
1513
* If the property is a primitive, or an array of primitive values, the default Content-Type is `text/plain`
1498
1514
* If the property is complex, or an array of complex values, the default Content-Type is `application/json`
@@ -1531,7 +1547,7 @@ requestBody:
1531
1547
type: '#/components/schemas/Address'
1532
1548
```
1533
1549
1534
-
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 `x-www-form-urlencoded` request bodies.
1550
+
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.
1535
1551
1536
1552
#### <a name="encodingObject"></a>Encoding Object
1537
1553
@@ -1541,10 +1557,10 @@ A single encoding definition applied to a single schema property.
1541
1557
Field Name | Type | Description
1542
1558
---|:---:|---
1543
1559
<a name="encodingContentType"></a>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.
1544
-
<a name="encodingHeaders"></a>headers | Map[`string`, [Header Object](#headerObject)] | A string 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.
1545
-
<a name="encodingStyle"></a>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.
1546
-
<a name="encodingExplode"></a>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`.
1547
-
<a name="encodingAllowReserved"></a>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`.
1560
+
<a name="encodingHeaders"></a>headers | Map[`string`, [Header Object](#headerObject)] | A string 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`.
1561
+
<a name="encodingStyle"></a>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`.
1562
+
<a name="encodingExplode"></a>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`.
1563
+
<a name="encodingAllowReserved"></a>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`.
1548
1564
1549
1565
This object can be extended with [Specification Extensions](#specificationExtensions).
0 commit comments