-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Added in local context to TypeResolutionEnvironment #2699
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
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
| private final Object localContext; | ||
| private final DataFetchingFieldSelectionSet fieldSelectionSet; | ||
|
|
||
| public TypeResolutionEnvironment(Object object, |
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.
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
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.
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) { |
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.
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") |
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.
we never had a full integration test that ensured that these values get set at runtime
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