nestjs-swagger Questions

4

Solved

Can't authorize in a route using @nestjs/[email protected] because I dont know how to configure the Document` in a right way and I couldn't find a workable answer in authorization official doc...
Militate asked 16/8, 2021 at 20:28

3

I have built a nestjs webapi and implemented versioning at controller and action level as per https://docs.nestjs.com/techniques/versioning The solution i am looking into is, i want to generate 2 d...
Perilous asked 10/2, 2022 at 6:13

4

I define a route to get a paginated result of orders in my controller. @Get() async find( @Query(new ValidationPipe({ whitelist: true })) query: OrderQueryDto & PaginatedQueryDto, ) { const...
Duisburg asked 5/1, 2020 at 13:32

3

I am working on a nestjs project, I've added swagger to display my endpoints, It's working great in dev mode, but once deployed in production using https://zeit.co/ (now), the endpoints page is not...
Crosslet asked 5/2, 2020 at 18:55

1

I have a project with a Nest.js API and an Angular SPA. The DTOs used by the SPA to communicate with the API are in a separate project called Models and I'm using it as a dependency. In that way, I...
Carditis asked 6/5, 2020 at 22:26

4

Solved

I have below class export class DocumentsSteps { @ApiProperty({type: ???}) [type: string]: DocumentStep; } How should I define ApiProperty type?
Capsule asked 21/9, 2021 at 5:13

3

Solved

Currently, I am using @ApiExcludeEndpoint() ### on top of all methods to hide the end-point in the swagger-ui, like this: import { Controller, Get, Query, Param } from '@nestjs/common'; import ...
Acree asked 2/3, 2021 at 9:50

5

Solved

I'm researching the way on how to avoid to specify @ApiProperty() in each dto. I know there is exist a way to create file nest-cli.json, and if you specify Promise<DTO> in your controller in ...
Balliett asked 22/4, 2022 at 9:47

6

Solved

My controller code is something like this. @Controller('customer') export class CustomerController{ constructor(private readonly customerService: CustomerService){} @Post('lookup') async som...
Tapioca asked 27/5, 2020 at 18:51

6

Solved

I want to send file along with JSON { "comment" : "string", "outletId" : 1 } The help I got from Documentation is requestBody: content: multipart/form-data: sche...
Sarver asked 12/3, 2021 at 18:18

2

Solved

This SO answer shows that SwaggerUi will sort endpoints alphabetically if it is passed apisSorter : "alpha" when instantiated. In NestJS the config options are passed in the SwaggerModule...
Featherstitch asked 23/11, 2020 at 18:51

2

I have this route which can return one of these two different DTOs: @Get() @ApiQuery({ name: 'legacy', description: "'Y' to get houses legacy" }) async findAllHouses( @Query('legacy'...
Killie asked 11/3, 2022 at 14:24

3

Solved

some-dto.ts export class CreateCatDto { @ApiProperty() name: string; @ApiProperty() age: number; @ApiProperty() breed: string; } I don't want response something like this: @ApiOkResp...
Sisterhood asked 9/3, 2020 at 11:6

3

Solved

I have an app where I define the API response schemas as plain javascript objects according to the open-api spec. Currently I am passing that to the ApiResponse decorator in @nestjs/swagger as foll...
Counteraccusation asked 20/9, 2020 at 11:46

4

Solved

I am trying to add summary in my swagger documentation routes but I am not able to find the appropriate decorator for defining the summary. There are some routes in which I have not specified any ...
Enceladus asked 7/2, 2020 at 12:58

3

Solved

I'm setting up swagger document in my small Nest.js app according to this documentation: https://docs.nestjs.com/recipes/swagger How do I setup dto to correctly show schema in swagger? To be more s...
Cephalopod asked 31/3, 2020 at 14:46

1

I would like to add a description field to my dto (also to satisfy no_schema_description in OpenAPI linting), but find no way to do so. Which decorator to use? At the point of defining the dto or i...
Ledeen asked 7/10, 2021 at 12:10

2

Solved

EDIT: found a solution thanks to the comment suggesting to use a DTO. Answer detailed at the bottom. The NestJS website has documentation to [declare default values][1] when using @ApiBody(), is th...
Whitehead asked 7/5, 2021 at 13:32

1

Solved

I'm confused about the mapped types in NestJS. The documentation says that PartialType create a new class making its validation decorators optional. So, we use it in our validation pipes as we do w...
Chronicles asked 23/7, 2021 at 10:0

1

Solved

This is working fine: import { IsIn } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; export class createEventDto { @IsIn([0, 1, 2, 3, 4, 5]) @ApiProperty({ descripti...
Path asked 10/6, 2020 at 14:47

1

Solved

I have the following controller : createCollection( @UploadedFile() file, @Body() createCollectionDto: CreateCollectionDto, @GetUser() user: User, ): Promise<Collection> { this.logger.v...
Canso asked 10/4, 2020 at 21:28

1

Solved

I am building an app that has public API and internal one. I would like to publish docs for these to different routes. I thought this would be accomplished by adding only certain tags to document (...
Sanitize asked 24/1, 2020 at 19:21

1

Solved

According to this documentation you import your config in AppModule. I'm trying to access to config in bootstrap level in my main.ts file. Something like this: const app = await NestFactory.create...
Bridgetbridgetown asked 23/12, 2019 at 19:36
1

© 2022 - 2024 — McMap. All rights reserved.