Skip to content

Commit b667bcf

Browse files
authored
Merge pull request OAI#1206 from OAI/issue-1104
Added callback examples
2 parents fdce77f + 406e63a commit b667bcf

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

examples/v3.0/callback-example.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
paths:
2+
/streams:
3+
post:
4+
description: subscribes a client to receive out-of-band data
5+
parameters:
6+
- name: callbackUrl
7+
in: query
8+
required: true
9+
description: |
10+
the ___location where data will be sent. Must be network accessible
11+
by the source server
12+
schema:
13+
type: string
14+
format: uri
15+
example: https://tonys-server.com
16+
responses:
17+
'201':
18+
description: subscription successfully created
19+
content:
20+
application/json:
21+
schema:
22+
description: subscription information
23+
required:
24+
- subscriptionId
25+
properties:
26+
subscriptionId:
27+
description: this unique identifier allows management of the subscription
28+
type: string
29+
example: 2531329f-fb09-4ef7-887e-84e648214436
30+
callbacks:
31+
# the name `onData` is a convenience locator
32+
onData:
33+
# when data is sent, it will be sent to the `callbackUrl` provided
34+
# when making the subscription PLUS the suffix `/data`
35+
$request.query.callbackUrl/data:
36+
post:
37+
requestBody:
38+
description: subscription payload
39+
content:
40+
application/json:
41+
schema:
42+
properties:
43+
timestamp:
44+
type: string
45+
format: date-time
46+
userData:
47+
$ref: '#/components/schemas/UserLogData'
48+
responses:
49+
'202':
50+
description: |
51+
Your server implementation should return this HTTP status code
52+
if the data was received successfully
53+
'204':
54+
description: |
55+
Your server should return this HTTP status code if no longer interested
56+
in further updates

versions/3.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1751,7 +1751,7 @@ The key value used to identify the callback object is an expression, evaluated a
17511751
##### Patterned Fields
17521752
Field Pattern | Type | Description
17531753
---|:---:|---
1754-
<a name="callbackExpression"></a>{expression} | [Path Item Object](#pathItemObject) | A Path Item Object used to define a callback request and expected responses.
1754+
<a name="callbackExpression"></a>{expression} | [Path Item Object](#pathItemObject) | A Path Item Object used to define a callback request and expected responses. A full example may be found at https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/examples/v3.0/callback-example.yaml
17551755

17561756
This object can be extended with [Specification Extensions](#specificationExtensions).
17571757

0 commit comments

Comments
 (0)