Skip to content

Commit 00dbb5d

Browse files
authored
Merge pull request #4758 from handrews/yaml
v3.2: Clarify JSON-compatible YAML
2 parents 52b3218 + 454ba92 commit 00dbb5d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/oas.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,14 @@ The [schema](#schema) exposes two types of fields: _fixed fields_, which have a
171171

172172
Patterned fields MUST have unique names within the containing object.
173173

174-
In order to preserve the ability to round-trip between YAML and JSON formats, YAML version [1.2](https://yaml.org/spec/1.2/spec.html) is RECOMMENDED along with some additional constraints:
174+
**Note:** While APIs may be described by OpenAPI Descriptions in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML.
175175

176-
* Tags MUST be limited to those allowed by [YAML's JSON schema ruleset](https://yaml.org/spec/1.2/spec.html#id2803231), which defines a subset of the YAML syntax and is unrelated to [[JSON-Schema-2020-12|JSON Schema]].
177-
* Keys used in YAML maps MUST be limited to a scalar string, as defined by the [YAML Failsafe schema ruleset](https://yaml.org/spec/1.2/spec.html#id2802346).
176+
#### JSON and YAML Compatibility
178177

179-
**Note:** While APIs may be described by OpenAPI Descriptions in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML.
178+
In order to preserve the ability to round-trip between YAML and JSON formats, YAML version [1.2](https://yaml.org/spec/1.2/spec.html) is RECOMMENDED along with the additional constraints listed in [[!RFC9512]] [Section 3.4](https://www.rfc-editor.org/rfc/rfc9512.html#name-yaml-and-json).
179+
180+
The recommendation in previous versions of this specification to restrict YAML to its "JSON" [schema ruleset](https://yaml.org/spec/1.2/spec.html#id2803231) allowed for the inclusion of certain values that (despite the name) cannot be represented in JSON.
181+
OAD authors SHOULD NOT rely on any such JSON-incompatible YAML values.
180182

181183
### OpenAPI Description Structure
182184

0 commit comments

Comments
 (0)