Skip to content

Commit 6d1ca8e

Browse files
authored
Merge pull request #3732 from handrews/multi-parse
Limit interoperable parsing expectations (avoid type conflicts)
2 parents 84815b5 + ea38588 commit 6d1ca8e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

versions/3.1.1.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,20 @@ In order to preserve the ability to round-trip between YAML and JSON formats, YA
136136

137137
### <a name="documentStructure"></a>OpenAPI Description Structure
138138

139-
An OpenAPI Description MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the author. In the latter case, [`Reference Objects`](#referenceObject) and [`Schema Object`](#schemaObject) `$ref` keywords are used. In a multi-document description, the document containing the [OpenAPI Object](#oasObject) is known as the **entry OpenAPI document.**
139+
An OpenAPI Description (OAD) MAY be made up of a single document or be divided into multiple, connected parts at the discretion of the author. In the latter case, [Reference Object](#referenceObject), [Path Item Object](#pathItemObject) and [Schema Object](#schemaObject) `$ref` keywords, as well as the [Link Object](#linkObject) `operationRef` keyword, are used. In a multi-document description, the document containing the [OpenAPI Object](#oasObject) is known as the **entry OpenAPI document.**
140140

141141
It is RECOMMENDED that the entry OpenAPI document be named: `openapi.json` or `openapi.yaml`.
142142

143+
#### <a name="structuralInteroperability"></a>Structural Interoperability
144+
145+
When parsing an OAD, JSON or YAML objects are parsed into specific Objects (such as [Operation Objects](#operationObject), [Response Objects](#responseObject), [Reference Objects](#referenceObject), etc.) based on the parsing context. Depending on how references are arranged, a given JSON or YAML object can be parsed in multiple different contexts:
146+
147+
* As a full OpenAPI Description document (an [OpenAPI Object](#oasObject) taking up an entire document)
148+
* As the Object type implied by its parent Object within the document
149+
* As a reference target, with the Object type matching the reference source's context
150+
151+
If the same JSON/YAML object is parsed multiple times and the respective contexts require it to be parsed as _different_ Object types, the resulting behavior is _implementation defined_, and MAY be treated as an error if detected. An example would be referencing an empty Schema Object under `#/components/schemas` where a Path Item Object is expected, as an empty object is valid for both types. For maximum interoperability, it is RECOMMENDED that OpenAPI Description authors avoid such scenarios.
152+
143153
### <a name="dataTypes"></a>Data Types
144154

145155
Data types in the OAS are based on the types supported by the [JSON Schema Specification Draft 2020-12](https://tools.ietf.org/html/draft-bhutton-json-schema-00#section-4.2.1).

0 commit comments

Comments
 (0)