Skip to content

Fixed the webhook example #2434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions examples/v3.1/webhook-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,6 @@
"title": "Webhook Example",
"version": "1.0.0"
},
"paths": {
"/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": {
"newPet": {
"post": {
Expand Down Expand Up @@ -76,12 +44,6 @@
"type": "string"
}
}
},
"Pets": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Pet"
}
}
}
}
Expand Down
28 changes: 1 addition & 27 deletions examples/v3.1/webhook-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,7 @@ openapi: 3.1.0
info:
title: Webhook Example
version: 1.0.0
paths:
# OpenAPI documents 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"

# Since OAS 3.1.0 the paths element isn't necessary. Now a valid OpenAPI Document can describe only paths, webhooks, or even only reusable components
webhooks:
# Each webhook needs a name
newPet:
Expand Down Expand Up @@ -53,9 +32,4 @@ components:
type: string
tag:
type: string
Pets:
type: array
items:
$ref: "#/components/schemas/Pet"