Skip to content

Validate transitive @requires on FederatedNode Links at graph construction time#205

Merged
kindermax merged 1 commit intomasterfrom
federated-node-transitive-requires-validation
Mar 2, 2026
Merged

Validate transitive @requires on FederatedNode Links at graph construction time#205
kindermax merged 1 commit intomasterfrom
federated-node-transitive-requires-validation

Conversation

@kindermax
Copy link
Collaborator

@kindermax kindermax commented Mar 2, 2026

When a Link declares requires=['a', 'b'] but field 'b' itself has
@requires(fields='c'), the Link's SDL @requires must also include 'c'
otherwise Apollo Router never sends 'c', causing a KeyError at runtime in the link resolver.

GraphInit._validate_link_requires() now detects this mismatch during
Graph() construction and raises a ValueError with a suggested fix, making
the class of bug impossible to deploy undetected.

@kindermax kindermax force-pushed the federated-node-transitive-requires-validation branch 3 times, most recently from 98110b0 to 3201dae Compare March 2, 2026 21:19
…ction time

When a Link declares requires=['a', 'b'] but field 'b' itself has
@requires(fields='c'), the Link's SDL @requires must also include 'c' —
otherwise Apollo Router never sends 'c', causing a KeyError at runtime.

GraphInit._validate_link_requires() now detects this mismatch during
Graph() construction and raises a ValueError with a suggested fix, making
the class of bug impossible to deploy undetected.
@kindermax kindermax force-pushed the federated-node-transitive-requires-validation branch from 3201dae to 7c778d9 Compare March 2, 2026 21:21
@kindermax kindermax merged commit 440380e into master Mar 2, 2026
7 checks passed
@kindermax kindermax deleted the federated-node-transitive-requires-validation branch March 2, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant