| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Test ReportTest Results
Code Coverage (Java 25)
Changed Class Coverage (1 class)
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Problem
GraphQL Java incorrectly rejected valid covariant field return types when the subtype relationship was introduced by an SDL extension rather than declared on the base type.
Object extension example
In this schema, Dog implements Pet through an extension. Returning Dog for a field declared as Pet is valid covariance:
The schema was incorrectly rejected because the covariance check only inspected the base definition of Dog and did not see extend type Dog implements Pet.
Interface extension example
The same problem affected interfaces inheriting from other interfaces through extensions:
WorkingPet is a valid covariant return type for Pet, but the extension-based relationship was previously ignored.
Union extension example
Union members introduced through extensions were also missed:
Dog is a valid subtype of Pets, but the previous check only inspected members declared on the base union.
Summary
TypeDefinitionRegistry stores base SDL definitions and extension definitions separately. This change makes the registry use the logical base-plus-extension relationships when:
This matches graphql-js behavior. graphql-js materializes extensions into its schema types before subtype checks; GraphQL Java retains separate AST definitions and now combines them when answering the equivalent registry queries.
Wrapped covariance
The same relationship is preserved while recursively checking list and non-null wrappers:
[Dog!]! remains a valid subtype of [Pet]!.
Unrelated types remain invalid
Extension relationships are matched by their declared interface and do not make unrelated types compatible:
This schema is still rejected because Car implements Vehicle, not Pet.