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
+57-57Lines changed: 57 additions & 57 deletions
Original file line number
Diff line number
Diff line change
@@ -221,6 +221,63 @@ JSON or YAML objects within an OAD are interpreted as specific Objects (such as
221
221
222
222
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.
223
223
224
+
#### Relative References in API Description URIs
225
+
226
+
URIs used as references within an OpenAPI Description, or to external documentation or other supplementary information such as a license, are resolved as _identifiers_, and described by this specification as **_URIs_**.
227
+
As noted under [Parsing Documents](#parsing-documents), this specification inherits JSON Schema Specification Draft 2020-12's requirements for [loading documents](https://www.ietf.org/archive/id/draft-bhutton-json-schema-01.html#section-9) and associating them with their expected URIs, which might not match their current ___location.
228
+
This feature is used both for working in development or test environments without having to change the URIs, and for working within restrictive network configurations or security policies.
229
+
230
+
Note that some URI fields are named `url` for historical reasons, but the descriptive text for those fields uses the correct "URI" terminology.
231
+
232
+
Unless specified otherwise, all fields that are URIs MAY be relative references as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-4.2).
233
+
234
+
##### Establishing the Base URI
235
+
236
+
Relative URI references are resolved using the appropriate base URI, which MUST be determined in accordance with [[RFC3986]][Section 5.1.1 – 5.1.4](https://tools.ietf.org/html/rfc3986#section-5.1.1) and, for Schema objects, [JSON Schema draft 2020-12 Section 8.2](https://www.ietf.org/archive/id/draft-bhutton-json-schema-01.html#section-8.2), as illustrated by the examles in [Appendix G: Examples of Base URI Determination and Reference Resolution](#appendix-g-examples-of-base-uri-determination-and-reference-resolution).
237
+
238
+
If `$self` is a relative URI-reference, it is resolved agains the next possible base URI source ([[RFC3986]][Section 5.1.2 – 5.1.4](https://tools.ietf.org/html/rfc3986#section-5.1.2)) before being used for the resolution of other relative URI-references.
239
+
240
+
The most common base URI source that is used in the event of a missing or relative `$self` (in the [OpenAPI Object](#openapi-object)) and (for [Schema Object](#schema-object)) `$id` is the retrieval URI.
241
+
Implementations MAY support document retrieval, although see the [Security Considerations](#security-considerations) sections for additional guidance.
242
+
Even if retrieval is supported, it may be impossible due to network configuration or server unavailability (including the server hosting an older version while a new version is in development), or undesirable due to performance impacts.
243
+
Therefore, all implementations SHOULD allow users to provide the intended retrieval URI for each document so that references can be resolved as if retrievals were performed.
244
+
245
+
##### Resolving URI fragments
246
+
247
+
If a URI contains a fragment identifier, then the fragment should be resolved per the fragment resolution mechanism of the referenced document. If the representation of the referenced document is JSON or YAML, then the fragment identifier SHOULD be interpreted as a JSON-Pointer as per [RFC6901](https://tools.ietf.org/html/rfc6901).
248
+
249
+
##### Relative URI References in CommonMark Fields
250
+
251
+
Relative references in CommonMark hyperlinks are resolved in their rendered context, which might differ from the context of the API description.
252
+
253
+
#### Relative References in API URLs
254
+
255
+
API endpoints are by definition accessed as locations, and are described by this specification as **_URLs_**.
256
+
257
+
Unless specified otherwise, all fields that are URLs MAY be relative references as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-4.2).
258
+
259
+
Because the API Is a distinct entity from the OpenAPI Document, RFC3986's base URI rules for the OpenAPI Document do not apply.
260
+
Unless specified otherwise, relative references are resolved using the URLs defined in the [Server Object](#server-object) as a Base URL. Note that these themselves MAY be relative to the referring document.
261
+
262
+
##### Examples of API Base URL Determination
263
+
264
+
Assume a retrieval URI of `https://device1.example.com` for the following OpenAPI Document:
265
+
266
+
```YAML
267
+
openapi: 3.2.0
268
+
$self: https://apidescriptions.example.com/foo
269
+
info:
270
+
title: Example API
271
+
version: 1.0
272
+
servers:
273
+
- url: .
274
+
description: The production API on this device
275
+
- url: ./test
276
+
description: The test API on this device
277
+
```
278
+
279
+
For API URLs the `$self` field, which identifies the OpenAPI Document, is ignored and the retrieval URI is used instead. This produces a normalized production URL of `https://device1.example.com`, and a normalized test URL of `https://device1.example.com/test`.
280
+
224
281
#### Resolving Implicit Connections
225
282
226
283
Several features of this specification require resolution of non-URI-based connections to some other part of the OpenAPI Description (OAD).
@@ -335,63 +392,6 @@ Where OpenAPI tooling renders rich text it MUST support, at a minimum, markdown
335
392
While the framing of CommonMark 0.27 as a minimum requirement means that tooling MAY choose to implement extensions on top of it, note that any such extensions are by definition implementation-defined and will not be interoperable.
336
393
OpenAPI Description authors SHOULD consider how text using such extensions will be rendered by tools that offer only the minimum support.
337
394
338
-
### Relative References in API Description URIs
339
-
340
-
URIs used as references within an OpenAPI Description, or to external documentation or other supplementary information such as a license, are resolved as _identifiers_, and described by this specification as **_URIs_**.
341
-
As noted under [Parsing Documents](#parsing-documents), this specification inherits JSON Schema Specification Draft 2020-12's requirements for [loading documents](https://www.ietf.org/archive/id/draft-bhutton-json-schema-01.html#section-9) and associating them with their expected URIs, which might not match their current ___location.
342
-
This feature is used both for working in development or test environments without having to change the URIs, and for working within restrictive network configurations or security policies.
343
-
344
-
Note that some URI fields are named `url` for historical reasons, but the descriptive text for those fields uses the correct "URI" terminology.
345
-
346
-
Unless specified otherwise, all fields that are URIs MAY be relative references as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-4.2).
347
-
348
-
#### Establishing the Base URI
349
-
350
-
Relative URI references are resolved using the appropriate base URI, which MUST be determined in accordance with [[RFC3986]][Section 5.1.1 – 5.1.4](https://tools.ietf.org/html/rfc3986#section-5.1.1) and, for Schema objects, [JSON Schema draft 2020-12 Section 8.2](https://www.ietf.org/archive/id/draft-bhutton-json-schema-01.html#section-8.2), as illustrated by the examles in [Appendix G: Examples of Base URI Determination and Reference Resolution](#appendix-g-examples-of-base-uri-determination-and-reference-resolution).
351
-
352
-
If `$self` is a relative URI-reference, it is resolved agains the next possible base URI source ([[RFC3986]][Section 5.1.2 – 5.1.4](https://tools.ietf.org/html/rfc3986#section-5.1.2)) before being used for the resolution of other relative URI-references.
353
-
354
-
The most common base URI source that is used in the event of a missing or relative `$self` (in the [OpenAPI Object](#openapi-object)) and (for [Schema Object](#schema-object)) `$id` is the retrieval URI.
355
-
Implementations MAY support document retrieval, although see the [Security Considerations](#security-considerations) sections for additional guidance.
356
-
Even if retrieval is supported, it may be impossible due to network configuration or server unavailability (including the server hosting an older version while a new version is in development), or undesirable due to performance impacts.
357
-
Therefore, all implementations SHOULD allow users to provide the intended retrieval URI for each document so that references can be resolved as if retrievals were performed.
358
-
359
-
#### Resolving URI fragments
360
-
361
-
If a URI contains a fragment identifier, then the fragment should be resolved per the fragment resolution mechanism of the referenced document. If the representation of the referenced document is JSON or YAML, then the fragment identifier SHOULD be interpreted as a JSON-Pointer as per [RFC6901](https://tools.ietf.org/html/rfc6901).
362
-
363
-
#### Relative URI References in CommonMark Fields
364
-
365
-
Relative references in CommonMark hyperlinks are resolved in their rendered context, which might differ from the context of the API description.
366
-
367
-
### Relative References in API URLs
368
-
369
-
API endpoints are by definition accessed as locations, and are described by this specification as **_URLs_**.
370
-
371
-
Unless specified otherwise, all fields that are URLs MAY be relative references as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-4.2).
372
-
373
-
Because the API Is a distinct entity from the OpenAPI Document, RFC3986's base URI rules for the OpenAPI Document do not apply.
374
-
Unless specified otherwise, relative references are resolved using the URLs defined in the [Server Object](#server-object) as a Base URL. Note that these themselves MAY be relative to the referring document.
375
-
376
-
#### Examples of API Base URL Determination
377
-
378
-
Assume a retrieval URI of `https://device1.example.com` for the following OpenAPI Document:
379
-
380
-
```YAML
381
-
openapi: 3.2.0
382
-
$self: https://apidescriptions.example.com/foo
383
-
info:
384
-
title: Example API
385
-
version: 1.0
386
-
servers:
387
-
- url: .
388
-
description: The production API on this device
389
-
- url: ./test
390
-
description: The test API on this device
391
-
```
392
-
393
-
For API URLs the `$self` field, which identifies the OpenAPI Document, is ignored and the retrieval URI is used instead. This produces a normalized production URL of `https://device1.example.com`, and a normalized test URL of `https://device1.example.com/test`.
394
-
395
395
### Schema
396
396
397
397
This section describes the structure of the OpenAPI Description format.
0 commit comments