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
0
votes
0 answers
how to configure swagger with nestjs/graphql projects
I'm working on a project using NestJS and GraphQL, and I want to add Swagger documentation to my API endpoints. I have already set up GraphQL and it's working fine, but I'm not sure how to configure Swagger to generate the documentation for my…
0
votes
0 answers
Is it possible to swagger read extending generic types in class?
I wanna avoid write more controllers as same. So passing DTO class as generic type to parent class. However cannot read generic types in swagger. Is it possible?
BaseController with generic types:
@ApiBearerAuth()
@Controller()
export abstract class…

Bilguun
- 1
- 1
0
votes
1 answer
What is the use of @All decorator in NestJS
What is the use of @All decorator in NestJS and does it handle all the requests that are not handled in other routes?

Talib Allauddin
- 123
- 3
- 16
0
votes
1 answer
Swagger UI & express-basic-auth returns 401 in all my routes instead of provided on app.use params
I have this swagger implementation, and i just give it a simple auth validation with express-basic-auth before anyone can access the UI, but with this implementation, every route returns 401
But this broke all my routes, but now is being aplied to…

Bass
- 21
- 6
0
votes
0 answers
NestJS how to download docx File from Buffer to Frontend
I need to download a created docx file.
the problem is it returns a corrupt xml which looks like this:
enter image description here
is it supposed to look like this and if so how do I convert it back to a docx file?
I read the documentation and…
0
votes
0 answers
My API keeps loading after sending data to the database and ignores my return responses -NESTJs
SwaggerApi
After sending data to my database, swagger keeps on loading in NESTJs. My responses are completely Ignored.
The "IClientInterface" contains the feedback.
Controller for the POST endpoint is…
0
votes
1 answer
Nestjs generate openapi.json output (with mongoose)
I can generate openapi.json from my Nestjs App with no DB connection with the script below.
When I'm trying the same with a nest/mongoose dependency I'm can't generate the json file without having a mongoDb connection open first. Does anyone have a…

Nooneelse
- 127
- 2
- 11
0
votes
1 answer
Swagger request body format is not working well for nested data structure in nest
I am creating api using NestJS and making the api documentation using swagger.
Following code snippet is showing my dto definition.
export class CreateWoopDto {
@ApiProperty()
@IsUUID()
user_id: string;
@ApiProperty()
@ValidateNested({…

Ping Zhao
- 266
- 5
- 19
0
votes
1 answer
How to define a constant in the swagger definition of a NestJS Class?
I have a bunch of Exceptions that use the same interface, so it is easier for the frontend to distinct between them from the same endpoint.
I want to be able to document in swagger that MyWeirdExpection has a property type that has the value…

distante
- 6,438
- 6
- 48
- 90
0
votes
1 answer
How to customize the path to generate and download a Swagger JSON file nestjs
I have to change the path of the swagger json file, in nestjs documentation it is http://localhost:3000/api-json but for the standard have to keep it
http://localhost:3000/api/openapi.json
Let me know if there is any possible solution for it.

Krish909
- 77
- 2
- 12
0
votes
1 answer
Map strings to Array on Open API and NestJS
I aim to generate the swagger spec through a NestJS project, and It's all working until now. The problem arises when I want to specify that return data is a Dict that maps a key to an array of custom objects on runtime.
I read the documentation here…

lia
- 1
- 1
0
votes
1 answer
How to use NX DTO libraries decorated with NestJS swagger api in frontend frameworks
I have a nestjs dto in my NX project library declared like following:
import { ApiProperty } from '@nestjs/swagger';
import { MinLength, MaxLength, IsNotEmpty, IsEmail } from 'class-validator';
class SignInDto {
@ApiProperty({
example:…

Noman
- 124
- 2
- 9
0
votes
0 answers
How can i have mutiple format type for a property in ApiProperty Annotation (nestjs)
Example:
import { ApiProperty, ApiParam } from '@nestjs/swagger';
export class RegisterUserDto {
@IsEmail()
@IsNotEmpty()
@ApiProperty({ type: 'string', format: 'email' })
email: string;
@IsString()
@IsNotEmpty()
@ApiProperty()
…

Nihal Saxena
- 948
- 3
- 11
- 24
0
votes
0 answers
How to represent a class which contains an array of itself as a property (nested)
I have a class which contains a reference to itself as a property viz:
export class Person {
@ApiProperty()
name: string;
// I have tried the following. It always shows up as string
@ApiProperty({type: [Person]})
@ApiProperty({isArray:…

SoWhat
- 5,564
- 2
- 28
- 59
0
votes
0 answers
Generating swagger during runtime (NestJS)
I want the swagger to be generated every time I open a page with it. And I want the description of the data to be loaded from another microservice. Are there ways to do so?
What I've done so far is when the swagger decorators are initialized, they…