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: CONTRIBUTING.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -257,6 +257,19 @@ Schemas are updated in and directly published from the `vX.Y-dev` branches.
257
257
258
258
As part of the publishing process, the YAML source files are converted to JSON, renamed to the relevant last-changed dates, and `WORK-IN-PROGRESS` placeholders are replaced with these dates as appropriate. This is usually done by the [`schema-publish` workflow](https://github.com/OAI/OpenAPI-Specification/blob/main/.github/workflows/schema-publish.yaml) which detects changes on each `vX.Y-dev` branch, which generates a pull request for publishing the new schema iterations to the [spec site](https://spec.openapis.org). The workflow can also be run manually if required.
259
259
260
+
#### Schemas and OAS Requirements
261
+
262
+
The schemas published by the OpenAPI Initiative _only_ validate mandatory
263
+
OAS requirements. This means that a field value or combination with another
264
+
field is only forbidden in a schema if there is a corresponding MUST / MUST NOT /
265
+
SHALL / SHALL NOT requirement that prevents it.
266
+
267
+
Schemas that apply further restrictions to enforce desired usage are outside
268
+
of the scope of the OpenAPI Initiative. When opening an issue or PR for
269
+
schema changes, please ensure that the changes are backed by clear OAS
270
+
requirements. Otherwise, the issue or PR will be closed with a note pointing
Copy file name to clipboardExpand all lines: src/oas.md
+37-33Lines changed: 37 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -607,7 +607,7 @@ The path itself is still exposed to the documentation viewer but they will not k
607
607
| <a name="path-item-head"></a>head | [Operation Object](#operation-object) | A definition of a HEAD operation on this path. |
608
608
| <a name="path-item-patch"></a>patch | [Operation Object](#operation-object) | A definition of a PATCH operation on this path. |
609
609
| <a name="path-item-trace"></a>trace | [Operation Object](#operation-object) | A definition of a TRACE operation on this path. |
610
-
| <a name="path-item-query"></a>query | [Operation Object](#operation-object) | A definition of a QUERY operation, as defined in the most recent IETF draft ([draft-ietf-httpbis-safe-method-w-body-08](https://www.ietf.org/archive/id/draft-ietf-httpbis-safe-method-w-body-11.html) as of this writing) or its RFC successor, on this path. |
610
+
| <a name="path-item-query"></a>query | [Operation Object](#operation-object) | A definition of a QUERY operation, as defined in the most recent IETF draft ([draft-ietf-httpbis-safe-method-w-body-14](https://www.ietf.org/archive/id/draft-ietf-httpbis-safe-method-w-body-14.html) as of this writing) or its RFC successor, on this path. |
611
611
| <a name="path-item-additional-operations"></a>additionalOperations | Map[`string`, [Operation Object](#operation-object)] | A map of additional operations on this path. The map key is the HTTP method with the same capitalization that is to be sent in the request. This map MUST NOT contain any entry for the methods that can be defined by other fixed fields with Operation Object values (e.g. no `POST` entry, as the `post` field is used for this method). |
612
612
| <a name="path-item-servers"></a>servers | [[Server Object](#server-object)] | An alternative `servers` array to service all operations in this path. If a `servers` array is specified at the [OpenAPI Object](#oas-servers) level, it will be overridden by this value. |
613
613
| <a name="path-item-parameters"></a>parameters | [[Parameter Object](#parameter-object) \| [Reference Object](#reference-object)] | A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameter-name) and [location](#parameter-in). The list can use the [Reference Object](#reference-object) to link to parameters that are defined in the [OpenAPI Object's `components.parameters`](#components-parameters). |
@@ -810,6 +810,9 @@ These fields MUST NOT be used with `in: "querystring"`.
810
810
Care is needed for parameters with `schema` that have `in: "header"` or `in: "cookie", style: "cookie"`:
811
811
812
812
* When serializing these values, URI percent-encoding MUST NOT be applied.
813
+
* The Cookie header prohibits unencoded commas (see
814
+
[RFC6265](https://datatracker.ietf.org/doc/html/rfc6265#section-4.2.1) for the complete ABNF),
815
+
therefore `"explode": false` is invalid with `"in": "cookie"` (both `"style": "form"` and `"style": "cookie"`).
813
816
* When parsing these parameters, any apparent percent-encoding MUST NOT be decoded.
814
817
* If using an RFC6570 implementation that automatically performs encoding or decoding steps, the steps MUST be undone before use.
815
818
@@ -930,7 +933,7 @@ The following table shows serialized examples, as would be shown with the `seria
A cookie parameter relying on the percent-encoding behavior of the default `style: "form"`:
@@ -1603,7 +1605,7 @@ content:
1603
1605
format: int64
1604
1606
- properties:
1605
1607
event:
1606
-
const: addJson
1608
+
const: addJSON
1607
1609
data:
1608
1610
$comment: |
1609
1611
These content fields indicate
@@ -1829,9 +1831,9 @@ requestBody:
1829
1831
# image media type(s) in the Encoding Object.
1830
1832
type: string
1831
1833
contentEncoding: base64url
1832
-
encoding:
1833
-
icon:
1834
-
contentType: image/png, image/jpeg
1834
+
encoding:
1835
+
icon:
1836
+
contentType: image/png, image/jpeg
1835
1837
```
1836
1838
1837
1839
Given a name of `example` and a solid red 2x2-pixel PNG for `icon`, this
@@ -2338,7 +2340,7 @@ The various fields and types of examples are explained in more detail under [Wor
2338
2340
| <a name="example-description"></a>description | `string` | Long description for the example. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
2339
2341
| <a name="example-data-value"></a>dataValue | Any | An example of the data structure that MUST be valid according to the relevant [Schema Object](#schema-object). If this field is present, `value` MUST be absent. |
2340
2342
| <a name="example-serialized-value"></a>serializedValue | `string` | An example of the serialized form of the value, including encoding and escaping as described under [Validating Examples](#validating-examples). If `dataValue` is present, then this field SHOULD contain the serialization of the given data. Otherwise, it SHOULD be the valid serialization of a data value that itself MUST be valid as described for `dataValue`. This field SHOULD NOT be used if the serialization format is JSON, as the data form is easier to work with. If this field is present, `value`, and `externalValue` MUST be absent. |
2341
-
| <a name="example-external-value"></a>externalValue | `string` | A URI that identifies the serialized example in a separate document, allowing for values not easily or readably expressed as a Unicode string. If `dataValue` is present, then this field SHOULD identify a serialization of the given data. Otherwise, the value SHOULD be the valid serialization of a data value that itself MUST be valid as described for `dataValue`. If this field is present, `serializedValue` and `value` MUST be absent. See also the rules for resolving [Relative References](#relative-references-in-api-description-uris). |
2343
+
| <a name="example-external-value"></a>externalValue | `string` | A URI that identifies the serialized example in a separate document, allowing for values not easily or readably expressed as a Unicode string. If `dataValue` is present, then this field SHOULD identify a serialization of the given data. Otherwise, the value SHOULD identify the valid serialization of a data value that itself MUST be valid as described for `dataValue`. If this field is present, `serializedValue` and `value` MUST be absent. See also the rules for resolving [Relative References](#relative-references-in-api-description-uris). |
2342
2344
| <a name="example-value"></a>value | Any | Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally be represented in JSON or YAML, use a string value to contain the example, escaping where necessary.<br><br>**Deprecated for non-JSON serialization targets:** Use `dataValue` and/or `serializedValue`, which both have unambiguous syntax and semantics, instead. |
2343
2345
2344
2346
This object MAY be extended with [Specification Extensions](#specification-extensions).
@@ -2769,7 +2771,7 @@ components:
2769
2771
content:
2770
2772
application/linkset+json:
2771
2773
schema:
2772
-
$ref: '#/components/mediaTypes/CollectionLinks'
2774
+
$ref: '#/components/schemas/CollectionLinks'
2773
2775
```
2774
2776
2775
2777
#### Representing the `Set-Cookie` Header
@@ -2847,11 +2849,10 @@ components:
2847
2849
explode: true
2848
2850
examples:
2849
2851
SetCookies:
2850
-
dataValue: {
2851
-
"lang": "en-US; Expires=Wed, 09 Jun 2021 10:18:14 GMT"
2852
-
"foo": "bar; Expires=Wed, 09 Jun 2021 10:18:14 GMT"
2853
-
"urlSafeData": "Hello%2C%20world%21"
2854
-
}
2852
+
dataValue:
2853
+
lang: "en-US; Expires=Wed, 09 Jun 2021 10:18:14 GMT"
2854
+
foo: "bar; Expires=Wed, 09 Jun 2021 10:18:14 GMT"
2855
+
urlSafeData: "Hello%2C%20world%21"
2855
2856
serializedValue: |
2856
2857
lang=en-US; Expires=Wed, 09 Jun 2021 10:18:14 GMT
2857
2858
foo=bar; Expires=Wed, 09 Jun 2021 10:18:14 GMT
@@ -3158,7 +3159,7 @@ This means that the data form of this serialization is equivalent to the followi
@@ -5134,10 +5136,12 @@ For this reason, any data being passed to a header by way of a [Parameter](#para
5134
5136
While percent-encoding seems more common as an escaping mechanism than the base64 encoding (`contentEncoding`: "base64") recommended by [[RFC6265]], [section 5.6 of draft-ietf-httpbis-rfc6265bis-20](https://www.ietf.org/archive/id/draft-ietf-httpbis-rfc6265bis-20.html#section-5.6), the proposed update to that RFC notes that cookies sent in the `Set-Cookie` response header that appear to be percent-encoded MUST NOT be decoded when stored by the client, which would mean that they are already encoded when retrieved from that storage for use in the `Cookie` request header.
5135
5137
The behavior of `style: "cookie"` assumes this usage, and _does not_ apply or remove percent-encoding.
5136
5138
5137
-
If automatic percent-encoding is desired, `style: "form"` with a primitive value or with the non-default `explode` value of `false` provides this behavior.
5139
+
If automatic percent-encoding is desired, `style: "form"` with a primitive value provides this behavior (note that the non-default `explode` value of `false` produces cookie values containing a comma (`,`), which are invalid).
5140
+
5138
5141
However, note that the default value of `explode: true` for `style: "form"` with non-primitive values uses the wrong delimiter for cookies (`&` instead of `;` followed by a single space) to set multiple cookie values.
5139
5142
Using `style: "form"` with `in: "cookie"` via an RFC6570 implementation requires stripping the `?` prefix, as when producing `application/x-www-form-urlencoded` message bodies.
5140
-
To allow the full use of `style: "form"` with `in: "cookie"`, use the `allowReserved` field.
5143
+
To allow the full use of `style: "form"` with `in: "cookie"`, use the `allowReserved` field, taking
5144
+
care to still escape the characters that are invalid in the Cookie header (see [RFC6265](https://datatracker.ietf.org/doc/html/rfc6265#section-4.2.1) for the complete ABNF).
5141
5145
5142
5146
## Appendix E: Percent-Encoding and Form Media Types
5143
5147
@@ -5332,7 +5336,7 @@ components:
5332
5336
content:
5333
5337
application/json:
5334
5338
schema:
5335
-
$ref: "#/components/api/schemas/Foo"
5339
+
$ref: "#/components/schemas/Foo"
5336
5340
schemas:
5337
5341
Foo:
5338
5342
properties:
@@ -5453,7 +5457,7 @@ components:
5453
5457
```
5454
5458
5455
5459
In this example, all of the `$self` and `$id` values are relative URI references consisting of an absolute path.
5456
-
This allows the retrieval URI to set the host (and scheme), in this case `https://staging.example.com`, resulting in the first document's `$self` being `https://staging.example.com/openapi`, and the second document's `$self` being `https://staging.example.com/api/shared/foo`, with `$id` values of `https://staging.example.com/api/schemas/foo` and `https://staging.example.com/api/schemas/bar`.
5460
+
This allows the retrieval URI to set the host (and scheme), in this case `https://staging.example.com`, resulting in the first document's `$self` being `https://staging.example.com/api/openapi`, and the second document's `$self` being `https://staging.example.com/api/shared/foo`, with `$id` values of `https://staging.example.com/api/schemas/foo` and `https://staging.example.com/api/schemas/bar`.
5457
5461
Relative `$self` and `$id` values of this sort allow the same set of documents to work when deployed to other hosts, e.g. `https://example.com` (production) or `https://localhost:8080` (local development).
0 commit comments