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
Add support for webhooks as a top-level element (OAI#2103)
* Add webhooks as a top-level element to the spec
* Add the changes from OAI#2048 and signpost webhooks
* Add an example of webhooks
* Relocate and expand on webhooks section following feedback
* Better wording to describe expectations on API consumers
* Clearer wording for why the paths element is here
* Update language to make callbacks clearer
Copy file name to clipboardExpand all lines: versions/3.1.0.md
+26-6
Original file line number
Diff line number
Diff line change
@@ -193,11 +193,13 @@ Field Name | Type | Description
193
193
<aname="oasInfo"></a>info | [Info Object](#infoObject) | **REQUIRED**. Provides metadata about the API. The metadata MAY be used by tooling as required.
194
194
<aname="oasServers"></a>servers | [[Server Object](#serverObject)] | An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of `/`.
195
195
<aname="oasPaths"></a>paths | [Paths Object](#pathsObject) | **REQUIRED**. The available paths and operations for the API.
196
+
<aname="oasWebhooks"></a>webhooks | Map[`string`, [Path Item Object](#pathItemObject)] | The incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. Closely related to the `callbacks` feature, this section describes requests initiated other than by an API call, for example by an out of band registration. The key name is a unique string to refer to each webhook, while the Path Item Object describes a request that may be initiated by the API provider and the expected responses. An [example](../examples/v3.1/webhook-example.yaml) is available.
196
197
<aname="oasComponents"></a>components | [Components Object](#componentsObject) | An element to hold various schemas for the specification.
197
198
<aname="oasSecurity"></a>security | [[Security Requirement Object](#securityRequirementObject)] | A declaration of which security mechanisms can be used across the API. 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. Individual operations can override this definition.
198
199
<aname="oasTags"></a>tags | [[Tag Object](#tagObject)] | A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique.
This object MAY be extended with [Specification Extensions](#specificationExtensions).
202
204
203
205
#### <aname="infoObject"></a>Info Object
@@ -1844,6 +1846,8 @@ A map of possible out-of band callbacks related to the parent operation.
1844
1846
Each value in the map is a [Path Item Object](#pathItemObject) that describes a set of requests that may be initiated by the API provider and the expected responses.
1845
1847
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.
1846
1848
1849
+
To describe incoming requests from the API provider independent from another API call, use the [`webhooks`](#oasWebhooks) field.
The following example shows a callback to the URL specified by the `id` and `email` property in the request body.
1902
+
The following example uses the user provided `queryUrl` query string parameter to define the callback URL. This is an example of how to use a callback object to describe a callback that goes with the subscription operation to enable registering for the callback.
description: webhook successfully processed and no retries will be performed
1916
+
description: callback successfully processed
1913
1917
```
1914
1918
1919
+
The following example shows a callback where the server is hard-coded, but the query string parameters are populated from the `id` and `email` property in the request body.
0 commit comments