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.md
+63-99Lines changed: 63 additions & 99 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1808,7 +1808,7 @@ This object can be extended with [Specification Extensions](#specificationExtens
1808
1808
1809
1809
The key used to identify the [Path Item Object](#pathItemObject) is a variable expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request.
1810
1810
A simple example might be `$request.body#/url`.
1811
-
However, using [variable substitution](#variableSubstitution) syntax the complete HTTP message can be accessed.
1811
+
However, using a [variable substitution](#runtimeExpression) syntax the complete HTTP message can be accessed.
1812
1812
This includes accessing any part of a body that can be accessed using a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901).
1813
1813
1814
1814
For example, given the following HTTP request:
@@ -1830,7 +1830,6 @@ Content-Length: 123
1830
1830
1831
1831
201 Created
1832
1832
Location: http://example.org/subscription/1
1833
-
1834
1833
```
1835
1834
1836
1835
Here are the examples of how the various expressions evaluate, assuming a the callback operation has a path parameter named `eventType` and a query parameter named `queryUrl`.
The links object represents a set of possible design-time links for a response.
2001
2001
The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.
2002
2002
2003
-
As opposed to _dynamic_ links (links provided **in** the response payload), the OAS linking mechanism does not require that link information be provided in a specific response format at runtime.
2003
+
As opposed to _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require that link information be provided in a specific response format at runtime.
2004
2004
2005
-
For computing links, and providing instructions to execute them, [variable substitution](#variableSubstitution) is used for accessing values in a response and using them as values while invoking the linked operation.
2005
+
For computing links, and providing instructions to execute them, a [runtime expression](#runtimeExpression) is used for accessing values in a response and using them as parameters while invoking the linked operation.
2006
2006
2007
2007
##### Patterned Fields
2008
2008
Field Pattern | Type | Description
@@ -2019,7 +2019,6 @@ Field Name | Type | Description
2019
2019
<a name="linkOperationRef"></a>operationRef | `string` | a relative or absolute reference to an OAS operation. This field is mutually exclusive with the `operationId` field, and must point to the fragment of a valid OAS definition.
2020
2020
<a name="linkOperationId"></a>operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `operationRef` field. Relative `operationRef` values MAY be used to locate an existing [Operation Object](#operationObject) in the OAS.
2021
2021
<a name="linkParameters"></a>parameters | [Link Parameters Object](#linkParametersObject) | an object representing parameters to pass to an operation as specified with `operationId` or identified via `operationRef`.
2022
-
<a name="linkHeaders"></a>headers | [Headers Object](#headersObject) | an object representing headers to pass to the linked resource. Where conflicts occur between these headers, and those defined in the related operation, these headers override.
2023
2022
<a name="linkDescription"></a>description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/).
2024
2023
<a name="linkServer"></a>server | [Server Object](#serverObject) | a server object to be used by the target operation.
2025
2024
@@ -2030,88 +2029,6 @@ In the case of an `operationId`, it MUST be unique and resolved in the scope of
2030
2029
Because of the potential for name clashes, consider the `operationRef` syntax as the preferred
2031
2030
method for specifications with external references.
In all cases, _variables_ from request and responses may be substituted for link generation.
2082
-
The table below provides examples of variable expressions and examples of their use in a value:
2083
-
2084
-
Source Location | variable expression | example reference | notes
2085
-
---|:---|:---|:---
2086
-
HTTP Method | `$method` | `/users/{$method}` | The allowable values for the `$method` will be those for the HTTP operation
2087
-
Requested content type | `$request.header.accept` | `/users/3?format={$request.header.accept}` |
2088
-
Request parameter | `$request.path.id` | `/users/{$request.path.id}` | Request parameters MUST be declared in the `parameters` section for the operation or they cannot be used in substitution. This includes request headers
2089
-
Request body | `$request.body` | `/users/{$request.body#/user/uuid}` | For operations which accept payloads, references may be made to portions of the `requestBody` or the entire body itself
2090
-
Request URL | `$url` | `/track?url={$url}` |
2091
-
Response value | `$response.body` | `{$response.body#/uuid}` | Only the payload in the response can be accessed with the `$response` syntax.
2092
-
Response header | `$response.header` | `{$response.header.Server}` | Single header values only are available
2093
-
2094
-
From the request, the `parameter`s used in calling the operation are made available through the `$request` syntax.
2095
-
For responses, the response payload may be used with the `$response` syntax.
2096
-
For both requests and responses, values will be substituted in the link in sections designated with a variable expression, surrounded by curly brackets `{}`.
2097
-
2098
-
The variable expression is defined by the following [ABNF](https://tools.ietf.org/html/rfc5234) syntax
Using the `operationId` to reference an operation in the definition has many benefits, including the ability to define media type options, security requirements, response and error payloads.
2415
2333
Many operations require parameters to be passed, and these MAY be dynamic depending on the response itself.
2416
2334
2417
2335
To specify parameters required by the operation, we can use a **Link Parameters Object**.
@@ -2420,7 +2338,10 @@ This object contains parameter names along with static or dynamic values:
2420
2338
##### Patterned Fields
2421
2339
Field Pattern | Type | Description
2422
2340
---|:---:|---
2423
-
<a name="linkParameterName"></a> {name} | Any \| [{expression}](#variableSubstitution) | A constant value or expression to be evaluated and passed to the linked operation.
2341
+
<a name="linkParameterName"></a> {name} | Any \| [{runtime expression}](#runtimeExpression) | A constant value or expression to be evaluated and passed to the linked operation.
2342
+
2343
+
When a runtime expression evaluates to null, no parameter value is passed to the target operation.
2344
+
2424
2345
2425
2346
```yaml
2426
2347
paths:
@@ -2449,6 +2370,49 @@ components:
2449
2370
2450
2371
In the above, the link for `UserCommitHistory` points to the operation `getUserCommitHistory`, and passes the `username` value from the response payload as well as the static scalar value `0`.
Runtime expressions allow defining values based on information that will only available within the HTTP message in an actual API call. This mechanism is used by [Link Parameters Objects](#linkParmeterObject) and [Callback Objects](#callbackObject).
2376
+
2377
+
The runtime expression is defined by the following [ABNF](https://tools.ietf.org/html/rfc5234) syntax
HTTP Method | `$method` | The allowable values for the `$method` will be those for the HTTP operation
2401
+
Requested media type | `$request.header.accept` |
2402
+
Request parameter | `$request.path.id` | Request parameters MUST be declared in the `parameters` section for the parent operation or they cannot be evaluated. This includes request headers.
2403
+
Request body property | `$request.body#/user/uuid` | For operations which accept payloads, references may be made to portions of the `requestBody` or the entire body itself
2404
+
Request URL | `$url` |
2405
+
Response value | `$response.body#/status` | Only the payload in the response can be accessed with the `$response` syntax.
2406
+
Response header | `$response.header.Server` | Single header values only are available
2407
+
2408
+
Runtime expressions preserve the type of the referenced value.
2409
+
Expression values can be embeded into string values by surrounding the expression with `{}` curly braces.
2410
+
2411
+
`$request.body`and `$response.body`expressions are only available in payloads which that can be accessed using a JSON Pointer.
2412
+
If a value does _not_ exist, the result of the expression will be considered a `null` value (as opposed to an empty value).
2413
+
2414
+
2415
+
2452
2416
#### <a name="headerObject"></a>Header Object
2453
2417
2454
2418
The Header Object follows the structure of the [Parameter Object](#parameterObject), with the following changes:
0 commit comments