upc: ID! on Cosmo while another defines upc: ID (nullable) on Consultancy, both members of a Products union.
By default, the router rejects queries that select such fields across union members with a validation error like:
relax_subgraph_operation_field_selection_merging_nullability option relaxes this validation when the enclosing types are non-overlapping concrete object types (i.e., different union members). This is useful when subgraphs legitimately disagree on nullability for the same field.
Examples
Scalar fields with differing nullability
Given two union member types whereupc has different nullability:
upc on both types:
Consultancy and Cosmo are non-overlapping concrete types — a result can only ever be one or the other.
Object fields with differing nullability
The same applies to object-typed fields:Configuration
- Environment Variable
- YAML