Closed datagutt closed 8 months ago
Seems that this workaround is what causes the import to disappear. If i remove the .filter(), it starts working again. Hopefully this helps you debug the issue.
Oh, i see. The .includes() part is to avoid self-reference, but it doesn't actually check if the import starts with /
, causing PermissionForRoleFindManyArgsSchema
to match, since it contains RoleFindManyArgsSchema
.
I have a fix for this in #181.
Have a nice day!
Description of issue
I have some issues with certain files not importing schemas before using them.
Dependencies
Code
I have the following schema:
/// @@Gen.model(hide: true) model Role { id String @id @default(uuid()) createdAt DateTime @default(now()) updatedAt DateTime? @updatedAt deletedAt DateTime?
PermissionForRole PermissionForRole[] }
/// @@Gen.model(hide: true) model PermissionForRole { id String @id @default(uuid()) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt deletedAt DateTime?
roleId String role Role @relation(fields: [roleId], references: [id])
@@unique([roleId]) }
This is due to
PermissionForRoleFindManyArgsSchema
never being imported. This seems to only be happening in theRoleFindManyArgsSchema.ts
-file, not other files.Expected behaviour
PermissionForRoleFindManyArgsSchema
should be imported in the files that use it.Additional information
It seems that this bug is not triggered if the two models are named something completely different. I think the bug is related to both models starting or ending with "Role". Renaming
PermissionForRole
to something different causes the file to be correctly imported.