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
+16-4Lines changed: 16 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1375,11 +1375,13 @@ Each field has its own set of media types with which it can be used; for all oth
1375
1375
The behavior of the `encoding` field is designed to support web forms, and is therefore only defined for media types structured as name-value pairs that allow repeat values, most notably `application/x-www-form-urlencoded` and `multipart/form-data`.
1376
1376
1377
1377
To use the `encoding` field, each key under the field MUST exist in the data instance as a property; `encoding` entries with no corresponding property SHALL be ignored.
1378
-
Array properties MUST be handled by applying the given Encoding Object to produce one encoded value per array item, each with the same `name`, as is recommended by [[!RFC7578]] [Section 4.3](https://www.rfc-editor.org/rfc/rfc7578.html#section-4.3) for supplying multiple values per form field.
1379
-
For all other value types for both top-level non-array properties and for values, including array values, within a top-level array, the Encoding Object MUST be applied to the entire value.
1378
+
When serializing, property values of the array type MUST be handled by applying the given Encoding Object to produce one encoded value per array item, each with the same `name`, as is recommended by [[!RFC7578]] [Section 4.3](https://www.rfc-editor.org/rfc/rfc7578.html#section-4.3) for supplying multiple values per form field; when deserializing, the Encoding object is applied to each item of the array property of the same name.
1379
+
For deserialization to an object, multiple values with the same `name` MUST be collapsed into an array value for that named property, with one item per value, in order.
1380
+
For all other value types for both top-level non-array property values and for other values, including items of the array type within a top-level array, the Encoding Object MUST be applied to the entire value.
1381
+
1380
1382
The order of these name-value pairs in the target media type is implementation-defined when not explicitly defined by that media-type's specification.
1381
1383
1382
-
For `application/x-www-form-urlencoded`, the `encoding` keys MUST map to parameter names, with the values produced according to the rules of the [Encoding Object](#encoding-object).
1384
+
For `application/x-www-form-urlencoded`, the `encoding` keys MUST map to parameter names, with the serialized values produced according to the rules of the [Encoding Object](#encoding-object).
1383
1385
See [Encoding the `x-www-form-urlencoded` Media Type](#encoding-the-x-www-form-urlencoded-media-type) for guidance and examples, both with and without the `encoding` field.
1384
1386
1385
1387
For `multipart` types that decode to an object, such as `multipart/form-data`, the `encoding` keys MUST map to the [`name` parameter](https://www.rfc-editor.org/rfc/rfc7578#section-4.2) of the `Content-Disposition: form-data` header of each part, as is defined for `multipart/form-data` in [[!RFC7578]].
@@ -1926,11 +1928,19 @@ requestBody:
1926
1928
schema:
1927
1929
type: object
1928
1930
properties:
1929
-
# No Encoding Object, so use default `text/plain`
1931
+
# No Encoding Object for this property, so use string default `text/plain`
1930
1932
id:
1931
1933
type: string
1932
1934
format: uuid
1933
1935
1936
+
# An Encoding object allows multiple values to be provided for this
1937
+
# property, without any attempt to decode the array as application/json
1938
+
alias:
1939
+
type: [ string, array ]
1940
+
pattern: '^[A-Z][a-z]*$'
1941
+
items:
1942
+
pattern: '^[A-Z][a-z]*$'
1943
+
1934
1944
# Encoding Object overrides the default `application/json` content type
1935
1945
# for each item in the array with `application/xml; charset=utf-8`
0 commit comments