-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(types): generate types for callbacks
It implied a lot of refactoring. Despite this, I think I could manage to get it backward compatible. Anyway, I'll test and patch it if not before bumping a new version. It will be a major version though to avoid any risk. BREAKING CHANGE: May change some types names #39
- Loading branch information
Showing
6 changed files
with
4,626 additions
and
2,945 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
{ | ||
"openapi": "3.0.0", | ||
"info": { | ||
"title": "Callback Example", | ||
"version": "1.0.0" | ||
}, | ||
"paths": { | ||
"/streams": { | ||
"post": { | ||
"description": "subscribes a client to receive out-of-band data", | ||
"parameters": [ | ||
{ | ||
"name": "callbackUrl", | ||
"in": "query", | ||
"required": true, | ||
"description": "the location where data will be sent. Must be network accessible\nby the source server\n", | ||
"schema": { | ||
"type": "string", | ||
"format": "uri", | ||
"example": "https://tonys-server.com" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"201": { | ||
"description": "subscription successfully created", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"description": "subscription information", | ||
"required": ["subscriptionId"], | ||
"properties": { | ||
"subscriptionId": { | ||
"description": "this unique identifier allows management of the subscription", | ||
"type": "string", | ||
"example": "2531329f-fb09-4ef7-887e-84e648214436" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"callbacks": { | ||
"StreamValidated": { | ||
"$ref": "#/components/callbacks/OnValidated" | ||
}, | ||
"onData": { | ||
"{$request.query.callbackUrl}/data": { | ||
"post": { | ||
"requestBody": { | ||
"description": "subscription payload", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "object", | ||
"properties": { | ||
"timestamp": { | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"userData": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"202": { | ||
"description": "Your server implementation should return this HTTP status code\nif the data was received successfully\n" | ||
}, | ||
"204": { | ||
"description": "Your server should return this HTTP status code if no longer interested\nin further updates\n" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"callbacks": { | ||
"OnValidatedClone": { | ||
"$ref": "#/components/callbacks/OnValidated" | ||
}, | ||
"OnValidated": { | ||
"{$request.query.queryUrl}": { | ||
"put": { | ||
"responses": { | ||
"201": { | ||
"description": "Ok, validated!" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"openapi": "3.1.0", | ||
"info": { | ||
"version": "1.0.0", | ||
"title": "Parameters" | ||
}, | ||
"paths": { | ||
"/delay": { | ||
"parameters": [ | ||
{ | ||
"$ref": "#/components/parameters/durationUnit" | ||
} | ||
], | ||
"get": { | ||
"operationId": "getDelay", | ||
"parameters": [ | ||
{ | ||
"$ref": "#/components/parameters/durationTime" | ||
} | ||
], | ||
"responses": { | ||
"204": { | ||
"description": "Delay expired" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"parameters": { | ||
"durationUnit": { | ||
"in": "query", | ||
"name": "unit", | ||
"required": true, | ||
"schema": { | ||
"type": "string", | ||
"enum": ["s", "m", "h"] | ||
} | ||
}, | ||
"durationTime": { | ||
"in": "query", | ||
"name": "duration", | ||
"required": true, | ||
"description": "Duration in milliseconds", | ||
"schema": { | ||
"type": "number" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.