ApiImplicitBody decorator Enum type support
See original GitHub issueI’m submitting a…
[ ] Regression
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
Using @ApiImplicitBody
decorator doesn’t support enum-value definitions
Only ApiModelProperty
supports it.
Expected behavior
Use enum-value definition in ApiImplicitBody
definitions
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
I don’t want to define extra Dto, if I use only single body property which is enum value.
Also, anothger thing: why not to get rid of current enum definitions, like:
@ApiModelProperty({ enum: [ ‘value1’, ''value2 ] })
and under-the hood get enum values with _.values(EnumSource)
, which produces enum array
@ApiModelProperty({ enum: { source: EnumSource } })
for me it a bit frustrating, duplicating enum values in api definitions…
Environment
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
NestJS - Swagger - Show all enum values - Stack Overflow
I put this @ApiQuery decorator in my code: @ApiQuery({ name: 'name', enum: ENUM_NAME, isArray: ...
Read more >How to use the @nestjs/swagger.ApiImplicitQuery function in ...
To help you get started, we've selected a few @nestjs/swagger.ApiImplicitQuery examples, based on popular ways it is used in public projects.
Read more >@nestjs/swagger - npm
TypeScript icon, indicating that this package has built-in type declarations ... The following decorators have been changed/renamed:.
Read more >OpenAPI (Swagger.md) - 《Nest.js v6.0 Document》 - 书栈网
The DocumentBuilder is a helper class that helps to structure a ... you can use the @ApiImplicitBody() decorator ( @nestjs/swagger package).
Read more >Types and Parameters - OpenAPI - Documentation | NestJS
In addition, the @ApiProperty() decorator allows setting various Schema Object properties: ... breed: type: 'string' enum: - Persian - Tabby - Siamese.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@nartc amazing, thanks! anyway, let;s keep issue opened to hear another guys opinion regarding need of defining implicit body enum parameter
Thanks!
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.