Added in local context to TypeResolutionEnvironment#2699
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.
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.
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.
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.
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