Questions tagged [nestjs-swagger]

The OpenAPI specification is a language-agnostic definition format used to describe RESTful APIs. Nest provides a dedicated module that allows generating such a specification by leveraging decorators.

Resources

152 questions
0
votes
0 answers

Plugin always include .entity.ts models instead only .dto.ts models

I use the swagger plugin from nestjs to annotate all dto models for swagger, but it selects the *.entity.ts models too. My nest-cli.json: { "$schema": "https://json.schemastore.org/nest-cli", "collection": "@nestjs/schematics", "sourceRoot":…
Bsel
  • 85
  • 9
0
votes
1 answer

Param won't cast to DTO type in NestJS when trying to use class validators

I'm trying to add validation to the param I get in the request for example to delete something. The param is a string but it has to be a valid UUID. I added the dto to the type of the param in the controller. @Delete(':personId') async…
0
votes
1 answer

Create dynamic javascript classes, to extend dto class for swagger

I am trying to create my own "Mapped types", for the swagger dto in nestJS. In the official document there are many "Mapped types". But, I need to add all the fields of a class, and make ONLY SOME as optional. For which, I do something like…
0
votes
0 answers

NestJS TypeScript @db module runs without being imported and points to a directory that I did not declare

I can not find anywhere that @db is defined. It knows to point to src/db/pickbazar but I can not find it anywhere else in the code so I assume it is defined globally somewhere. When I use Visual Studio Code to look at the definiton it just points…
rockets4all
  • 684
  • 3
  • 8
  • 32
0
votes
1 answer

NestJs Swagger body array with mixed types

I have created an endpoint to create bouchers but they can be created with any feature and each feature has a diferent type. Example: POST /code { "code": "" "features": [{ "type": "expiredDate", "expiredDate": "" },…
srhuevo
  • 341
  • 1
  • 13
0
votes
1 answer

What is the actual use of the optional host parameter and optional callback in the app.listen() method in Nest JS?

In the main.ts file in Nest JS, the following bootstrap function contains the app.listen() method. async function bootstrap() { const app = await NestFactory.create(AppModule); await app.listen(3000); } My question is what is the actual use of…
0
votes
1 answer

Wrong property is included in created object

I am currently developing application using nestjs with fastify adapter But something weird on object construction. Following all the related classes, and methods: Controller endpoint handler @Get() @ApiOperation({ description:…
rizesky
  • 424
  • 6
  • 13
0
votes
1 answer

How to define ApiQuery dynamically with the keys of a specified entity?

I'm struggling with the typing of my query params in NestJs, I have a route like this and I want to be able to filter my result with all the keys of my datamining entities. I did this and it's working but I can't find a way to make it appear in my…
Nicolas Menettrier
  • 1,647
  • 1
  • 13
  • 28
0
votes
1 answer

nestjs with swagger-ui oauth keycloak / cors problem

i have built an API with nestjs. To use the endpoints you have to authorize yourself via Keycloak before, that all works. Now I want to document my API with https://github.com/nestjs/swagger. For this I want the user to be able to authenticate via…
0
votes
1 answer

Grouping different routes within same controller with swagger on NestJs

I have an application that has multiple controllers that those controllers have within them 2 routes @Controller(['1/:someParam', '/2/:someParam']) but when I create swagger it shows both of them within the same group, what I need is to be able to…
0
votes
0 answers

nestjs swagger-ui doesn't show information from decorator apiSecurity

Il wrote a nestjs controller whith decorator @Controller('sample') export class SampleController { @Get(`/sample}`) @ApiOperation({ description: 'sample controller', summary: 'sample', }) @ApiOkResponse({ description: 'sample…
tonio
  • 1
  • 1
0
votes
2 answers

A clean way to check for query parameter in NestJS

I have a nestjs project that is mostly in RESTful structure. Everything works fine, but my concern is that some of the routes check for the presence of some query parameters to fetch data. for instance @Get('/some-resources') async getSomeResource( …
Fynix
  • 39
  • 2
  • 8
0
votes
3 answers

NestJS Swagger UI generation for API Gateway

I am having trouble creating an endpoint to serve the swagger documentation. The only way I can do it locally is if the path has a double slash at the end localhost:3003/dev/swagger//; If I omit one of the forward slashes, it returns a 404 for the…
0
votes
0 answers

Nestjs versioning

I'm using Nestjs v8.1.1, and trying to setup api versioning. My goal is to add in a new api version only those methods to the controller that where changed without duplicating other unchanged methods. Example: api v1…
aponski
  • 145
  • 3
  • 12
0
votes
2 answers

Why this Schema Empty ..... How to setting @ApiProperty in nestjs

I create @ApiProperty() in Dto like this export class UpdateMeassageDto { @ApiProperty() message: { hash: string; created_at: Date; updated_at: Date; } } Then it got an empty result like this https://i.stack.imgur.com/kYGP5.jpg