Skip to content

Commit 7ba4b08

Browse files
committed
Add an example of webhooks
1 parent ca5a8af commit 7ba4b08

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

examples/v3.1/webhook-example.yaml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
openapi: 3.1.0
2+
info:
3+
title: Webhook Example
4+
version: 1.0.0
5+
paths:
6+
# OpenAPI specs all need a paths element
7+
/pets:
8+
get:
9+
summary: List all pets
10+
operationId: listPets
11+
parameters:
12+
- name: limit
13+
in: query
14+
description: How many items to return at one time (max 100)
15+
required: false
16+
schema:
17+
type: integer
18+
format: int32
19+
responses:
20+
'200':
21+
description: A paged array of pets
22+
content:
23+
application/json:
24+
schema:
25+
$ref: "#/components/schemas/Pets"
26+
27+
webhooks:
28+
# Each webhook needs a name
29+
newPet:
30+
# This is a Path Item Object, the only difference is that the request is initiated by the API provider
31+
post:
32+
requestBody:
33+
description: Information about a new pet in the system
34+
content:
35+
application/json:
36+
schema:
37+
$ref: "#/components/schemas/Pet"
38+
responses:
39+
200:
40+
description: Return a 200 status to indicate that the data was received successfully
41+
42+
components:
43+
schemas:
44+
Pet:
45+
required:
46+
- id
47+
- name
48+
properties:
49+
id:
50+
type: integer
51+
format: int64
52+
name:
53+
type: string
54+
tag:
55+
type: string
56+
Pets:
57+
type: array
58+
items:
59+
$ref: "#/components/schemas/Pet"
60+
61+

versions/3.1.0.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ Field Name | Type | Description
197197
<a name="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.
198198
<a name="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.
199199
<a name="oasExternalDocs"></a>externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation.
200-
<a name="oasWebhooks"></a>webhooks | Map[`string`, [Path Item Object](#pathItemObject)] | The incoming webhooks that may be received as part of this API. 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.
200+
<a name="oasWebhooks"></a>webhooks | Map[`string`, [Path Item Object](#pathItemObject)] | The incoming webhooks that may be received as part of this API. 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.
201+
201202

202203
This object MAY be extended with [Specification Extensions](#specificationExtensions).
203204

0 commit comments

Comments
 (0)