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
@@ -589,7 +589,7 @@ Field Name | Type | Description
589
589
<a name="operationParameters"></a>parameters | [[Parameter Object](#parameterObject) <span>|</span> [Reference Object](#referenceObject)] | A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](#pathItemParameters), the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). The list can use the [Reference Object](#referenceObject) to link to parameters that are defined at the [OpenAPI Object's parameters](#oasParameters).
590
590
<a name="operationRequestBody"></a>requestBody | [[Request Body Object](#requestBodyObject) <span>|</span> [Reference Object](#referenceObject)] | The request body applicable for this operation. The `requestBody` is only supported in HTTP methods where the [HTTP 1.1 specification](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, `requestBody` shall be ignored by consumers.
591
591
<a name="operationResponses"></a>responses | [Responses Object](#responsesObject) | **Required.** The list of possible responses as they are returned from executing this operation.
592
-
<a name="operationCallbacks"></a>callback responses | [Callback Responses Object](#callbackObject) | The list of possible callback responses as they are returned from executing this operation.
592
+
<a name="operationCallbacks"></a>callbacks | [Callbacks Object](#callbacksObject) | The list of possible callbacks as they are returned from executing this operation.
593
593
<a name="operationDeprecated"></a>deprecated | `boolean` | Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is `false`.
594
594
<a name="operationSecurity"></a>security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. This definition overrides any declared top-level [`security`](#oasSecurity). To remove a top-level security declaration, an empty array can be used.
595
595
<a name="operationItemServer"></a>servers | [Server Object](#serverObject) | An alternative `server` array to service this operation. If an alternative `server` object is specified at the Path Item Object or Root level, it will be overridden by this value.
@@ -1493,17 +1493,62 @@ Response with no return value:
A container for possible out-of band callbacks from an operation. A callback may be returned from an operation, calling back to the path specified in the operation object.
1498
+
A map of possible out-of band callbacks related to the parent operation.
1499
+
Each value in the map is an [Operation Object](#operationObject) that describes a request that may be initiated by the API provider and the expected responses.
1500
+
The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
1499
1501
1500
1502
##### Patterned Fields
1501
1503
Field Pattern | Type | Description
1502
1504
---|:---:|---
1503
-
<a name="responseName"></a>Callback name | [Callback Operation Object](#operationObject) <span>|</span> [Operation Object](#operationObject) | An operation object used to define a callback payload structure
1505
+
<a name="callbackName"></a>Callback name | [Callback Operation Object](#operationObject) <span>|</span> [Operation Object](#operationObject) | An Operation Object used to define a callback request and expected responses
1504
1506
1505
1507
This object can be extended with [Specification Extensions](#specificationExtensions).
1506
1508
1509
+
##### Key Expression
1510
+
1511
+
The key used to identify the callback object 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.
1512
+
A simple example might be `$request.body#/url`.
1513
+
However, using [variable substition](#variableSubstition) syntax the complete HTTP message can be accessed.
1514
+
This includes accessing any part of a body that can be accessed using a JSON Pointer [RFC6901](https://tools.ietf.org/html/rfc6901).
1515
+
1516
+
1517
+
For example, given the following HTTP request:
1518
+
1519
+
```http
1520
+
POST /subscribe/myevent?queryUrl=http://clientdomain.com/stillrunning HTTP/1.1
1521
+
Host: example.org
1522
+
Content-Type: application/json
1523
+
Content-Length: 123
1524
+
1525
+
{
1526
+
"failedUrl" : "http://clientdomain.com/failed"
1527
+
"successUrls : [
1528
+
"http://clientdomain.com/fast",
1529
+
"http://clientdomain.com/medium",
1530
+
"http://clientdomain.com/slow"
1531
+
]
1532
+
}
1533
+
1534
+
201 Created
1535
+
Location: http://example.org/subscription/1
1536
+
1537
+
```
1538
+
1539
+
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`.
@@ -1512,12 +1557,14 @@ A callback to the URL specified by the `url` parameter in the request
1512
1557
1513
1558
```yaml
1514
1559
myWebhook:
1515
-
'$request.url':
1560
+
'$request.body#/url':
1516
1561
post:
1517
-
body:
1518
-
name: postResponse
1519
-
schema:
1520
-
$ref: '#/definitions/SomePayload'
1562
+
requestBody:
1563
+
description: Callback payload
1564
+
content:
1565
+
'application/json'
1566
+
schema:
1567
+
$ref: '#/components/definitions/SomePayload'
1521
1568
responses:
1522
1569
200:
1523
1570
description: webhook successfully processed an no retries will be performed
@@ -1631,11 +1678,11 @@ The `Link Object` is responsible for defining a possible operation based on a si
1631
1678
1632
1679
Field Name | Type | Description
1633
1680
---|:---:|---
1634
-
href | url | a relative or absolute URL to a linked resource. This field is mutually exclusive with the `operationId` field.
1635
-
operationId | string | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values _may_ be used to locate an existing Operation Object in the OAS.
1636
-
parameters | Link Parameters Object | an Object representing parameters to pass to an operation as specified with `operationId` or identified via `href`.
1637
-
headers | Link Headers Object | an Object representing headers to pass to the linked resource.
1638
-
description | string | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/).
1681
+
href | `string` | a relative or absolute URL to a linked resource. This field is mutually exclusive with the `operationId` field.
1682
+
operationId | `string` | the name of an _existing_, resolvable OAS operation, as defined with a unique `operationId`. This field is mutually exclusive with the `href` field. Relative `href` values _may_ be used to locate an existing Operation Object in the OAS.
1683
+
parameters | [Link Parameters Object](#linkParameters) | an Object representing parameters to pass to an operation as specified with `operationId` or identified via `href`.
1684
+
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.
1685
+
description | `string` | a description of the link, supports [CommonMark syntax](http://spec.commonmark.org/).
1639
1686
1640
1687
This object can be extended with [Specification Extensions](#specificationExtensions).
1641
1688
@@ -1645,7 +1692,7 @@ Because of the potential for name clashes, consider the `href` syntax as the pre
Payload values are only available in parseable response payloads which match the advertised media-type.
1695
+
Payload values are only available in parseable response payloads which match the advertised media-type and for media-types that can be referenced using a JSON Pointer fragment Id.
1649
1696
In all cases, if a value does _not_ exist, the parameter will be considered a `null` value (as opposed to an empty value) and _not_ passed as a parameter to the linked resource.
1650
1697
In cases where a value is required, and a parameter is not supplied, the client _may_ choose to not follow the link definition.
In all cases, _variables_ from request and responses may be substituted for link generation.
1693
-
The table below designates the source of the substitution value and the syntax for accessing it:
1740
+
The table below provides examples of variable expressions and examples of their use in a value:
1694
1741
1695
-
Source Location | reference identifier | example value | example reference | notes
1696
-
---|:---|:---|:---|:---
1742
+
Source Location | variable expression | example reference | notes
1743
+
---|:---|:---|:---
1697
1744
HTTP Method | `$method` | `/users/{$method}` | The allowable values for the `$method` will be those for the HTTP operation
1698
-
Requested content type | `$accepts` | `/users/3?format={$accepts}` |
1699
-
Request parameter | `$request` | `/users/{$request.id}` | Request parameters must be declared in the `parameters` section for the operation or they cannot be used in substitution. This includes request headers
1700
-
Request body | `$requestBody` | `/users/{$requestBody.user.uuid}` | For operations which accept payloads, references may be made to portions of the `requestBody` or the entire body itself
1745
+
Requested content type | `$request.header.accept` | `/users/3?format={$request.header.accept}` |
1746
+
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
1747
+
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
1701
1748
Request URL | `$url` | `/track?url={$url}` |
1702
-
Response value | `$response` | `{$response.uuid}` | Only the payload in the response can be accessed with the `$response` syntax
1703
-
Response header | `$responseHeader` | `{$responseHeader.Server}` | Single header values only are available.
1749
+
Response value | `$response.body` | `{$response.body#/uuid}` | Only the payload in the response can be accessed with the `$response` syntax.
1750
+
Response header | `$response.header` | `{$response.header.Server}` | Single header values only are available
1704
1751
1705
1752
From the request, the `parameter`s used in calling the operation are made available through the `$request` syntax.
1706
1753
For responses, the response payload may be used with the `$response` syntax.
1707
-
For both requests and responses, values will be substituted in the link in sections designated with the `$request` or `$response` keyword, surrounded by curly brackets `{}`.
1754
+
For both requests and responses, values will be substituted in the link in sections designated with a variable expression, surrounded by curly brackets `{}`.
1755
+
1756
+
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.
1996
2061
Many operations require parameters to be passed, and these may be dynamic depending on the response itself.
0 commit comments