question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ApiImplicitBody decorator Enum type support

See original GitHub issue

I’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

@nestjs/swagger@2.5.1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
BMalaichikcommented, Sep 24, 2018

@nartc amazing, thanks! anyway, let;s keep issue opened to hear another guys opinion regarding need of defining implicit body enum parameter

Thanks!

0reactions
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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found