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
Migrate 3.0 format guidance to content* (3.1.1 port add-on)
Various updates ported over from 3.0.4 mention using the `format`
values `byte` or `binary`, which have been replaced by the
`contentMediaType` and `contentEncoding` keywords. This change
updates those ported chagnes accordingly.
Copy file name to clipboardExpand all lines: versions/3.1.1.md
+19-14Lines changed: 19 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1751,17 +1751,20 @@ requestBody:
1751
1751
type: object
1752
1752
properties: {}
1753
1753
profileImage:
1754
-
# Content-Type for properties with type string and contentEncoding is `application/octet-stream`
1754
+
# default Content-Type for properties with type string and a contentEncoding
1755
+
# is `application/octet-stream`, so `image/png` must be set using contentMediaType
1755
1756
type: string
1756
1757
contentMediaType: image/png
1757
1758
contentEncoding: base64
1758
1759
children:
1759
-
# default Content-Type for arrays is based on the _inner_ type (`text/plain` here)
1760
+
# default Content-Type for arrays is based on the items subschema type, which
1761
+
# is a string, producing a default of `text/plain`
1760
1762
type: array
1761
1763
items:
1762
1764
type: string
1763
1765
addresses:
1764
-
# default Content-Type for arrays is based on the _inner_ type (object shown, so `application/json` in this example)
1766
+
# default Content-Type for arrays is based on the items subschema type, which
1767
+
# is an object, producing a default of `application/json`
1765
1768
type: array
1766
1769
items:
1767
1770
type: object
@@ -1791,17 +1794,18 @@ Field Name | Type | Description
1791
1794
1792
1795
This object MAY be extended with [Specification Extensions](#specificationExtensions).
1793
1796
1794
-
The default values for `contentType` are as follows, where an _n/a_ in the `format` column means that the presence or value of `format` is irrelevant:
1797
+
The default values for `contentType` are as follows, where an _n/a_ in the `contentEncoding` column means that the presence or value of `contentEncoding` is irrelevant:
`number`, `integer`, or `boolean` | _n/a_ | `text/plain`
1801
1805
`object`| _n/a_ | `application/json`
1802
-
`array`| _n/a_ | according to the `type` and `format` of the `items` schema
1806
+
`array`| _n/a_ | according to the `type` of the `items` schema
1803
1807
1804
-
Determining how to handle `null` values if `nullable: true` is present depends on how `null` values are being serialized.
1808
+
Determining how to handle a `type` value of `null` depends on how `null` values are being serialized.
1805
1809
If `null` values are entirely omitted, then the `contentType` is irrelevant.
1806
1810
See [Appendix B](#dataTypeConversion) for a discussion of data type conversion options.
1807
1811
@@ -1830,8 +1834,8 @@ It is not currently possible to correlate schema properties with unnamed, ordere
1830
1834
Note that there are significant restrictions on what headers can be used with `multipart` media types in general ([RFC2046 §5.1](https://www.rfc-editor.org/rfc/rfc2046.html#section-5.1)) and `multi-part/form-data` in particular ([RFC7578 §4.8](https://www.rfc-editor.org/rfc/rfc7578.html#section-4.8)).
1831
1835
1832
1836
Note also that `Content-Transfer-Encoding` is deprecated for `multipart/form-data` ([RFC7578 §4.7](https://www.rfc-editor.org/rfc/rfc7578.html#section-4.7)) where binary data is supported, as it is in HTTP.
1833
-
Using `format: byte` for a multipart field is equivalent to setting `Content-Transfer-Encoding: base64`.
1834
-
If `format: byte` is used along with setting a different `Content-Transfer-Encoding` value with the `headers` field, the result is undefined.
1837
+
Using `contentEncoding` is equivalent to setting `Content-Transfer-Encoding` to the same value.
1838
+
If `contentEncoding` is used along with setting a different `Content-Transfer-Encoding` value with the `headers` field, the result is undefined.
1835
1839
1836
1840
##### Encoding Object Example
1837
1841
@@ -4200,7 +4204,7 @@ To control the serialization of numbers, booleans, and `null` (or other values R
4200
4204
The resulting strings would not require any further type conversion.
4201
4205
4202
4206
The `format` keyword can assist in serialization.
4203
-
Some formats (such as `date-time` or `byte`) are unambiguous, while others (such as [`decimal`](https://spec.openapis.org/registry/format/decimal.html) in the [Format Registry](https://spec.openapis.org/registry/format/)) are less clear.
4207
+
Some formats (such as `date-time`) are unambiguous, while others (such as [`decimal`](https://spec.openapis.org/registry/format/decimal.html) in the [Format Registry](https://spec.openapis.org/registry/format/)) are less clear.
4204
4208
However, care must be taken with `format` to ensure that the specific formats are supported by all relevant tools as unrecognized formats are ignored.
4205
4209
4206
4210
Requiring input as pre-formatted, schema-validated strings also improves round-trip interoperability as not all programming languages and environments support the same data types.
@@ -4453,8 +4457,9 @@ This will expand to the result:
4453
4457
RFC6570's percent-encoding behavior is not always appropriate for `in: header` and `in: cookie` parameters.
4454
4458
In many cases, it is more appropriate to use `content` with a media type such as `text/plain` and require the application to assemble the correct string.
4455
4459
4456
-
For both cookies ([RFC6265](https://www.rfc-editor.org/rfc/rfc6265)) and HTTP headers using the structured fields ([RFC8941](https://www.rfc-editor.org/rfc/rfc8941)) syntax, non-ASCII content is handled using base64 encoding (`format: byte`).
4460
+
For both cookies ([RFC6265](https://www.rfc-editor.org/rfc/rfc6265)) and HTTP headers using the structured fields ([RFC8941](https://www.rfc-editor.org/rfc/rfc8941)) syntax, non-ASCII content is handled using base64 encoding (`contentEncoding: base64`).
4457
4461
Note that the standard base64 encoding alphabet includes non-URL-safe characters that are percent-encoded by RFC6570 expansion; serializing values through both encodings is NOT RECOMMENDED.
4462
+
While `contentEncoding` also supports the `base64url` encoding, which is URL-safe, the header and cookie RFCs do not mention this encoding.
4458
4463
4459
4464
Most HTTP headers predate the structured field syntax, and a comprehensive assessment of their syntax and encoding rules is well beyond the scope of this specification.
4460
4465
While [RFC8187](https://www.rfc-editor.org/rfc/rfc8187) recommends percent-encoding HTTP field (header or trailer) parameters, these parameters appear after a `;` character.
0 commit comments