Hello everyone.
I am facing an issue with nullability in types generated for Hasura object relationships using GraphQL codegen (yarn graphql-codegen --config codegen.ts
) to generate the graphql.schema.json and graphql.ts for typed queries in my next js application.
We have two tables summary
and list
with foreign key and an Hasura object relationship named summary in list table mapping summary.id
(PK) and list.summary_id
columns in both tables respectively.
Earlier when I was generating types for this query -
`query getListDetails {
list(where: $where) {
//...
id
summary {
...SummaryFragment
}
}
}`
we got types generated as
list: {
//...
id: number;
summary: SummaryFragment;
};
After some changes in our postgres database, the foreign keys were dropped and we recreated them. But now I am getting types generated as
list: {
//...
id: number;
summary: SummaryFragment | null;
};
We are unable to figure out what change in db could have caused this issue.
Can someone please guide me what could be the reason that now I am getting this | null
in
summary: SummaryFragment | null;
I can share more details if required. Any help would be appreciated.
Thank you!