-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
throw new Error(`A circular dependency has been detected (property key: "${key}"). #39
Comments
Can you please test version 1.20.0? I might have accidentially introduced an old behavior with the latest release (because I solved this issue few months ago #31). But it would be good if you can test it as well. |
I could confirm that I also have the same problem with v1.21.0 |
Should now have been fixed with the latest release. |
This unfortunately causes I am aware that this is maybe a pretty niche situation. |
So, this is basically an issue with SWC, but even NestJs recommends a workaround? So all relations and composite types would need to be wrapped with |
I'm messing with this myself currently see if I can do another PR. However the suggested workaround breaks swagger schemas for the wrapped types, the errors are gone but for the referred type its just empty in the schema, I myself find this undesirable, so I'm continuing my search for a solution. SWC is so much faster I don't really want to leave it behind. |
Actually excluding the type property in the Would you accept a PR with a setting for the |
I'm not sure if I got it right. I thought it's basically the type definition of the property? export class User {
@ApiProperty({
type: () => Profile, // <--- you say it's okay to omit this line
})
profile: WrapperType<Profile>; // <--- docs say it needs the wrapper type here
} Maybe you can share some example of what works for you and what not. |
Yes, the docs say it needs the wrapper type there indeed, however I've not had any issues with circular dependencies + SWC while using normal types there. I assume that's because this is a newly defined property, where as When I tried adding the WrapperType to the What I found out is, that it's okay to omit the Meaning that if we add an option that omits the Please let me know if I can clarify anything else and thank you for your patience. |
Sorry for the late response. If you are willing to do so, you can do a PR as you proposed with that flag. Maybe called |
I too am running into this issue, where I am using swc and [this commit] is causing the |
I made a PR which you could use until it's merged. |
I just released a new version with the changes of @KoenLemmen |
|
When omitting the Can you please test out 1.24.0-beta0 and check if it solves the issue? Using following configs:
If it works, |
Works for me. |
@Brakebein i have issue, i dont know how to solve it.
v :
"@brakebein/prisma-generator-nestjs-dto": "^1.21.0",
nest:
"@nestjs/common": "^10.3.4",
this my schema
The text was updated successfully, but these errors were encountered: