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
1
vote
1 answer
Nestjs Swagger CLI Plugin displays entities from relations instead of only showing the entity imported by my module
I'm using Nest's CLI Plugin to automatically annotate stuff for my documentation.
The issue is that Instead of loading only the entity imported by my module, the plugin also loads all the entities referenced in relations into Swagger UI.
For example…

Electrolite
- 149
- 2
- 16
1
vote
1 answer
How to implement e2e testing in Nest JS Framework
I am new this Framework. I implemented crud operation, migration, unit testing also but I do know how to implement e2e testing in nest JS Framework. I tried to run the e2e testing program it's throwing an error
How to fix this error. I tried many…

Hariprasath Vengatachalam
- 155
- 6
- 18
1
vote
2 answers
How can I add an Object to type in ApiBody decorator in nest js
I have a controller with a POST operation to save ReasonCode. Here is what I have in my controller:
import {
CustomAuthGuard,
ReasonCodeService,
ReasonCode,
} from 'cnv-ms-core';
export class ReasonCodeController {
constructor(private…

iranichai
- 363
- 1
- 6
- 19
1
vote
1 answer
Error: A circular dependency has been detected (property key: "firstName") thrown by tx-mixer
I'm using this wonderful lib: https://www.npmjs.com/package/ts-mixer
The whole traceback looks as follows:
(node:22654) UnhandledPromiseRejectionWarning: Error: A circular dependency has been detected (property key: "firstName"). Please, make sure…

Albert
- 2,146
- 10
- 32
- 54
1
vote
1 answer
NestJS / Stub all controllers dependencies automatically
I am trying to workout a simple way of creating swagger specs and client out of NestJS servers,
the official solution is here https://docs.nestjs.com/openapi/introduction.
However, it requires the "server" to be spun up,
which isn't ideal because…

Hitmands
- 13,491
- 4
- 34
- 69
1
vote
2 answers
Adding requestInterceptor to Swagger Nestjs
I was wondering how can I add requestInterceptor method to Swagger used with Nestjs?
I can't find anywhere how this property can be added to SwaggerModule configuration. That's how I setup swagger docs:
SwaggerModule.setup('docs', app, document,…

jaycohb
- 13
- 4
1
vote
1 answer
How to implement media-type-versioning in NestJs?
When using media-type-versioning, different versions of an endpoint should have the same URL and the client can set the Accept header to the desired version: e.g.
Accept: application/vnd.adventure-works.v1+json
For version 2:
Accept:…

TmTron
- 17,012
- 10
- 94
- 142
1
vote
1 answer
How to validate a DTO fields?
I have an endpoint with no entry params:
async myendpoint(): Promise {
const customer = await this.customerService.findOne(1);
if (customer) {
return await this.customerService.mapToDestination(customer);
}...
}
Then I have my…

Pauloscorps
- 564
- 1
- 6
- 16
1
vote
1 answer
Why DTOs are not throwing Validation error in nestjs?
I am using DTO in my code, and I am getting the response as expected but in code DTOs are not throwing error for example
export class CreateCatDto {
readonly name: string;
readonly age: number;
readonly breed: string;
}
In…

Shipra Choudhary
- 21
- 1
- 4
1
vote
0 answers
OpenAPI Swagger - Empty-Valued and Nullable Parameters
How can Empty-Valued and Nullable Parameters such as query param metadata in a route such as GET /foo?metadata be documented in @nestjs/swagger? Using either readonly metadata?: null; or readonly metadata?: null; in a route @Query() dto class…

Alexander Staroselsky
- 37,209
- 15
- 79
- 91
0
votes
1 answer
How to expose prisma schema to swagger UI in NestJS?
NestJS exposes entity/DTO classes decorated with @ApiProperty to Swagger UI schemas. CLI Plugin automates it for all class files by default with suffixes ['.dto.ts', '.entity.ts']. Prisma schema, unfortunately, is not defined in terms of class thus…

abbr
- 5,361
- 6
- 30
- 44
0
votes
1 answer
Optional Boolean Query Parameter Not Showing Up In Swagger
I'm using Nest.js with Swagger and the Swagger CLI enabled. I have an endpoint in a controller which has an optional boolean query parameter: includeAll that defaults to false. The endpoint looks like:
@Get()
findAll(
…

Gabe
- 5,643
- 3
- 26
- 54
0
votes
1 answer
implementing clean architecture in NestJS
recently I started a personal application using Angular 16 and NestJS as backend. I'm newbie with these technologies and I like all related with design patterns and architectural styles, so I would like to implement clean architecture in nestJS.…

Aldemar Cuartas Carvajal
- 1,573
- 3
- 20
- 39
0
votes
0 answers
Nestjs with Swagger ( Open API ) on Dummy/Mock data
I am working with nestjs and using its swagger implementation.
I want my documentation to work on mock data.
I am using @nestjs/swagger and swagger-ui-express libraries.
Currently it is working on my database.
I want it to work on mock data.
0
votes
0 answers
how to display multiple request example?
just like that:
has multiple request options; how to do that?
I have seen the section of openapi in nestjs doc; and google about it, But no good answer was found;
notice: I use nestjs/swagger not swagger about of java, there has something…

tingshuai
- 23
- 4