You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! thanks for building the generator, it has saved me so much time already!
I am however running into an issue where I can't seem to configure one-to-many relations correctly, specifically, I can't seem to control the nullability of the array type.
For example;
model User {
id String @id
posts BlogPost[]
}
model BlogPost {
id String @id
userId String
user User @relation(fields: [userId], references: [id])
}
Generates (just included the user class)
@ObjectType()
export class User {
@Field(() => ID, {nullable:false})
id!: string;
@Field(() => [BlogPost], {nullable:true}) <-- it's not nullable, its always an array
posts?: Array<BlogPost>
}
This makes it so the gql server thinks posts is nullable, when in reality it always returns an array, with it being empty if there are no posts.
How do I control this behaviour?
The text was updated successfully, but these errors were encountered:
Hi! thanks for building the generator, it has saved me so much time already!
I am however running into an issue where I can't seem to configure one-to-many relations correctly, specifically, I can't seem to control the nullability of the array type.
For example;
Generates (just included the user class)
This makes it so the gql server thinks
posts
is nullable, when in reality it always returns an array, with it being empty if there are no posts.How do I control this behaviour?
The text was updated successfully, but these errors were encountered: