Built-in generation plugin for the @include and @skip directives.
A conditionally-selected field may be omitted from the response, so its generated type must be nullable even when the schema says the field is non-null. Runtime decode already tolerates the omission; this plugin only fixes generated-type accuracy.
After the normalize step has propagated ancestor (inline-fragment /
fragment-spread) directives onto each field, this plugin walks the
resolved tree and marks every conditionally-selected field nullable.
Conditionality
A directive's if: argument is a TypedGql.Language.Variable or a literal
TypedGql.Language.BooleanValue:
@include(if: $var)/@skip(if: $var)— conditional (variable).@include(if: true)/@skip(if: false)— no-op, not conditional.@include(if: false)/@skip(if: true)— always omitted, but still generated as nullable to keep the struct shape stable.
So @include is conditional unless if: is literal true, and @skip
is conditional unless if: is literal false.
List fields (embeds_many) are forced to default: [] downstream, which
cannot represent whole-absence as nil, so their nullability is left
unchanged (see the type generator docs).