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.4.md
+26-2
Original file line number
Diff line number
Diff line change
@@ -1044,7 +1044,6 @@ There are four possible parameter locations specified by the `in` field:
1044
1044
* header - Custom headers that are expected as part of the request. Note that [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive.
1045
1045
* cookie - Used to pass a specific cookie value to the API.
1046
1046
1047
-
1048
1047
##### Fixed Fields
1049
1048
1050
1049
The rules for serialization of the parameter are specified in one of two ways.
@@ -1064,12 +1063,16 @@ Field Name | Type | Description
1064
1063
<a name="parameterDeprecated"></a> deprecated | `boolean` | Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value is `false`.
1065
1064
<a name="parameterAllowEmptyValue"></a> allowEmptyValue | `boolean` | If `true`, clients MAY pass a zero-length string value in place of parameters that would otherwise be omitted entirely, which the server SHOULD interpret as the parameter being unused. Default value is `false`. If [`style`](#parameterStyle) is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored. Interactions between this field and the parameter's [Schema Object](#schemaObject) are implementation-defined. This field is valid only for `query` parameters. Use of this property is NOT RECOMMENDED, and it is likely to be removed in a later revision.
1066
1065
1066
+
Note that while `"Cookie"` as a `name` is not forbidden with `in: header`, the effect of defining a cookie parameter that way is undefined; use `in: cookie` instead.
1067
+
1067
1068
###### Fixed Fields for use with `schema`
1068
1069
1069
1070
For simpler scenarios, a [`schema`](#parameterSchema) and [`style`](#parameterStyle) can describe the structure and syntax of the parameter.
1070
1071
When `example` or `examples` are provided in conjunction with the `schema` object, the example SHOULD match the specified schema and follow the prescribed serialization strategy for the parameter.
1071
1072
The `example` and `examples` fields are mutually exclusive, and if either is present it SHALL _override_ any `example` in the schema.
1072
1073
1074
+
Serializing with `schema` is NOT RECOMMENDED for `in: cookie` parameters, `in: header` parameters that use HTTP header parameters (name=value pairs following a `;`) in their values, or `in: header` parameters where values might have non-URL-safe characters; see [Appendix D](#serializingHeadersAndCookies) for details.
1075
+
1073
1076
Field Name | Type | Description
1074
1077
---|:---:|---
1075
1078
<a name="parameterStyle"></a>style | `string` | Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of `in`): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`.
@@ -1081,14 +1084,16 @@ Field Name | Type | Description
1081
1084
1082
1085
See also [Appendix C: Using RFC6570 Implementations](#usingRFC6570Implementations) for additional guidance.
1083
1086
1084
-
###### Fixed Fields and considerations for use with `content`
1087
+
###### Fixed Fields for use with `content`
1085
1088
1086
1089
For more complex scenarios, the [`content`](#parameterContent) property can define the media type and schema of the parameter, as well as give examples of its use.
1090
+
Using `content` with a `text/plain` media type is RECOMMENDED for `in: header` and `in: cookie` parameters where the `schema` strategy is not appropriate.
1087
1091
1088
1092
Field Name | Type | Description
1089
1093
---|:---:|---
1090
1094
<a name="parameterContent"></a>content | Map[`string`, [Media Type Object](#mediaTypeObject)] | A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.
1091
1095
1096
+
1092
1097
##### Style Values
1093
1098
1094
1099
In order to support common ways of serializing simple parameters, a set of `style` values are defined.
@@ -3969,4 +3974,23 @@ This will expand to the result:
3969
3974
3970
3975
## <a name="serializingHeadersAndCookies"></a>Appendix D: Serializing Headers and Cookies
3971
3976
3977
+
RFC6570's percent-encoding behavior is not always appropriate for `in: header` and `in: cookie` parameters.
3978
+
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.
3979
+
3980
+
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`).
3981
+
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.
3982
+
3983
+
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.
3984
+
While [RFC8187](https://www.rfc-editor.org/rfc/rfc8187) recommends percent-encoding HTTP field (header or trailer) parameters, these parameters appear after a `;` character.
3985
+
With `style: simple`, that delimiter would itself be percent-encoded, violating the general HTTP field syntax.
3986
+
3987
+
Using `style: form` with `in: cookie` is ambiguous for a single value, and incorrect for multiple values.
3988
+
This is true whether the multiple values are the result of using `explode: true` or not.
3989
+
3990
+
This style is specified to be equivalent to RFC6570 form expansion which includes the `?` character (see Appendix C for more details), which is not part of the cookie syntax.
3991
+
However, examples of this style in past versions of this specification have not included the `?` prefix, suggesting that the comparison is not exact.
3992
+
Because implementations that rely on an RFC6570 implementation and those that perform custom serialization based on the style example will produce different results, it is implementation-defined as to which of the two results is correct.
3993
+
3994
+
For multiple values, `style: form` is always incorrect as name=value pairs in cookies are delimited by `; ` (a semicolon followed by a space character) rather than `&`.
3995
+
3972
3996
## <a name="percentEncodingAndFormMediaTypes"></a>Appendix E: Percent-Encoding and Form Media Types
0 commit comments