Closed mirrom closed 3 months ago
Thanks for the report! It's indeed a bug. The validator should be of course @IsBoolean()
. Is now fixed with the latest release.
The disconnect property is boolean for n-to-one relationships (like in your case), but can also be a nested array for n-to-many relationships: https://www.prisma.io/docs/orm/prisma-client/queries/relation-queries#disconnect-a-related-record
Hey Brakebein,
thanks for the quick response!
Thanks for the report! It's indeed a bug. The validator should be of course
@IsBoolean()
. Is now fixed with the latest release.
I can confirm that this fixes the issue for me, thanks a lot!
The disconnect property is boolean for n-to-one relationships (like in your case), but can also be a nested array for n-to-many relationships: https://www.prisma.io/docs/orm/prisma-client/queries/relation-queries#disconnect-a-related-record
This perfectly makes sense!
I have a prisma model that looks something like this:
This generates an UpdateGroupParentGroupRelationInputDto that looks like this:
The disconnect property is annotated with @ValidateNested(). When I try to do a PATCH call with this body:
I get this response:
When I manually remove the @ValidateNested() from the generated UpdateGroupParentGroupRelationInputDto, everything works fine. If I haven't overlooked anything, the @ValidateNested() should never be set for the disconnect property as it will always be a boolean, not a (nested) object or array, correct?