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

Required meta is hardcoded to true when implicit params mapping to meta rather evaluating it to param.isOptional() #177

Closed
rsirs opened this issue Dec 28, 2018 · 2 comments

Comments

@rsirs
Copy link

rsirs commented Dec 28, 2018

For example:

create(@Body() body: ReqBody, @Query('xyz') xyz?: ReqQueryParam) {
}

Here query param XYZ is interpreted as required even though it is optional param because of hardcoded required=true. Now, To make it optional we have to explicitly define

@ApiImplicitQuery({
    name: 'xyz',
    required: false,
  })
create(@Body() body: ReqBody, @Query('xyz') xyz?: ReqQueryParam) {
}

if we make this something like required=!isOptional(param) we don't need to add addition ApiImplicitQuery annotation for required field.

Any thought on that?

@rsirs rsirs changed the title Required meta is hardcoded to true when implicit params mapping to meta rather mapping to param.isOptional() Required meta is hardcoded to true when implicit params mapping to meta rather evaluating it to param.isOptional() Dec 28, 2018
@kamilmysliwiec
Copy link
Member

Duplicate of #30

@kamilmysliwiec kamilmysliwiec marked this as a duplicate of #30 Feb 1, 2019
@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants