Describe the bug
TLDR; if a query has a fragment with a @required in a top level field, it bubbles up to the query, but it's not possible to mark the parent of the fragment spread @required.
Example:
I have a fragment
fragment AirportParts on airports @required {
id
location @required {
city
}
}
And i use it in a query
query MyQuery {
flights {
to {
...AirportParts @mask_disable
}
}
}
Naturally, it leads to a nullable to:
export type MyQuery$result = {
/**
* An array relationship
*/
readonly flights: ({
/**
* An object relationship
*/
readonly to: { // <----- to IS NULLABLE
readonly id: number;
readonly iata: string | null;
/**
* An object relationship
*/
readonly location: {
readonly city: string;
readonly name: string;
};
readonly " $fragments": {
AirportParts: {};
};
} | null; // <----- to IS NULLABLE
})[];
};
However, it is not possible to mark the to as required:
If you try:
query MyQuery {
flights {
- to {
+ to @required {
...AirportParts @mask_disable
}
}
}
❌ Encountered error in src/routes/.../query.gql
@required may only be used on nullable fields
Reproduction
No response
Describe the bug
TLDR; if a query has a fragment with a
@requiredin a top level field, it bubbles up to the query, but it's not possible to mark the parent of the fragment spread@required.Example:
I have a fragment
And i use it in a query
Naturally, it leads to a nullable
to:However, it is not possible to mark the
toas required:If you try:
query MyQuery { flights { - to { + to @required { ...AirportParts @mask_disable } } }Reproduction
No response