Modifying the DTO name appearing in OpenAPI (Swagger) schemas in NestJS

Viewed 359

I am facing a problem where my DTO types are named one thing, but I want them to appear with a different name in the OpenAPI doc page. For example, I have a UserDto class that I use in my controller, but wanted it to appear as simply "User" in the schemas section (and everywhere else this applies). Is that possible? Is there any decorator I can use? I know I can simply modify the class name, but there is already a different user class used elsewhere. I have searched everywhere with no avail.

enter image description here

BTW, I am using typescript and nestjs. Every help will be appreciated, thanks!

1 Answers

I solved in my case using @ApiModel

like this

    @ApiModel(value="MeuLindoDto")
    public class NameOriginalClassResponseDto ...
Related