Skip to content

Commit

Permalink
fix: update openapi spec to specify optional expiry argument availa…
Browse files Browse the repository at this point in the history
…ble to be passed in via request body.

Also updated test runner to ignore any request bodies in spec that are explicitly not required.
  • Loading branch information
julianlam committed May 1, 2023
1 parent 2b70063 commit b3787bd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
11 changes: 11 additions & 0 deletions public/openapi/write/topics/tid/pin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ put:
required: true
description: a valid topic id
example: 1
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
expiry:
type: number
description: A UNIX timestamp representing the moment the topic will be unpinned.
example: 1585337827953
responses:
'200':
description: Topic successfully pinned
Expand Down
5 changes: 4 additions & 1 deletion test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,10 @@ describe('API', async () => {

let body = {};
let type = 'json';
if (context[method].hasOwnProperty('requestBody') && context[method].requestBody.content['application/json']) {
if (
context[method].hasOwnProperty('requestBody') &&
context[method].requestBody.required !== false &&
context[method].requestBody.content['application/json']) {
body = buildBody(context[method].requestBody.content['application/json'].schema.properties);
} else if (context[method].hasOwnProperty('requestBody') && context[method].requestBody.content['multipart/form-data']) {
type = 'form';
Expand Down

0 comments on commit b3787bd

Please sign in to comment.