Skip to content

Commit 9a6fa8e

Browse files
committed
Appendix C
1 parent 43039d0 commit 9a6fa8e

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

versions/3.0.4.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3950,10 +3950,10 @@ Certain properties allow the use of Markdown which can contain HTML including sc
39503950

39513951
Serializing typed data to plain text, which can occur in `text/plain` message bodies or `multipart` parts, as well as in the `application/x-www-form-urlencoded` format in either URL query strings or message bodies, involves significant implementation- or application-defined behavior.
39523952

3953-
Schema Objects validate data based on the [JSON Schema data model](https://tools.ietf.org/html/draft-wright-json-schema-00#section-4.2), which only recognizes four primitive data types: strings (which are [only broadly interoperable as UTF-8](https://datatracker.ietf.org/doc/html/rfc7159#section-8.1)), numbers, booleans, and `null`.
3954-
Notably, integers are not a distinct type from other numbers, with `type: integer` being a convenience defined mathematically, rather than based on the presence or absence of a decimal point in any string representation.
3953+
[Schema Objects](#schema-object) validate data based on the [JSON Schema data model](https://tools.ietf.org/html/draft-wright-json-schema-00#section-4.2), which only recognizes four primitive data types: strings (which are [only broadly interoperable as UTF-8](https://datatracker.ietf.org/doc/html/rfc7159#section-8.1)), numbers, booleans, and `null`.
3954+
Notably, integers are not a distinct type from other numbers, with `type: "integer"` being a convenience defined mathematically, rather than based on the presence or absence of a decimal point in any string representation.
39553955
3956-
The [Parameter Object](#parameter-object), [Header Object](#header-object) and [Encoding Object](#encoding-object) offer features to control how to arrange values from array or object types.
3956+
The [Parameter Object](#parameter-object), [Header Object](#header-object), and [Encoding Object](#encoding-object) offer features to control how to arrange values from array or object types.
39573957
They can also be used to control how strings are further encoded to avoid reserved or illegal characters.
39583958
However, there is no general-purpose specification for converting schema-validated non-UTF-8 primitive data types (or entire arrays or objects) to strings.
39593959
@@ -3965,7 +3965,7 @@ Two cases do offer standards-based guidance:
39653965
Implementations of RFC6570 often have their own conventions for converting non-string values, but these are implementation-specific and not defined by the RFC itself.
39663966
This is one reason for the OpenAPI Specification to leave these conversions as implementation-defined: It allows using RFC6570 implementations regardless of how they choose to perform the conversions.
39673967

3968-
To control the serialization of numbers, booleans, and `null` (or other values RFC6570 deems to be undefined) more precisely, schemas can be defined as `type: string` and constrained using `pattern`, `enum`, `format`, and other keywords to communicate how applications must pre-convert their data prior to schema validation.
3968+
To control the serialization of numbers, booleans, and `null` (or other values RFC6570 deems to be undefined) more precisely, schemas can be defined as `type: "string"` and constrained using `pattern`, `enum`, `format`, and other keywords to communicate how applications must pre-convert their data prior to schema validation.
39693969
The resulting strings would not require any further type conversion.
39703970

39713971
The `format` keyword can assist in serialization.
@@ -3976,7 +3976,7 @@ Requiring input as pre-formatted, schema-validated strings also improves round-t
39763976

39773977
## Appendix C: Using RFC6570 Implementations
39783978

3979-
Serialization is defined in terms of RFC6570 URI Templates in two scenarios:
3979+
Serialization is defined in terms of [RFC6570](https://www.rfc-editor.org/rfc/rfc6570) URI Templates in two scenarios:
39803980

39813981
| Object | Condition |
39823982
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
@@ -3985,27 +3985,27 @@ Serialization is defined in terms of RFC6570 URI Templates in two scenarios:
39853985

39863986
Implementations of this specification MAY use an implementation of RFC6570 to perform variable expansion, however, some caveats apply.
39873987

3988-
Note that when using `style: form` RFC6570 expansion to produce an `application/x-www-form-urlencoded` HTTP message body, it is necessary to remove the `?` prefix that is produced to satisfy the URI query string syntax.
3988+
Note that when using `style: "form"` RFC6570 expansion to produce an `application/x-www-form-urlencoded` HTTP message body, it is necessary to remove the `?` prefix that is produced to satisfy the URI query string syntax.
39893989

39903990
Note also that not all RFC6570 implementations support all four levels of operators, all of which are needed to fully support the OpenAPI Specification's usage.
39913991
Using an implementation with a lower level of support will require additional manual construction of URI Templates to work around the limitations.
39923992

39933993
### Equivalences Between Fields and RFC6570 Operators
39943994

3995-
Certain field values translate to RFC6570 operators (or lack thereof):
3995+
Certain field values translate to RFC6570 [operators](https://datatracker.ietf.org/doc/html/rfc6570#section-2.2) (or lack thereof):
39963996

3997-
| field | value | equivalent |
3998-
| ------------- | ------- | ------------------- |
3999-
| style | simple | _n/a_ |
4000-
| style | matrix | `;` prefix operator |
4001-
| style | label | `.` prefix operator |
4002-
| style | form | `?` prefix operator |
4003-
| allowReserved | `false` | _n/a_ |
4004-
| allowReserved | `true` | `+` prefix operator |
4005-
| explode | `false` | _n/a_ |
4006-
| explode | `true` | `*` modifier suffix |
3997+
| field | value | equivalent |
3998+
| ------------- | ---------- | ------------------- |
3999+
| style | `"simple"` | _n/a_ |
4000+
| style | `"matrix"` | `;` prefix operator |
4001+
| style | `"label"` | `.` prefix operator |
4002+
| style | `"form"` | `?` prefix operator |
4003+
| allowReserved | `false` | _n/a_ |
4004+
| allowReserved | `true` | `+` prefix operator |
4005+
| explode | `false` | _n/a_ |
4006+
| explode | `true` | `*` modifier suffix |
40074007

4008-
Multiple `style: form` parameters are equivalent to a single RFC6570 [variable list](https://www.rfc-editor.org/rfc/rfc6570#section-2.2) using the `?` prefix operator:
4008+
Multiple `style: "form"` parameters are equivalent to a single RFC6570 [variable list](https://www.rfc-editor.org/rfc/rfc6570#section-2.2) using the `?` prefix operator:
40094009

40104010
```YAML
40114011
parameters:
@@ -4027,7 +4027,7 @@ Note that RFC6570 does not specify behavior for compound values beyond the singl
40274027

40284028
### Non-RFC6570 Field Values and Combinations
40294029

4030-
Configurations with no direct RFC6570 equivalent SHOULD also be handled according to RFC6570.
4030+
Configurations with no direct [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570) equivalent SHOULD also be handled according to RFC6570.
40314031
Implementations MAY create a properly delimited URI Template with variables for individual names and values using RFC6570 regular or reserved expansion (based on `allowReserved`).
40324032

40334033
This includes:
@@ -4036,7 +4036,7 @@ This includes:
40364036
* the combination of the style `form` with `allowReserved: true`, which is not allowed because only one prefix operator can be used at a time
40374037
* any parameter name that is not a legal RFC6570 variable name
40384038

4039-
The Parameter Object's `name` field has a much more permissive syntax than [RFC6570 variable name syntax](https://www.rfc-editor.org/rfc/rfc6570#section-2.3).
4039+
The Parameter Object's `name` field has a much more permissive syntax than RFC6570 [variable name syntax](https://www.rfc-editor.org/rfc/rfc6570#section-2.3).
40404040
A parameter name that includes characters outside of the allowed RFC6570 variable character set MUST be percent-encoded before it can be used in a URI Template.
40414041

40424042
### Examples
@@ -4056,7 +4056,7 @@ words:
40564056

40574057
#### RFC6570-Equivalent Expansion
40584058

4059-
This array of Parameter Objects uses regular `style: "form"` expansion, fully supported by RFC6570:
4059+
This array of Parameter Objects uses regular `style: "form"` expansion, fully supported by [RFC6570](https://datatracker.ietf.org/doc/html/rfc6570):
40604060
40614061
```YAML
40624062
parameters:
@@ -4090,7 +4090,7 @@ when expanded with the data given earlier, we get:
40904090
#### Expansion With Non-RFC6570-Supported Options
40914091

40924092
But now let's say that (for some reason), we really want that `/` in the `b` formula to show up as-is in the query string, and we want our words to be space-separated like in a written phrase.
4093-
To do that, we'll add `allowReserved: true` to `formulas`, and change to `style: spaceDelimited` for `words`:
4093+
To do that, we'll add `allowReserved: true` to `formulas`, and change to `style: "spaceDelimited"` for `words`:
40944094

40954095
```YAML
40964096
parameters:
@@ -4111,7 +4111,7 @@ parameters:
41114111
type: string
41124112
```
41134113
4114-
We can't combine the `?` and `+` RFC6570 prefixes, and there's no way with RFC6570 to replace the `,` separator with a space character.
4114+
We can't combine the `?` and `+` RFC6570 [prefixes](https://datatracker.ietf.org/doc/html/rfc6570#section-2.4.1), and there's no way with RFC6570 to replace the `,` separator with a space character.
41154115
So we need to restructure the data to fit a manually constructed URI Template that passes all of the pieces through the right sort of expansion.
41164116

41174117
Here is one such template, using a made-up convention of `words.0` for the first entry in the words value, `words.1` for the second, and `words.2` for the third:
@@ -4150,7 +4150,7 @@ The `/` and the pre-percent-encoded `%2B` have been left alone, but the disallow
41504150

41514151
#### Undefined Values and Manual URI Template Construction
41524152

4153-
Care must be taken when manually constructing templates to handle the values that [RFC6570 considers to be _undefined_](https://datatracker.ietf.org/doc/html/rfc6570#section-2.3) correctly:
4153+
Care must be taken when manually constructing templates to handle the values that RFC6570 [considers to be _undefined_](https://datatracker.ietf.org/doc/html/rfc6570#section-2.3) correctly:
41544154

41554155
```YAML
41564156
formulas: {}
@@ -4198,7 +4198,7 @@ parameters:
41984198
type: string
41994199
```
42004200

4201-
We can't just pass `❤️: love!` to an RFC6570 implementation.
4201+
We can't just pass `❤️: "love!"` to an RFC6570 implementation.
42024202
Instead, we have to pre-percent-encode the name (which is a six-octet UTF-8 sequence) in both the data and the URI Template:
42034203
42044204
```YAML

0 commit comments

Comments
 (0)