Skip to content

Conversation

@bbakerman
Copy link
Member

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

@bbakerman bbakerman added this to the 18.0 milestone Oct 23, 2021
* @deprecated use {@link #getGraphQLContext()} instead
*/
@Deprecated
public <T> T getContext() {
Copy link
Member Author

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;
}
Copy link
Member Author

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() {
Copy link
Member Author

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) {
Copy link
Member Author

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);
}
Copy link
Member Author

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
Copy link
Member Author

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

@bbakerman bbakerman merged commit 1ee9630 into master Dec 27, 2021
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.

2 participants