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
This adds the Media Type Object's encoding field to the Encoding
Object to support nested multipart documents. It only requires
one level of nesting, but allows implementations to support more.
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
@@ -1641,6 +1641,9 @@ These fields MAY be used either with or without the RFC6570-style serialization
1641
1641
| ---- | :----: | ---- |
1642
1642
| <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. |
1643
1643
| <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`. |
1644
+
| <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. |
1645
+
| <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. |
1646
+
| <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. |
1644
1647
1645
1648
This object MAY be extended with [Specification Extensions](#specification-extensions).
1646
1649
@@ -1674,6 +1677,12 @@ See also [Appendix C: Using RFC6570 Implementations](#appendix-c-using-rfc6570-b
1674
1677
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.
1675
1678
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.
1676
1679
1680
+
##### Nested Encoding
1681
+
1682
+
Nested formats requiring encoding, most notably nested `multipart/mixed`, can be supported with this Object's `encoding`, `prefixEncoding`, and / or `itemEncoding` fields.
1683
+
Implementations MUST support one level of nesting, and MAY support additional levels.
1684
+
If supporting additional levels, any limits on nesting levels MUST be documented.
1685
+
1677
1686
##### Encoding the `x-www-form-urlencoded` Media Type
1678
1687
1679
1688
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).
@@ -1869,6 +1878,30 @@ requestBody:
1869
1878
1870
1879
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`.
1871
1880
1881
+
###### Example: Nested `multipart/mixed`
1882
+
1883
+
This defines a two-part `multipart/mixed` where the first part is JSON and the second part is a nested `multipart/mixed` document.
1884
+
The nested parts are JSON, plain text, and a PNG image.
1885
+
1886
+
```yaml
1887
+
multipart/mixed:
1888
+
schema:
1889
+
type: array
1890
+
prefixItems:
1891
+
- type: array
1892
+
- prefixItems:
1893
+
- type: object
1894
+
- type: string
1895
+
- {}
1896
+
prefixEncoding:
1897
+
- {} # Accept the default application/json
1898
+
- contentType: multipart/mixed
1899
+
prefixEncoding:
1900
+
- contentType: application/xml
1901
+
- {} # Accept the default text/plain
1902
+
- contentType: image/png
1903
+
```
1904
+
1872
1905
#### Responses Object
1873
1906
1874
1907
A container for the expected responses of an operation.
0 commit comments