-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Provide more information to TypeResolver #369
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| package graphql; | ||
|
|
||
| import java.util.Map; | ||
|
|
||
| import graphql.language.Field; | ||
| import graphql.schema.GraphQLSchema; | ||
| import graphql.schema.GraphQLType; | ||
|
|
||
| public class TypeResolutionEnvironment { | ||
|
|
||
| private final Object object; | ||
| private final Map<String, Object> arguments; | ||
| private final Field field; | ||
| private final GraphQLType fieldType; | ||
| private final GraphQLSchema schema; | ||
|
|
||
| public TypeResolutionEnvironment(Object object, Map<String, Object> arguments, Field field, GraphQLType fieldType, GraphQLSchema schema) { | ||
| this.object = object; | ||
| this.arguments = arguments; | ||
| this.field = field; | ||
| this.fieldType = fieldType; | ||
| this.schema = schema; | ||
| } | ||
|
|
||
| public Object getObject() { | ||
| return object; | ||
| } | ||
|
|
||
| public Map<String, Object> getArguments() { | ||
| return arguments; | ||
| } | ||
|
|
||
| public Field getField() { | ||
| return field; | ||
| } | ||
|
|
||
| public GraphQLType getFieldType() { | ||
| return fieldType; | ||
| } | ||
|
|
||
| public GraphQLSchema getSchema() { | ||
| return schema; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
src/main/java/graphql/execution/TypeResolutionParameters.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| package graphql.execution; | ||
|
|
||
| import java.util.Map; | ||
|
|
||
| import graphql.language.Field; | ||
| import graphql.schema.GraphQLInterfaceType; | ||
| import graphql.schema.GraphQLSchema; | ||
| import graphql.schema.GraphQLUnionType; | ||
|
|
||
| public class TypeResolutionParameters { | ||
|
|
||
| private final GraphQLInterfaceType graphQLInterfaceType; | ||
| private final GraphQLUnionType graphQLUnionType; | ||
| private final Field field; | ||
| private final Object value; | ||
| private final Map<String, Object> argumentValues; | ||
| private final GraphQLSchema schema; | ||
|
|
||
| private TypeResolutionParameters(GraphQLInterfaceType graphQLInterfaceType, GraphQLUnionType graphQLUnionType, | ||
| Field field, Object value, Map<String, Object> argumentValues, GraphQLSchema schema) { | ||
| this.graphQLInterfaceType = graphQLInterfaceType; | ||
| this.graphQLUnionType = graphQLUnionType; | ||
| this.field = field; | ||
| this.value = value; | ||
| this.argumentValues = argumentValues; | ||
| this.schema = schema; | ||
| } | ||
|
|
||
| public GraphQLInterfaceType getGraphQLInterfaceType() { | ||
| return graphQLInterfaceType; | ||
| } | ||
|
|
||
| public GraphQLUnionType getGraphQLUnionType() { | ||
| return graphQLUnionType; | ||
| } | ||
|
|
||
| public Field getField() { | ||
| return field; | ||
| } | ||
|
|
||
| public Object getValue() { | ||
| return value; | ||
| } | ||
|
|
||
| public Map<String, Object> getArgumentValues() { | ||
| return argumentValues; | ||
| } | ||
|
|
||
| public GraphQLSchema getSchema() { | ||
| return schema; | ||
| } | ||
|
|
||
| public static Builder newParameters() { | ||
| return new Builder(); | ||
| } | ||
|
|
||
| public static class Builder { | ||
|
|
||
| private Field field; | ||
| private GraphQLInterfaceType graphQLInterfaceType; | ||
| private GraphQLUnionType graphQLUnionType; | ||
| private Object value; | ||
| private Map<String, Object> argumentValues; | ||
| private GraphQLSchema schema; | ||
|
|
||
| public Builder field(Field field) { | ||
| this.field = field; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder graphQLInterfaceType(GraphQLInterfaceType graphQLInterfaceType) { | ||
| this.graphQLInterfaceType = graphQLInterfaceType; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder graphQLUnionType(GraphQLUnionType graphQLUnionType) { | ||
| this.graphQLUnionType = graphQLUnionType; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder value(Object value) { | ||
| this.value = value; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder argumentValues(Map<String, Object> argumentValues) { | ||
| this.argumentValues = argumentValues; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder schema(GraphQLSchema schema) { | ||
| this.schema = schema; | ||
| return this; | ||
| } | ||
|
|
||
| public TypeResolutionParameters build() { | ||
| return new TypeResolutionParameters(graphQLInterfaceType, graphQLUnionType, field, value, argumentValues, schema); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 already broke this SPI in 3.0 with the earlier "parameters" change. You dont need to to this.