Skip to content

Node.js based forum software built for the modern web

fix: update openapi spec to specify optional `expiry` argument available to be passed in via request body.

Julian Lamb3787bd50c68
diff --git a/public/openapi/write/topics/tid/pin.yaml b/public/openapi/write/topics/tid/pin.yaml
index b3f2d580ae..140d3af0f4 100644
--- a/public/openapi/write/topics/tid/pin.yaml
+++ b/public/openapi/write/topics/tid/pin.yaml
@@ -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
diff --git a/test/api.js b/test/api.js
index e76ec8a216..a3d55f2c24 100644
--- a/test/api.js
+++ b/test/api.js
@@ -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';