fix: merge interface fields into derived types in SDL generation#111
Open
kleberbaum wants to merge 1 commit intogetcronit:v3from
Open
fix: merge interface fields into derived types in SDL generation#111kleberbaum wants to merge 1 commit intogetcronit:v3from
kleberbaum wants to merge 1 commit intogetcronit:v3from
Conversation
When a derived type declares `implements IFoo`, the SDL must include all interface fields in the derived type's field list. Without this, GraphQL schema validation fails at runtime: "Interface field IFoo.x expected but Bar does not provide it." The fix merges interface fields into derived type field lists during the `addInterfaceToDerived` pass, skipping fields already declared on the derived type. Fixes getcronit#110
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #110 — inherited/implemented fields are not included in the SDL for derived types, causing GraphQL schema validation to fail at runtime.
Problem
When
class Traffic extends RegionNode, Pylon correctly:IRegionNodeinterface with all fieldsimplements IRegionNodetoTrafficBut it does not copy the interface fields into
Traffic's field list in the SDL. GraphQL-jsvalidateSchemathen fails:Fix
In
addInterfaceToDerived(schema-parser.ts), after adding theimplementsclause, merge all interface fields into the derived type's field list (skipping fields already declared on the derived type).Test plan
Traffic extends RegionNodeandTourism extends RegionNode