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: src/oas.md
+33Lines changed: 33 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1648,6 +1648,9 @@ These fields MAY be used either with or without the RFC6570-style serialization
1648
1648
| ---- | :----: | ---- |
1649
1649
| <a name="encoding-content-type"></a>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. |
1650
1650
| <a name="encoding-headers"></a>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 field SHALL be ignored if the media type is not a `multipart`. |
1651
+
| <a name="encoding-encoding"></a>encoding | Map[`string`, [Encoding Object](#encoding-object)] | Applies nested Encoding Objects in the same manner as the [Media Type Object](#media-type-object)'s `encoding` field. |
1652
+
| <a name="encoding-prefix-encoding"></a>prefixEncoding | [[Encoding Object](#encoding-object)] | Applies nested Encoding Objects in the same manner as the [Media Type Object](#media-type-object)'s `prefixEncoding` field. |
1653
+
| <a name="encoding-item-encoding"></a>itemEncoding | [Encoding Object](#encoding-object) | Applies nested Encoding Objects in the same manner as the [Media Type Object](#media-type-object)'s `itemEncoding` field. |
1651
1654
1652
1655
This object MAY be extended with [Specification Extensions](#specification-extensions).
1653
1656
@@ -1681,6 +1684,11 @@ See also [Appendix C: Using RFC6570 Implementations](#appendix-c-using-rfc6570-b
1681
1684
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.
1682
1685
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.
1683
1686
1687
+
##### Nested Encoding
1688
+
1689
+
Nested formats requiring encoding, most notably nested `multipart/mixed`, can be supported with this Object's `encoding`, `prefixEncoding`, and / or `itemEncoding` fields.
1690
+
Implementations MUST support one level of nesting, and MAY support additional levels.
1691
+
1684
1692
##### Encoding the `x-www-form-urlencoded` Media Type
1685
1693
1686
1694
To work with 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).
@@ -1885,6 +1893,31 @@ requestBody:
1885
1893
1886
1894
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`.
1887
1895
1896
+
###### Example: Nested `multipart/mixed`
1897
+
1898
+
This defines a two-part `multipart/mixed` where the first part is a JSON array and the second part is a nested `multipart/mixed` document.
1899
+
The nested parts are XML, plain text, and a PNG image.
1900
+
1901
+
```yaml
1902
+
multipart/mixed:
1903
+
schema:
1904
+
type: array
1905
+
prefixItems:
1906
+
- type: array
1907
+
- type: array
1908
+
prefixItems:
1909
+
- type: object
1910
+
- type: string
1911
+
- {}
1912
+
prefixEncoding:
1913
+
- {} # Accept the default application/json
1914
+
- contentType: multipart/mixed
1915
+
prefixEncoding:
1916
+
- contentType: application/xml
1917
+
- {} # Accept the default text/plain
1918
+
- contentType: image/png
1919
+
```
1920
+
1888
1921
#### Responses Object
1889
1922
1890
1923
A container for the expected responses of an operation.
0 commit comments