-
Notifications
You must be signed in to change notification settings - Fork 1.2k
This adds the field selection set to the type resolver #2597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| * @deprecated use {@link #getGraphQLContext()} instead | ||
| */ | ||
| @Deprecated | ||
| public <T> T getContext() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have been deprecated when we did the context work. Its is now like all the others
| */ | ||
| public GraphQLContext getGraphQLContext() { | ||
| return graphQLContext; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was missed as being a replacement for the above
| /** | ||
| * @return the {@link DataFetchingFieldSelectionSet} for the current field fetch that needs type resolution | ||
| */ | ||
| public DataFetchingFieldSelectionSet getSelectionSet() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the new capability
| GraphQLInterfaceType abstractType = params.getGraphQLInterfaceType(); | ||
| TypeResolver typeResolver = params.getSchema().getCodeRegistry().getTypeResolver(abstractType); | ||
| GraphQLObjectType result = typeResolver.getType(env); | ||
| if (result == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactored this a little because the same code was repeated in each
|
|
||
| if (result == null) { | ||
| throw new UnresolvedTypeException(abstractType); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard to see but the common red code above is now here in a common method
| import java.util.Map; | ||
|
|
||
| @PublicApi | ||
| @Internal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should NEVER have been public API
Is never visible to any one - there is no way for a consumer to get this class
It was ONLY ever used in graphql.execution.ResolveType and that is an internal class
This makes the field selection set available to the TypeResolvers
This relates to #2593
Even if this PR is not accepted, we should take elements of it. Namely a miss labeled API class, the missing GraphqlContext and the missing deprecation on context object