Skip to content

Commit d0e996e

Browse files
authored
Merge pull request #4573 from handrews/312-port
v3.2: Port of 3.1.2 changes to 3.2
2 parents 84de36b + 10fc7c8 commit d0e996e

File tree

2 files changed

+52
-51
lines changed

2 files changed

+52
-51
lines changed

src/oas.md

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ In some cases, an unambiguous URI-based alternative is available, and OAD author
230230
| [Security Requirement Object](#security-requirement-object) `{name}` | [Security Scheme Object](#security-scheme-object) name under the [Components Object](#components-object) | _n/a_ |
231231
| [Discriminator Object](#discriminator-object) `mapping` _(implicit, or explicit name syntax)_ | [Schema Object](#schema-object) name under the Components Object | `mapping` _(explicit URI syntax)_ |
232232
| [Operation Object](#operation-object) `tags` | [Tag Object](#tag-object) `name` (in the [OpenAPI Object](#openapi-object)'s `tags` array) | _n/a_ |
233-
| [Link Object](#link-object) `operationId` | [Path Item Object](#path-item-object) `operationId` | `operationRef` |
233+
| [Link Object](#link-object) `operationId` | [Operation Object](#operation-object) `operationId` | `operationRef` |
234234

235235
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.
236236
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.
252252
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.
253253

254254
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.
256256

257257
Note that no aspect of implicit connection resolution changes how [URIs are resolved](#relative-references-in-api-description-uris), or restricts their possible targets.
258258

@@ -509,7 +509,7 @@ An object representing a Server.
509509

510510
| Field Name | Type | Description |
511511
| ---- | :----: | ---- |
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`}`. |
513513
| <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. |
514514
| <a name="server-name"></a>name | `string` | An optional unique string to refer to the host designated by the URL. |
515515
| <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:
21392139
name:
21402140
type: string
21412141
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.
21442145
type: string
21452146
contentEncoding: base64url
21462147
encoding:
@@ -2186,18 +2187,22 @@ requestBody:
21862187
schema:
21872188
type: object
21882189
properties:
2190+
# default content type for a string without `contentEncoding`
2191+
# is `text/plain`
21892192
id:
2190-
# default for primitives without a special format is text/plain
21912193
type: string
21922194
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`
21972205
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`
22012206
type: array
22022207
items:
22032208
$ref: '#/components/schemas/Address'
@@ -2215,31 +2220,27 @@ requestBody:
22152220
schema:
22162221
type: object
22172222
properties:
2223+
# No Encoding Object, so use default `text/plain`
22182224
id:
2219-
# default is `text/plain`
22202225
type: string
22212226
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`
22222230
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
22262231
description: addresses in XML format
22272232
type: array
22282233
items:
22292234
$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+
22352240
encoding:
22362241
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
22402242
contentType: application/xml; charset=utf-8
22412243
profileImage:
2242-
# only accept png or jpeg
22432244
contentType: image/png, image/jpeg
22442245
headers:
22452246
X-Rate-Limit-Limit:
@@ -2598,19 +2599,19 @@ Tooling implementations MAY choose to validate compatibility automatically, and
25982599

25992600
##### Working with Examples
26002601

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.
26042605
Each of these fields has slightly different considerations.
26052606

26062607
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.
26072608
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.
26082609

2609-
The mutually exclusive fields in the Parameter 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 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).
26112612
Because examples using these fields represent the final serialized form of the data, they SHALL _override_ any `example` in the corresponding Schema Object.
26122613

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`.
26142615

26152616
Some examples cannot be represented directly in JSON or YAML.
26162617
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
27732774
This object MAY be extended with [Specification Extensions](#specification-extensions).
27742775

27752776
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).
27772778
Because of the potential for name clashes, the `operationRef` syntax is preferred for multi-document OADs.
27782779
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.
27792780
In such ambiguous cases, the resulting behavior is implementation-defined and MAY result in an error.
@@ -4505,7 +4506,7 @@ flows:
45054506

45064507
Lists the required security schemes to execute this operation.
45074508

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.
45094510
Property names that are identical to a component name under the Components Object MUST be treated as a component name.
45104511
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`).
45114512

@@ -5023,7 +5024,7 @@ This specification normatively cites the following relevant standards:
50235024
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.
50245025
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 `+`.
50255026

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.
50275028
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.
50285029

50295030
Note that content-based serialization for `form-data` does not expect or require percent-encoding in the data, only in per-part header values.

src/schemas/validation/schema.yaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ properties:
1212
$ref: '#/$defs/info'
1313
jsonSchemaDialect:
1414
type: string
15-
format: uri
15+
format: uri-reference
1616
default: 'https://spec.openapis.org/oas/3.2/dialect/WORK-IN-PROGRESS'
1717
servers:
1818
type: array
@@ -64,7 +64,7 @@ $defs:
6464
type: string
6565
termsOfService:
6666
type: string
67-
format: uri
67+
format: uri-reference
6868
contact:
6969
$ref: '#/$defs/contact'
7070
license:
@@ -85,7 +85,7 @@ $defs:
8585
type: string
8686
url:
8787
type: string
88-
format: uri
88+
format: uri-reference
8989
email:
9090
type: string
9191
format: email
@@ -102,7 +102,7 @@ $defs:
102102
type: string
103103
url:
104104
type: string
105-
format: uri
105+
format: uri-reference
106106
required:
107107
- name
108108
dependentSchemas:
@@ -319,7 +319,7 @@ $defs:
319319
type: string
320320
url:
321321
type: string
322-
format: uri
322+
format: uri-reference
323323
required:
324324
- url
325325
$ref: '#/$defs/specification-extensions'
@@ -620,7 +620,7 @@ $defs:
620620
value: true
621621
externalValue:
622622
type: string
623-
format: uri
623+
format: uri-reference
624624
not:
625625
required:
626626
- value
@@ -864,7 +864,7 @@ $defs:
864864
properties:
865865
openIdConnectUrl:
866866
type: string
867-
format: uri
867+
format: uri-reference
868868
required:
869869
- openIdConnectUrl
870870

@@ -900,10 +900,10 @@ $defs:
900900
properties:
901901
authorizationUrl:
902902
type: string
903-
format: uri
903+
format: uri-reference
904904
refreshUrl:
905905
type: string
906-
format: uri
906+
format: uri-reference
907907
scopes:
908908
$ref: '#/$defs/map-of-strings'
909909
required:
@@ -917,10 +917,10 @@ $defs:
917917
properties:
918918
tokenUrl:
919919
type: string
920-
format: uri
920+
format: uri-reference
921921
refreshUrl:
922922
type: string
923-
format: uri
923+
format: uri-reference
924924
scopes:
925925
$ref: '#/$defs/map-of-strings'
926926
required:
@@ -934,10 +934,10 @@ $defs:
934934
properties:
935935
tokenUrl:
936936
type: string
937-
format: uri
937+
format: uri-reference
938938
refreshUrl:
939939
type: string
940-
format: uri
940+
format: uri-reference
941941
scopes:
942942
$ref: '#/$defs/map-of-strings'
943943
required:
@@ -951,13 +951,13 @@ $defs:
951951
properties:
952952
authorizationUrl:
953953
type: string
954-
format: uri
954+
format: uri-reference
955955
tokenUrl:
956956
type: string
957-
format: uri
957+
format: uri-reference
958958
refreshUrl:
959959
type: string
960-
format: uri
960+
format: uri-reference
961961
scopes:
962962
$ref: '#/$defs/map-of-strings'
963963
required:

0 commit comments

Comments
 (0)