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

[BUG] Optional keys of json body cannot be specified using .form syntax #199

Open
hmsgit opened this issue Nov 25, 2021 · 1 comment
Open

Comments

@hmsgit
Copy link

hmsgit commented Nov 25, 2021

Description
Json object type required body may contain optional keys. This should be documentable both using the interface notation and form options.

To Reproduce

/**
 * @param {object} request.body.required - Body of the request - application/json
 * @param {string} key.form.required - Key
 * @param {number} value.form.required - Value
 * @param {string} otherThing.form.optional - Other meta info. // or otherThing.form
 */

Expected behavior
Above should make otherThing as optional in the schema: { key: string, value: number, otherThing?: string}
Currently they all are required when specified with form.

However, it works when the form data is moved to Body type and then included as:

/**
 * @param {SomeRequestBody} request.body.required - ...
 */

where SomeRequestBody is defined as

/**
 * SomeRequestBody type
 * @typedef {object} SomeRequestBody
 * @property {string} key.required - Some key
 * @property {string} value.required - Some value
 * @property {string} otherThing - Other meta info
 */

Desktop (please complete the following information):

  • OS: macOS
  • Version 11.6
@musqdp
Copy link

musqdp commented May 17, 2022

any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants