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

Boolean field marked as object by the plugin #814

Closed
darioielardi opened this issue Jun 18, 2020 · 1 comment
Closed

Boolean field marked as object by the plugin #814

darioielardi opened this issue Jun 18, 2020 · 1 comment

Comments

@darioielardi
Copy link

darioielardi commented Jun 18, 2020

I'm submitting a...


[ ] Regression 
[ x ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

In some situations a boolean field in a DTO class is annotated as an object by the swagger plugin in the API schema. I didn't manage to identify the exacts circumstances where this happens, it probably only occurs when the field is marked as optional ( annotated with a ? ), and it probably never occurs when the field is marked with the ApiPropertyOptional decorator.
This has been already posted by another user in the Nest repo ( nestjs/nest#4913 ) and by me in the Discord channel.

Minimal reproduction of the problem with instructions

I didn't manage to reproduce the bug in a brand new Nest app, but I published the sample project I was working on the last time I faced the bug: https://github.com/darioielardi/nest-swagger-boolean-bug

The DTO class for which the bug occurs is the PaginationDto class in the src/common/common.dto.ts file. The field count has type boolean but when I start the server ( with Nest CLI, swagger plugin enabled ) and look at the generated swagger schema it is marked as an object.

Environment


Nest version: 7.0.0
 
For Tooling issues:
- Node version: v12.13.1
- Platform:  Mac
@kamilmysliwiec
Copy link
Member

Fixed in 4.5.11. Thanks for reporting! Let me know if you have any further issues

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