nestjs / swagger

OpenAPI (Swagger) module for Nest framework (node.js) :earth_americas:
https://nestjs.com
MIT License
1.68k stars 464 forks source link

typeorm: 0.3.20 introduces issues with @ApiProperty on some DTOs #2811

Closed OSA413 closed 7 months ago

OSA413 commented 7 months ago

Did you read the migration guide?

Is there an existing issue that is already proposing this?

Potential Commit/PR that introduced the regression

No response

Versions

No response

Describe the regression

So, I recently updated packages and Swagger started to throw errors related to @ApiProperty (Optional) and circular dependency though a week ago it was just fine.

After investigation I figured out that downgrading typeorm from 0.3.20 to 0.3.19 fixes the issue.

Minimum reproduction code

https://github.com/OSA413/nestjs-bug-swagger-api-property

Expected behavior

For the error to not be thrown.

Other

Some more details of the issue can be found in NestJS' Discord and in this issue:

https://github.com/typeorm/typeorm/issues/10671

micalevisk commented 7 months ago

we can close this as this is not related to @nestjs/swagger but typeorm 0.3.20

OSA413 commented 7 months ago

we can close this as this is not related to @nestjs/swagger but typeorm 0.3.20

As you mentioned in the comment, this may be related to updating reflect-metadata.

Like, does @nestjs/swagger work with reflect-metadata: 0.2.1? Will it support the newer version?

OSA413 commented 7 months ago

Looks like this issue is related to other issues with the update of reflect-metadata like:

OSA413 commented 7 months ago

I guess that this issue can be closed as duplicate of https://github.com/nestjs/nest/issues/13107

Dev response: https://github.com/nestjs/nest/issues/13107#issuecomment-1921234278

Explanation and temporal fix: https://github.com/nestjs/nest/issues/13107#issuecomment-1921364281

OSA413 commented 7 months ago

Fixed with

"@nestjs/common": "^10.3.2",
"@nestjs/core": "^10.3.2",