mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: update openapi spec to specify optional expiry argument available to be passed in via request body.
Also updated test runner to ignore any request bodies in spec that are explicitly not required.
This commit is contained in:
@@ -11,6 +11,17 @@ put:
|
|||||||
required: true
|
required: true
|
||||||
description: a valid topic id
|
description: a valid topic id
|
||||||
example: 1
|
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:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Topic successfully pinned
|
description: Topic successfully pinned
|
||||||
|
|||||||
@@ -447,7 +447,10 @@ describe('API', async () => {
|
|||||||
|
|
||||||
let body = {};
|
let body = {};
|
||||||
let type = 'json';
|
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);
|
body = buildBody(context[method].requestBody.content['application/json'].schema.properties);
|
||||||
} else if (context[method].hasOwnProperty('requestBody') && context[method].requestBody.content['multipart/form-data']) {
|
} else if (context[method].hasOwnProperty('requestBody') && context[method].requestBody.content['multipart/form-data']) {
|
||||||
type = 'form';
|
type = 'form';
|
||||||
|
|||||||
Reference in New Issue
Block a user