Skip to content

Conversation

@bbakerman
Copy link
Member

@bbakerman bbakerman commented Jan 30, 2022

And also cleaned up TypeResolutionEnvironment.java / TypeResolutionParameters.java a bit since there was lots of repeated code and really they should be merged at some point

See #2693

And also cleaned up TypeResolutionEnvironment.java / TypeResolutionParameters.java a bit since there was lots of repeated code and really they should be merged at some point
@bbakerman bbakerman added this to the 18.0 milestone Jan 30, 2022
private final Object localContext;
private final DataFetchingFieldSelectionSet fieldSelectionSet;

public TypeResolutionEnvironment(Object object,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is breaking API - but this should not have been made public - a builder pattern (which we started AFTER this class was invented) would have not made this a breaking change.

We really dont want consumers making these

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could got the whole hog and merge the two classes and put the builder int this class. I chose not to do this - progress over perfection

.localContext(localContext)
.schema(executionContext.getGraphQLSchema())
.build();
if (fieldType instanceof GraphQLInterfaceType) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplified - there was never a need for the union vs interface type - there are never treated special outside this spot and again only for resolver lookup

assert env.getContext() == "Context"
assert env.getGraphQLContext().get("x") == "graphqlContext"
assert env.getLocalContext() == "LocalContext"
return env.getSchema().getObjectType("NewBar")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we never had a full integration test that ensured that these values get set at runtime

@bbakerman bbakerman merged commit 0eaeb35 into master Feb 4, 2022
@dondonz dondonz deleted the local_context_in_resolver branch September 4, 2022 05:09
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.

3 participants