[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
When having a bi-directional many-to-many relation (which includes a join table) decorating both sides with @ApiModelProperty() does not display the type in OpenAPI, even if I define the type manually. Only the opposite side (the one that does not have the JoinTable() decorator) displays it as it should.
When using @ApiModelProperty() a bi-directional relation, the OpenAPI spec should include the other end's type in a relation as a nested property.
@JoinTable() at one of them.@ApiModelProperty() to define them in OpenAPI.@ApiModelProperty({type: MyClass}).JoinTable() that has the OpenAPI spec to see that the type is "items":{"type":"array"}} and the type is omitted.I believe that due some cyclical dependency the properties are not resolved before the OpenAPI is defined. Removing one end of the relation (uni-directional) makes it work correctly.
I have not tried to reproduce this with plain DTOs.
Nest version: 6.0.0
For Tooling issues:
- Node version: 11.14
- Platform: Windows
Any update on this? running into same issue
I am also seeing the same issue.
I also have the same issue.
I was able to solve the problem by providing the type for the ApiModelProperty decorator in a closure. It鈥檚 a problem similar to a circular dependency. Pay attention to what types are available when.
Fixed in the next version (to install run npm i @nestjs/swagger@next). Note: remember to update @nestjs/common, @nestjs/core and typescript as well to ensure that you're using the latest versions.
Steps to migrate: https://github.com/nestjs/swagger/pull/355#issuecomment-547925879
4.0.0 has been published
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
4.0.0 has been published