express-jsdoc-swagger
express-jsdoc-swagger copied to clipboard
Syntax for specifying JSON object fields and nested objects in one place
Currently I believe if we want to specify JSON body fields of a POST/PUT request we need to create a separate object with @typedef keyword. Its would be nice to support following syntax.
/**
* POST /item
* @summary Create item
* @param {object} request.body.required - object info
* @param {string} request.body.field1.required - field1 info (required)
* @param {string} request.body.field2 - field2 info
* @param {object} request.body.field3.required - field3 info (required)
* @param {string} request.body.field3.subfield1 - field3.subfield1 info
* @param {string} request.body.field3.subfield2.required - field3.subfield2 info (required)
*
*/
So in this case the POST /item endpoint should expect an object like this
{
field1: 'data', // required field
field2: 'data',
field3: {
subfield1: 'data',
subfield2: 'data', // required field
},
};
I agree this is a big missing feature right now. As it stands now, any large-ish API's docs will be bloated with typedefs of the request bodies. Specifying them inline would fix the issue.
Any update on this?
Upvote. I also came here to open an issue like this