Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax for specifying JSON object fields and nested objects in one place #212

Open
ciprian1234 opened this issue Mar 31, 2022 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@ciprian1234
Copy link

ciprian1234 commented Mar 31, 2022

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  
  },  
};
@wbw20
Copy link

wbw20 commented Apr 10, 2022

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.

@kevinccbsg kevinccbsg added enhancement New feature or request good first issue Good for newcomers labels Jul 27, 2022
@sjmunoz
Copy link

sjmunoz commented May 3, 2023

Any update on this?

@madilekci-avena
Copy link

Upvote. I also came here to open an issue like this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants