Skip to content
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

Add Callbacks, Links and Webhooks pages #90

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ _site/
*.swp
.jekyll-metadata
.ruby-version
.vscode
70 changes: 59 additions & 11 deletions examples/tictactoe.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ paths:
schema:
$ref: "#/components/schemas/status"
security:
apiKey: []
app2AppOauth:
- board:read
- defaultApiKey: []
- app2AppOauth:
- board:read

# Single square operations
/board/{row}/{column}:
Expand All @@ -46,6 +46,13 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/mark"
links:
markSquare:
description: Operation to use if the mark value returned indicates the square is empty
operationId: put-square
parameters:
row: $request.path.row
column: $request.path.column
"400":
description: The provided parameters are incorrect
content:
Expand All @@ -54,15 +61,22 @@ paths:
$ref: "#/components/schemas/errorMessage"
example: "Illegal coordinates"
security:
bearerHttpAuthentication: []
user2AppOauth:
- board:read
- bearerHttpAuthentication: []
- user2AppOauth:
- board:read
put:
summary: Set a single board square
description: Places a mark on the board and retrieves the whole board and the winner (if any).
tags:
- Gameplay
operationId: put-square
parameters:
- name: progressUrl
in: header
description: Progress URL that should be called if asynchronous response is returned
required: false
schema:
type: string
requestBody:
required: true
content:
Expand All @@ -76,6 +90,13 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/status"
"202":
description: Mark operation has not completed. Use callback to check for progress
headers:
Location:
description: Callback URL
schema:
type: string
"400":
description: The provided parameters are incorrect
content:
Expand All @@ -90,10 +111,24 @@ paths:
invalidMark:
value: "Invalid Mark (X or O)."
security:
bearerHttpAuthentication: []
user2AppOauth:
- board:write

- bearerHttpAuthentication: []
- user2AppOauth:
- board:write
callbacks:
statusCallback:
'{$request.header.progressUrl}':
post:
summary: Status of mark operation
description: Provides the status of the mark operation
operationId: markOperationCallback
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/status"
responses:
"200":
description: Mark operation status received
components:
parameters:
rowParam:
Expand Down Expand Up @@ -179,4 +214,17 @@ components:
scopes:
# Reads and writes permitted via authorization code flow
board:read: Read the board
board:write: Write to the board
board:write: Write to the board
webhooks:
markStatus:
post:
summary: Status of mark operation
description: Provides the status of the mark operation on completion
operationId: markOperationWebhook
responses:
"200":
description: Mark operation has completed successfully
content:
application/json:
schema:
$ref: "#/components/schemas/status"
77 changes: 77 additions & 0 deletions img/callback-object.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
digraph componentsObject {
node [shape = none; fontname = monospace; tooltip = "Click to jump to the specification of this object";];
rankdir = LR;
bgcolor = white;

openapiObject [URL = "https://spec.openapis.org/oas/v3.1.0#oasObject";target = "_blank";label = <<table border="0" cellspacing="0">
<tr><td border="1" bgcolor="#94d60a"><font face="arial"><b>OpenAPI Object</b></font></td></tr>
<tr><td border="1" bgcolor="#6ca437">openapi</td></tr>
<tr><td border="1" bgcolor="#6ca437">info</td></tr>
<tr><td border="1" bgcolor="#6ca437" port="components">components</td></tr>
<tr><td border="1" bgcolor="#6ca437" port="security">security</td></tr>
<tr><td border="1" bgcolor="#6ca437" port="paths">paths</td></tr>
<tr><td border="1" bgcolor="#6ca437">…</td></tr></table>>;];

componentsObject [URL = "https://spec.openapis.org/oas/v3.1.0#componentsObject";target = "_blank";label = <<table border="0" cellspacing="0">
<tr><td border="1" bgcolor="#94d60a" port="header"><font face="arial"><b>Components Object</b></font></td></tr>
<tr><td border="1" bgcolor="#6ca437" port="callbacks">callbacks</td></tr>
<tr><td border="1" bgcolor="#6ca437">…</td></tr></table>>;];

pathsObject [URL = "https://spec.openapis.org/oas/v3.1.0#pathsObject";target = "_blank";label = <<table border="0" cellspacing="0">
<tr><td border="1" bgcolor="#939598" port="header"><font face="arial"><b>Paths Object</b></font></td></tr>
<tr><td border="1" bgcolor="#6d6e71" port="endpoint1">/endpoint1</td></tr>
<tr><td border="1" bgcolor="#6d6e71" port="endpoint2">/endpoint2</td></tr>
<tr><td border="1" bgcolor="#6d6e71" port="endpoint3">/endpoint3</td></tr>
<tr><td border="1" bgcolor="#6d6e71">…</td></tr></table>>;];

pathItemObject [URL = "https://spec.openapis.org/oas/v3.1.0#pathItemObject";target = "_blank";label = <<table border="0" cellspacing="0">
<tr><td border="1" bgcolor="#939598" port="header"><font face="arial"><b>Path Item Object</b></font></td></tr>
<tr><td border="1" bgcolor="#6d6e71" port="delete">delete</td></tr>
<tr><td border="1" bgcolor="#6d6e71" port="get">get</td></tr>
<tr><td border="1" bgcolor="#6d6e71" port="patch">patch</td></tr>
<tr><td border="1" bgcolor="#6d6e71" port="post">post</td></tr>
<tr><td border="1" bgcolor="#6d6e71" port="put">put</td></tr>
<tr><td border="1" bgcolor="#6d6e71">…</td></tr></table>>;];

operationObject [URL = "https://spec.openapis.org/oas/v3.1.0#operationObject";target = "_blank";label = <<table border="0" cellspacing="0">
<tr><td border="1" bgcolor="#94d60a" port="header"><font face="arial"><b>Operation Object</b></font></td></tr>
<tr><td border="1" bgcolor="#6ca437" port="callbacks">callbacks</td></tr>
<tr><td border="1" bgcolor="#6ca437">…</td></tr></table>>;];


callbackPathItemObject [URL = "https://spec.openapis.org/oas/v3.1.0#pathItemObject";target = "_blank";label = <<table border="0" cellspacing="0">
<tr><td border="1" bgcolor="#94d60a" port="header"><font face="arial"><b>Path Item Object</b></font></td></tr>
<tr><td border="1" bgcolor="#6ca437" port="delete">delete</td></tr>
<tr><td border="1" bgcolor="#6ca437" port="get">get</td></tr>
<tr><td border="1" bgcolor="#6ca437" port="patch">patch</td></tr>
<tr><td border="1" bgcolor="#6ca437" port="post">post</td></tr>
<tr><td border="1" bgcolor="#6ca437" port="put">put</td></tr>
<tr><td border="1" bgcolor="#6ca437">…</td></tr></table>>;];


callbackObject [URL = "https://spec.openapis.org/oas/v3.1.0#callbackObject";target = "_blank";label = <<table border="0" cellspacing="0">
<tr><td border="1" bgcolor="#94d60a" port="header"><font face="arial"><b>Callback Object</b></font></td></tr>
<tr><td border="1" bgcolor="#6ca437" port="expression">{expression}</td></tr>
<tr><td border="1" bgcolor="#6ca437">…</td></tr></table>>;];

openapiObject:components -> componentsObject:header;

componentsObject:callbacks -> callbackObject:header;

openapiObject:paths -> pathsObject:header;

pathsObject:endpoint1 -> pathItemObject:header;
pathsObject:endpoint2 -> pathItemObject:header;
pathsObject:endpoint3 -> pathItemObject:header;

pathItemObject:delete -> operationObject:header;
pathItemObject:get -> operationObject:header;
pathItemObject:patch -> operationObject:header;
pathItemObject:post -> operationObject:header;
pathItemObject:put -> operationObject:header;

operationObject:callbacks -> callbackObject:header;


callbackObject:expression -> callbackPathItemObject:header;
}
Loading