NestJS 10 is incorrectly parsing the jsdocs comments to generate swagger docs
samaratungajs opened this issue · 1 comments
samaratungajs commented
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
We are upgrading our app from NestJS9 to NestJS10. While doing the upgrade we noticed the following. As in the Screenshot now the JSDocs comments are parsed as just literals and include @ type & @ memberof in the swagger doc this worked fine before v10 of NestJS creating swagger docs without messing up with other jsdocs attributes.
Upgraded @nestjs/swagger v 6.0.4 to 7.3.1
cli config
{
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"plugins": [
{
"name": "@nestjs/swagger",
"options": {
"classValidatorShim": true,
"introspectComments": true
}
}
]
}
}
affected jsdoc
export class UserListFilterDto extends OffsetPaginationBaseDto {
/**
* Filter users by firstname lastname or email
* @example 'q'
* @type {string}
* @memberof UserListFilterDto
*/
@IsOptional()
@IsString()
query?: string;
/**
* Filter by user role
*
* @type {Roles}
* @memberof UserListFilterDto
*/
@IsOptional()
@IsEnum(Roles)
role?: Roles;
/**
* Sort users, defaulted to `desc` by `created at`
*
* @type {SortOrder}
* @memberof UserListFilterDto
*/
@IsOptional()
@IsEnum(SortOrder)
order?: SortOrder = SortOrder.DESC;
/**
* Sort users
*
* @type {UserListSortBy}
* @memberof UserListFilterDto
*/
@IsOptional()
@IsEnum(UserListSortBy)
sortBy?: UserListSortBy = UserListSortBy.CREATED_AT;
}
Minimum reproduction code
https://gist.github.com/samaratungajs/79efceb03d722c66cf17b40e096f217a
Steps to reproduce
No response
Expected behavior
swagger docs without unnecessary literals
behavior before upgrade
literal
Package version
7.3.1
NestJS version
10.3.7
Node.js version
20.12.2
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
No response