Repository navigation
Support resolvers for supertypes of data classes - #820
Merged
Merged
Conversation
A GraphQLResolver<Base> is now used for any data class extending or implementing Base. Resolvers are searched most specific first, followed by the data class itself. Fixes #497 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Cover case where a GraphQLResolver<Base> method and a getter on the subclass both match a field - Move scanQueueItemForPotentialMatches next to related scan methods (no behavior change)
|
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.



Fixes #497
Checklist
Description
A
GraphQLResolver<Base>was ignored for a data classThing extends Base, so building the schema failed withFieldResolverError: No method or field found. The scanner only matched resolvers whose generic type was exactly the data class.Now it also picks up resolvers for any superclass or interface of the data class. They're searched most specific first, followed by the data class itself. So a
ThingResolvermethod wins over aBaseResolvermethod, which wins over a resolver for an interfaceBaseimplements.MultiResolverInfotakes the concrete data class instead of requiring all resolvers to share one, and each resolver keeps its own type as the expected source parameter, soisActive(base: Base)matches when the source is aThing.Resolvers for
Objectare excluded from the supertype matching, otherwise aGraphQLResolver<Any>would apply to every type.One behaviour change: a supertype resolver method now takes precedence over a getter on the subclass itself (e.g.
BaseResolver.label(Base)overThing.getLabel()). This is the same precedence that already applies toBaseitself.🤖 Generated with Claude Code