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: versions/3.0.4.md
+29-28Lines changed: 29 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ This document is licensed under [The Apache License, Version 2.0](https://www.ap
10
10
11
11
The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to HTTP APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.
12
12
13
-
An OpenAPI description can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.
13
+
An OpenAPI Description can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.
14
14
15
15
For examples of OpenAPI usage and additional documentation, please visit [[?OpenAPI-Learn]].
16
16
@@ -89,11 +89,11 @@ The OpenAPI Specification is versioned using a `major`.`minor`.`patch` versionin
89
89
90
90
Occasionally, non-backwards compatible changes may be made in `minor` versions of the OAS where impact is believed to be low relative to the benefit provided.
91
91
92
-
An OpenAPI description document compatible with OAS 3.\*.\* contains a required [`openapi`](#oas-version) field which designates the version of the OAS that it uses.
92
+
An OpenAPI Description compatible with OAS 3.\*.\* contains a required [`openapi`](#oas-version) field which designates the version of the OAS that it uses.
93
93
94
94
### Format
95
95
96
-
An OpenAPI description document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format.
96
+
An OpenAPI Description that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format.
97
97
98
98
For example, if a field has an array value, the JSON array representation will be used:
99
99
@@ -115,25 +115,22 @@ In order to preserve the ability to round-trip between YAML and JSON formats, YA
115
115
* 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-05|JSON Schema]].
116
116
* 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).
117
117
118
-
**Note:** While APIs may be described by OpenAPI documents in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML.
118
+
**Note:** While APIs may be described by OpenAPI Description in either YAML or JSON format, the API request and response bodies and other content are not required to be JSON or YAML.
119
119
120
120
### OpenAPI Description Structure
121
121
122
-
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](#reference-object) and [Path Item Object](#path-item-object)`$ref` keywords, as well as the [Link Object](#link-object)`operationRef` keyword, are used.
122
+
An OpenAPI Description (OAD) MAY be structured as a single JSON or YAML document or composed from elements distributed across multiple documents at the discretion of the author. In the latter case, [Reference Object](#reference-object) and [Path Item Object](#path-item-object)`$ref` keywords, as well as the [Link Object](#link-object)`operationRef` keyword, are used to identify the documents containing the referenced elements.
123
123
124
-
Any document consisting entirely of an [OpenAPI Object](#openapi-object) is known as a **syntactically complete OpenAPI document**.
125
-
An OpenAPI document that does _not_ reference any other documents is known as a **self-contained OpenAPI document**.
126
-
A single-document description is therefore _both_ syntactically complete _and_ self-contained.
127
-
In a multi-document description, the document containing the OpenAPI Object where parsing begins for a specific API's description is known as that API's **entry OpenAPI document**, or simply **entry document**.
124
+
In a multi-document OAD, the document containing the OpenAPI Object where parsing begins is known as that OAD's **entry document**.
128
125
129
-
It is RECOMMENDED that the entry OpenAPI document be named: `openapi.json` or `openapi.yaml`.
126
+
It is RECOMMENDED that the entry document of an OAD be named: `openapi.json` or `openapi.yaml`.
130
127
131
128
#### Structural Interoperability
132
129
133
-
When parsing an OAD, JSON or YAML objects are parsed into specific Objects (such as [Operation Objects](#operation-object), [Response Objects](#response-object), [Reference Objects](#reference-object), 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:
130
+
JSON or YAML objects within an OAD are interpreted as specific Objects (such as [Operation Objects](#operation-object), [Response Objects](#response-object), [Reference Objects](#reference-object), etc.) based on their context. Depending on how references are arranged, a given JSON or YAML object can be interpreted in multiple different contexts:
134
131
135
-
*As a syntactically complete OpenAPI Description document
136
-
* As the Object type implied by its parent Object within the document
132
+
*The root object of the entry document is interpreted as an OpenAPI Object
133
+
* As the Object type implied by its parent Object within the description
137
134
* As a reference target, with the Object type matching the reference source's context
138
135
139
136
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.
@@ -249,13 +246,13 @@ In the following description, if a field is not explicitly **REQUIRED** or descr
249
246
250
247
#### OpenAPI Object
251
248
252
-
This is the root object of the [OpenAPI document](#openapi-description).
249
+
This is the root object of the [OpenAPI Description](#openapi-description).
253
250
254
251
##### Fixed Fields
255
252
256
253
| Field Name | Type | Description |
257
254
| ---- | :----: | ---- |
258
-
| <aname="oas-version"></a>openapi |`string`|**REQUIRED**. This string MUST be the [version number](#versions) of the OpenAPI Specification that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling to interpret the OpenAPI document. This is _not_ related to the API [`info.version`](#info-version) string. |
255
+
| <aname="oas-version"></a>openapi |`string`|**REQUIRED**. This string MUST be the [version number](#versions) of the OpenAPI Specification that the OpenAPI Description uses. The `openapi` field SHOULD be used by tooling to interpret the OpenAPI Description. This is _not_ related to the API [`info.version`](#info-version) string. |
259
256
| <aname="oas-info"></a>info |[Info Object](#info-object)|**REQUIRED**. Provides metadata about the API. The metadata MAY be used by tooling as required. |
260
257
| <aname="oas-servers"></a>servers |[[Server Object](#server-object)]| An array of Server Objects, which provide connectivity information to a target server. If the `servers` field is not provided, or is an empty array, the default value would be a [Server Object](#server-object) with a [url](#server-url) value of `/`. |
261
258
| <aname="oas-paths"></a>paths |[Paths Object](#paths-object)|**REQUIRED**. The available paths and operations for the API. |
@@ -280,7 +277,7 @@ The metadata MAY be used by the clients if needed, and MAY be presented in editi
280
277
| <aname="info-terms-of-service"></a>termsOfService |`string`| A URL for the Terms of Service for the API. This MUST be in the form of a URL. |
281
278
| <aname="info-contact"></a>contact |[Contact Object](#contact-object)| The contact information for the exposed API. |
282
279
| <aname="info-license"></a>license |[License Object](#license-object)| The license information for the exposed API. |
283
-
| <aname="info-version"></a>version |`string`|**REQUIRED**. The version of the OpenAPI document (which is distinct from the [OpenAPI Specification version](#oas-version) or the version of the API being described). |
280
+
| <aname="info-version"></a>version |`string`|**REQUIRED**. The version of the OpenAPI Description (which is distinct from the [OpenAPI Specification version](#oas-version) or the version of the API being described). |
284
281
285
282
This object MAY be extended with [Specification Extensions](#specification-extensions).
286
283
@@ -383,7 +380,7 @@ An object representing a Server.
383
380
384
381
| Field Name | Type | Description |
385
382
| ---- | :----: | ---- |
386
-
| <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 OpenAPI document is being served. Variable substitutions will be made when a variable is named in `{`braces`}`. |
383
+
| <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 entry document of the OpenAPI Description is being served. Variable substitutions will be made when a variable is named in `{`braces`}`. |
387
384
| <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. |
388
385
| <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. |
389
386
@@ -2152,7 +2149,7 @@ Because examples using these fields represent the final serialized form of the d
2152
2149
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`.
2153
2150
2154
2151
Some examples cannot be represented directly in JSON or YAML.
2155
-
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 the OpenAPI Description document.
2152
+
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 the OpenAPI Description.
2156
2153
With the Example Object, such values can alternatively be handled through the `externalValue` field.
2157
2154
2158
2155
##### Example Object Examples
@@ -2302,7 +2299,7 @@ For computing links and providing instructions to execute them, a [runtime expre
2302
2299
2303
2300
| Field Name | Type | Description |
2304
2301
| ---- | :----: | ---- |
2305
-
| <a name="link-operation-ref"></a>operationRef | `string` | A relative or absolute URI reference to an OAS operation. This field is mutually exclusive of the `operationId` field, and MUST point to an [Operation Object](#operation-object). Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operation-object) in the OpenAPI description. |
2302
+
| <a name="link-operation-ref"></a>operationRef | `string` | A relative or absolute URI reference to an OAS operation. This field is mutually exclusive of the `operationId` field, and MUST point to an [Operation Object](#operation-object). Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operation-object) in the OpenAPI Description. |
2306
2303
| <a name="link-operation-id"></a>operationId | `string` | The name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive of the `operationRef` field. |
2307
2304
| <a name="link-parameters"></a>parameters | Map[`string`, Any \| [{expression}](#runtime-expressions)] | A map representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`. The key is the parameter name to be used (optionally qualified with the parameter location, e.g. `path.id` for an `id` parameter in the path), whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. |
2308
2305
| <a name="link-request-body"></a>requestBody | Any \| [{expression}](#runtime-expressions) | A literal value or [{expression}](#runtime-expressions) to use as a request body when calling the target operation. |
A simple object to allow referencing other components in the OpenAPI document, internally and externally.
2592
+
A simple object to allow referencing other components in the OpenAPI Description, internally and externally.
2596
2593
2597
2594
The Reference Object is defined by [JSON Reference](https://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03) and follows the same structure, behavior and rules.
2598
2595
@@ -3076,7 +3073,7 @@ However, the exact nature of such conversions are implementation-defined.
3076
3073
3077
3074
##### Examples
3078
3075
3079
-
For these examples, assume all schemas are in the entry OpenAPI document; for handling of `discriminator` in referenced documents see [Resolving Implicit Connections](#resolving-implicit-connections).
3076
+
For these examples, assume all schemas are in a single-document OpenAPI Description; for handling of `discriminator` in referenced documents see [Resolving Implicit Connections](#resolving-implicit-connections).
3080
3077
3081
3078
In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:
3082
3079
@@ -3100,7 +3097,7 @@ MyResponseType:
3100
3097
propertyName: petType
3101
3098
```
3102
3099
3103
-
The expectation now is that a property with name `petType` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OpenAPI description. Thus the response payload:
3100
+
The expectation now is that a property with name `petType` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OpenAPI Description. Thus the response payload:
3104
3101
3105
3102
```json
3106
3103
{
@@ -3802,7 +3799,7 @@ The extensions properties are implemented as patterned fields that are always pr
3802
3799
3803
3800
The OpenAPI Initiative maintains several [[OpenAPI-Registry|extension registries]], including registries for [individual extension keywords](https://spec.openapis.org/registry/extension/) and [extension keyword namespaces](https://spec.openapis.org/registry/namespace/).
3804
3801
3805
-
Extensions are one of the best ways to prove the viability of proposed additions to the specification.
3802
+
Extensions are one of the best ways to prove the viability of proposed additions to the specification.
3806
3803
It is therefore RECOMMENDED that implementations be designed for extensibility to support community experimentation.
3807
3804
3808
3805
Support for any one extension is OPTIONAL, and support for one extension does not imply support for others.
@@ -3821,9 +3818,9 @@ Two examples of this:
3821
3818
3822
3819
## Security Considerations
3823
3820
3824
-
### OpenAPI Document Formats
3821
+
### OpenAPI Description Formats
3825
3822
3826
-
OpenAPI description documents use JSON, YAML, and JSON Schema, and therefore share their security considerations:
3823
+
OpenAPI Descriptions use JSON, YAML, and JSON Schema, and therefore share their security considerations:
@@ -3832,15 +3829,19 @@ OpenAPI description documents use JSON, YAML, and JSON Schema, and therefore sha
3832
3829
3833
3830
### Tooling and Usage Scenarios
3834
3831
3835
-
In addition, OpenAPI description documents are processed by a wide variety of tooling for numerous different purposes, such as client code generation, documentation generation, server side routing, and API testing. OpenAPI description authors must consider the risks of the scenarios where the OpenAPI description may be used.
3832
+
In addition, OpenAPI Descriptions are processed by a wide variety of tooling for numerous different purposes, such as client code generation, documentation generation, server side routing, and API testing. OpenAPI Description authors must consider the risks of the scenarios where the OpenAPI Description may be used.
3836
3833
3837
3834
### Security Schemes
3838
3835
3839
-
An OpenAPI description describes the security schemes used to protect the resources it defines. The security schemes available offer varying degrees of protection. Factors such as the sensitivity of the data and the potential impact of a security breach should guide the selection of security schemes for the API resources. Some security schemes, such as basic auth and OAuth Implicit flow, are supported for compatibility with existing APIs. However, their inclusion in OpenAPI does not constitute an endorsement of their use, particularly for highly sensitive data or operations.
3836
+
An OpenAPI Description describes the security schemes used to protect the resources it defines. The security schemes available offer varying degrees of protection. Factors such as the sensitivity of the data and the potential impact of a security breach should guide the selection of security schemes for the API resources. Some security schemes, such as basic auth and OAuth Implicit flow, are supported for compatibility with existing APIs. However, their inclusion in OpenAPI does not constitute an endorsement of their use, particularly for highly sensitive data or operations.
3840
3837
3841
3838
### Handling External Resources
3842
3839
3843
-
OpenAPI description documents may contain references to external resources that may be dereferenced automatically by consuming tools. External resources may be hosted on different domains that may be untrusted. References in an OpenAPI document, or across OpenAPI documents within a multi-document OpenAPI description, may cause a cycle. Tooling must detect and handle cycles to prevent resource exhaustion.
3840
+
OpenAPI Descriptions may contain references to external resources that may be dereferenced automatically by consuming tools. External resources may be hosted on different domains that may be untrusted.
3841
+
3842
+
### Handling Reference Cycles
3843
+
3844
+
References in an OpenAPI Description may cause a cycle. Tooling must detect and handle cycles to prevent resource exhaustion.
0 commit comments