Skip to content

Commit

Permalink
Add an example of webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
lornajane committed Jan 15, 2020
1 parent ca5a8af commit 7ba4b08
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
61 changes: 61 additions & 0 deletions examples/v3.1/webhook-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
openapi: 3.1.0
info:
title: Webhook Example
version: 1.0.0
paths:
# OpenAPI specs all need a paths element
/pets:
get:
summary: List all pets
operationId: listPets
parameters:
- name: limit
in: query
description: How many items to return at one time (max 100)
required: false
schema:
type: integer
format: int32
responses:
'200':
description: A paged array of pets
content:
application/json:
schema:
$ref: "#/components/schemas/Pets"

webhooks:
# Each webhook needs a name
newPet:
# This is a Path Item Object, the only difference is that the request is initiated by the API provider
post:
requestBody:
description: Information about a new pet in the system
content:
application/json:
schema:
$ref: "#/components/schemas/Pet"
responses:
200:
description: Return a 200 status to indicate that the data was received successfully

components:
schemas:
Pet:
required:
- id
- name
properties:
id:
type: integer
format: int64
name:
type: string
tag:
type: string
Pets:
type: array
items:
$ref: "#/components/schemas/Pet"


3 changes: 2 additions & 1 deletion versions/3.1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ Field Name | Type | Description
<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.
<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.
<a name="oasExternalDocs"></a>externalDocs | [External Documentation Object](#externalDocumentationObject) | Additional external documentation.
<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.
<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.


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

Expand Down

0 comments on commit 7ba4b08

Please sign in to comment.