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
+36-35Lines changed: 36 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -230,7 +230,7 @@ In some cases, an unambiguous URI-based alternative is available, and OAD author
230
230
|[Security Requirement Object](#security-requirement-object)`{name}`|[Security Scheme Object](#security-scheme-object) name under the [Components Object](#components-object)|_n/a_|
231
231
|[Discriminator Object](#discriminator-object)`mapping`_(implicit, or explicit name syntax)_|[Schema Object](#schema-object) name under the Components Object |`mapping`_(explicit URI syntax)_|
232
232
|[Operation Object](#operation-object)`tags`|[Tag Object](#tag-object)`name` (in the [OpenAPI Object](#openapi-object)'s `tags` array) |_n/a_|
A fifth implicit connection involves appending the templated URL paths of the [Paths Object](#paths-object) to the appropriate [Server Object](#server-object)'s `url` field.
236
236
This is unambiguous because only the entry document's Paths Object contributes URLs to the described API.
@@ -252,7 +252,7 @@ There are no URI-based alternatives for the Operation Object's `tags` field.
252
252
OAD authors are advised to use external solutions such as the OpenAPI Initiative's Overlay Specification to simulate sharing [Tag Objects](#tag-object) across multiple documents.
253
253
254
254
See [Appendix F: Resolving Security Requirements in a Referenced Document](#appendix-f-resolving-security-requirements-in-a-referenced-document) for an example of the possible resolutions, including which one is recommended by this section.
255
-
The behavior for Discrimator Object non-URI mappings and for the Operation Object's `tags` field operate on the same principles.
255
+
The behavior for Discriminator Object non-URI mappings and for the Operation Object's `tags` field operate on the same principles.
256
256
257
257
Note that no aspect of implicit connection resolution changes how [URIs are resolved](#relative-references-in-api-description-uris), or restricts their possible targets.
258
258
@@ -509,7 +509,7 @@ An object representing a Server.
509
509
510
510
| Field Name | Type | Description |
511
511
| ---- | :----: | ---- |
512
-
| <a name="server-url"></a>url | `string` | **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the document containing the Server Object is being served. Variable substitutions will be made when a variable is named in `{`braces`}`. |
512
+
| <a name="server-url"></a>url | `string` | **REQUIRED**. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the document containing the Server Object is being served. Query and fragment MUST NOT be part of this URL. Variable substitutions will be made when a variable is named in `{`braces`}`. |
513
513
| <a name="server-description"></a>description | `string` | An optional string describing the host designated by the URL. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. |
514
514
| <a name="server-name"></a>name | `string` | An optional unique string to refer to the host designated by the URL. |
515
515
| <a name="server-variables"></a>variables | Map[`string`, [Server Variable Object](#server-variable-object)] | A map between a variable name and its value. The value is used for substitution in the server's URL template. |
@@ -2139,8 +2139,9 @@ requestBody:
2139
2139
name:
2140
2140
type: string
2141
2141
icon:
2142
-
# The default with "contentEncoding" is application/octet-stream,
2143
-
# so we need to set image media type(s) in the Encoding Object.
2142
+
# The default content type with "contentEncoding" present
2143
+
# is application/octet-stream, so we need to set the correct
2144
+
# image media type(s) in the Encoding Object.
2144
2145
type: string
2145
2146
contentEncoding: base64url
2146
2147
encoding:
@@ -2186,18 +2187,22 @@ requestBody:
2186
2187
schema:
2187
2188
type: object
2188
2189
properties:
2190
+
# default content type for a string without `contentEncoding`
2191
+
# is `text/plain`
2189
2192
id:
2190
-
# default for primitives without a special format is text/plain
2191
2193
type: string
2192
2194
format: uuid
2193
-
profileImage:
2194
-
# default for string with binary format is `application/octet-stream`
2195
-
type: string
2196
-
format: binary
2195
+
2196
+
# default content type for a schema without `type`
2197
+
# is `application/octet-stream`
2198
+
profileImage: {}
2199
+
2200
+
# for arrays, the `encoding` field applies the Encoding Object
2201
+
# to each item individually and determines the default content type
2202
+
# based on the type in the `items` subschema, which in this example
2203
+
# is an object, so the default content type for each item is
2204
+
# `application/json`
2197
2205
addresses:
2198
-
# for arrays, the Encoding Object applies to each item
2199
-
# individually based on that item's type, which in this
2200
-
# example is an object, so `application/json`
2201
2206
type: array
2202
2207
items:
2203
2208
$ref: '#/components/schemas/Address'
@@ -2215,31 +2220,27 @@ requestBody:
2215
2220
schema:
2216
2221
type: object
2217
2222
properties:
2223
+
# No Encoding Object, so use default `text/plain`
2218
2224
id:
2219
-
# default is `text/plain`
2220
2225
type: string
2221
2226
format: uuid
2227
+
2228
+
# Encoding Object overrides the default `application/json` content type
2229
+
# for each item in the array with `application/xml; charset=utf-8`
2222
2230
addresses:
2223
-
# default based on the `items` subschema would be
2224
-
# `application/json`, but we want these address objects
2225
-
# serialized as `application/xml` instead
2226
2231
description: addresses in XML format
2227
2232
type: array
2228
2233
items:
2229
2234
$ref: '#/components/schemas/Address'
2230
-
profileImage:
2231
-
# default is application/octet-stream, but we can declare
2232
-
# a more specific image type or types
2233
-
type: string
2234
-
format: binary
2235
+
2236
+
# Encoding Object accepts only PNG or JPEG, and also describes
2237
+
# a custom header for just this part in the multipart format
2238
+
profileImage: {}
2239
+
2235
2240
encoding:
2236
2241
addresses:
2237
-
# require XML Content-Type in utf-8 encoding
2238
-
# This is applied to each address part corresponding
2239
-
# to each address in he array
2240
2242
contentType: application/xml; charset=utf-8
2241
2243
profileImage:
2242
-
# only accept png or jpeg
2243
2244
contentType: image/png, image/jpeg
2244
2245
headers:
2245
2246
X-Rate-Limit-Limit:
@@ -2598,19 +2599,19 @@ Tooling implementations MAY choose to validate compatibility automatically, and
2598
2599
2599
2600
##### Working with Examples
2600
2601
2601
-
Example Objects can be used in both [Parameter Objects](#parameter-object) and [Media Type Objects](#media-type-object).
2602
-
In both Objects, this is done through the `examples` (plural) field.
2603
-
However, there are several other ways to provide examples: The `example` (singular) field that is mutually exclusive with `examples` in both Objects, and two keywords (the deprecated singular `example` and the current plural `examples`, which takes an array of examples) in the [Schema Object](#schema-object) that appears in the `schema` field of both Objects.
2602
+
Example Objects can be used in [Parameter Objects](#parameter-object), [Header Objects](#header-object), and [Media Type Objects](#media-type-object).
2603
+
In all three Objects, this is done through the `examples` (plural) field.
2604
+
However, there are several other ways to provide examples: The `example` (singular) field that is mutually exclusive with `examples` in all three Objects, and two keywords (the deprecated singular `example` and the current plural `examples`, which takes an array of examples) in the [Schema Object](#schema-object) that appears in the `schema` field of all three Objects.
2604
2605
Each of these fields has slightly different considerations.
2605
2606
2606
2607
The Schema Object's fields are used to show example values without regard to how they might be formatted as parameters or within media type representations.
2607
2608
The `examples` array is part of JSON Schema and is the preferred way to include examples in the Schema Object, while `example` is retained purely for compatibility with older versions of the OpenAPI Specification.
2608
2609
2609
-
The mutually exclusive fields in the Parameteror Media Type Objects are used to show example values which SHOULD both match the schema and be formatted as they would appear as a serialized parameter or within a media type representation.
2610
-
The exact serialization and encoding is determined by various fields in the Parameter Object, or in the Media Type Object's [Encoding Object](#encoding-object).
2610
+
The mutually exclusive fields in the Parameter, Header, or Media Type Objects are used to show example values which SHOULD both match the schema and be formatted as they would appear as a serialized parameter, serialized header, or within a media type representation.
2611
+
The exact serialization and encoding is determined by various fields in the Parameter Object, Header Object, or in the Media Type Object's [Encoding Object](#encoding-object).
2611
2612
Because examples using these fields represent the final serialized form of the data, they SHALL _override_ any `example` in the corresponding Schema Object.
2612
2613
2613
-
The singular `example` field in the Parameter or Media Type Object is concise and convenient for simple examples, but does not offer any other advantages over using Example Objects under `examples`.
2614
+
The singular `example` field in the Parameter, Header, or Media Type Object is concise and convenient for simple examples, but does not offer any other advantages over using Example Objects under `examples`.
2614
2615
2615
2616
Some examples cannot be represented directly in JSON or YAML.
2616
2617
For all three ways of providing examples, these can be shown as string values with any escaping necessary to make the string valid in the JSON or YAML format of documents that comprise the OpenAPI Description.
@@ -2773,7 +2774,7 @@ For computing links and providing instructions to execute them, a [runtime expre
2773
2774
This object MAY be extended with [Specification Extensions](#specification-extensions).
2774
2775
2775
2776
A linked operation MUST be identified using either an `operationRef` or `operationId`.
2776
-
The identified or reference operation MUST be unique, and in the case of an `operationId`, it MUST be resolved within the scope of the OpenAPI Description (OAD).
2777
+
The identified or referenced operation MUST be unique, and in the case of an `operationId`, it MUST be resolved within the scope of the OpenAPI Description (OAD).
2777
2778
Because of the potential for name clashes, the `operationRef` syntax is preferred for multi-document OADs.
2778
2779
However, because use of an operation depends on its URL path template in the [Paths Object](#paths-object), operations from any [Path Item Object](#path-item-object) that is referenced multiple times within the OAD cannot be resolved unambiguously.
2779
2780
In such ambiguous cases, the resulting behavior is implementation-defined and MAY result in an error.
@@ -4505,7 +4506,7 @@ flows:
4505
4506
4506
4507
Lists the required security schemes to execute this operation.
4507
4508
4508
-
The name used for each property MUST either correspond to a security scheme declared in the [Security Schemes](#security-scheme-object) under the [Components Object](#components-object), or be the URI of a Security Scheme Object.
4509
+
The name used for each property MUST either correspond to a security scheme declared in the [Security Schemes](#components-security-schemes) under the [Components Object](#components-object), or be the URI of a Security Scheme Object.
4509
4510
Property names that are identical to a component name under the Components Object MUST be treated as a component name.
4510
4511
To reference a Security Scheme with a single-segment relative URI reference (e.g. `foo`) that collides with a component name (e.g. `#/components/securitySchemes/foo`), use the `.` path segment (e.g. `./foo`).
4511
4512
@@ -5023,7 +5024,7 @@ This specification normatively cites the following relevant standards:
5023
5024
Style-based serialization is used in the [Parameter Object](#parameter-object) when `schema` is present, and in the [Encoding Object](#encoding-object) when at least one of `style`, `explode`, or `allowReserved` is present.
5024
5025
See [Appendix C](#appendix-c-using-rfc6570-based-serialization) for more details of RFC6570's two different approaches to percent-encoding, including an example involving `+`.
5025
5026
5026
-
Content-based serialization is defined by the [Media Type Object](#media-type-object), and used with the [Parameter Object](#parameter-object) when the `content` field is present, and with the [Encoding Object](#encoding-object) based on the `contentType` field when the fields `style`, `explode`, and `allowReserved` are absent.
5027
+
Content-based serialization is defined by the [Media Type Object](#media-type-object), and used with the [Parameter Object](#parameter-object)and [Header Object](#header-object)when the `content` field is present, and with the [Encoding Object](#encoding-object) based on the `contentType` field when the fields `style`, `explode`, and `allowReserved` are absent.
5027
5028
Each part is encoded based on the media type (e.g. `text/plain` or `application/json`), and must then be percent-encoded for use in a `form-urlencoded` string.
5028
5029
5029
5030
Note that content-based serialization for `form-data` does not expect or require percent-encoding in the data, only in per-part header values.
0 commit comments