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.
Questions tagged [nestjs-swagger]
152 questions
2
votes
2 answers
Nest + Swagger not recognizing endpoints or parameters
I'm having an issue with Nest + Swagger. When I open my swagger docs I see all of the endpoints I expect but am having two issues:
When I click on a method it expands all of the methods for that controller
The post method says No parameters despite…

Frank
- 735
- 1
- 12
- 33
2
votes
1 answer
How to include only specific module in nestjs swagger
const app = await NestFactory.create(AppModule);
app.useGlobalFilters(new AllExceptionsFilter());
app.enableCors();
app.useGlobalPipes(new ValidationPipe());
const config = new DocumentBuilder()
.setTitle('API')
…

Mritunjay Upadhyay
- 1,004
- 1
- 15
- 27
2
votes
3 answers
How to fix CORS Error when using the Nest JS framework
I added cors package in the main.ts. but still it's throwing error. I don't understand why this error throwing can you pls explain how to properly handling cors issue.
Main.ts
const app = await…

hari prasanth
- 716
- 1
- 15
- 35
2
votes
1 answer
ApiProperty not reflecting the type of data i want
I'm creating a POST endpoint that will receive an object with one property: returnIds. This return ids will be an array of NUMBERS
{
"returnIds": [1, 2, 3, 4, 5]
}
For this i create this DTO
@ApiProperty()
returnIds: number[]
The problem is…

Programmer89
- 145
- 3
- 15
2
votes
1 answer
Adding a server to nestjs swagger gives a permission error
When I add new server to a nestjs DocumentBuilder .addServer('http://localhost:7071') it thows a permission error when I try to execute routes at generated swagger page.
At the browser console it thows this error:
Refused to connect to…

Leonardo Cartaxo
- 303
- 3
- 9
2
votes
2 answers
NestJs Swagger for Postman
Is there a way to import the generated swagger.json to Postman as an collection ?
I tried to import it but the Endpoints are not shown in Postman ?
I am using NestJs and Swagger + Postman

Elrond
- 479
- 1
- 8
- 21
2
votes
1 answer
Swagger-like to Nestjs Microservices
Is there any swagger-like to nestjs microservices?
The @nestjs/swagger lib only accepts normal nestjs applications, not microservices.
user13158171
2
votes
2 answers
NestJS codegen from Swagger API definition
Does anybody know of a way to automatically generate NestJS typescript code from Swagger?

norgepaul
- 6,013
- 4
- 43
- 76
2
votes
0 answers
@nestjs/swagger generate query object for GET request
I have 2 routes, one is POST, it uses @ApiBody decorator and works correctly, the other one is GET, and I don't know what decorators should I use for generating the correct api.
class ImagesRequestDto {
@ApiProperty({ type: String })
…

Kasheftin
- 7,509
- 11
- 41
- 68
2
votes
1 answer
NestJs merging 2 DTOs or best practices
I have one common Dto for Pagination. But while some of the apis need more parameters and pagination too. e.g. search, filter etc. So my method would become like below :
getAllCelebrities(
@AuthUser('_id') userId: string,
@Body()…

shyammakwana.me
- 5,562
- 2
- 29
- 50
2
votes
2 answers
Is there a module for Open API code generator for Nest.js
Is there any solution for Open API code generator for Nest.js such as this maven plugin for Spring Boot?
I'd like to follow API-First Development approache using Nest.js instead!

Edy Segura
- 517
- 6
- 10
2
votes
1 answer
Generate swagger 2.0 yaml using swagger 4.x package
I am going to integrate my API server to Google Cloud Endpoints.
And Google Cloud Endpoints supports swagger 2.0 as of now.
But my dependencies/libraries are up versions now. So I want to generate swagger 2.0 yaml file without downgrading swagger…

East2d
- 1,886
- 2
- 17
- 28
2
votes
4 answers
NestJS swagger-ui-express package is missing after deploy
I am using NestJS version 7.1.0 and serverless and creating api document uses nestjs swagger. In local it's worked like champ but after deploy got error.
swagger-ui-express package is missing
I see some issue here but still not resolve this…

Binh Ho
- 3,690
- 1
- 31
- 31
2
votes
3 answers
Nest.js swagger plugin not found under jenkins
With Nest.js i'm using @nestjs/swagger plugin. all works well on dev.
in jekins, i'm pulling the code, and doing a build. For that, i have installed nest cli on the server.
i'm getting this error at the build stage:
> nest build
Error …

Ron Al
- 397
- 1
- 6
- 19
2
votes
2 answers
Inject default values in DTO from configuration
Currently, I am using DTO objects in my controllers and I am pairing them with the class-validator plugin as to parse/validate them. The thing is, I want to assign default values to some of the DTO parameters, but those values should come from…

zhulien
- 5,145
- 3
- 22
- 36