E539 This introduces a Traversal Options to allow skipping the coercing of field arguments by bbakerman · Pull Request #3651 · graphql-java/graphql-java · GitHub
[go: up one dir, main page]

Skip to content

This introduces a Traversal Options to allow skipping the coercing of field arguments#3651

Merged
bbakerman merged 2 commits intomasterfrom
query-traversal-options
Jul 3, 2024
Merged

This introduces a Traversal Options to allow skipping the coercing of field arguments#3651
bbakerman merged 2 commits intomasterfrom
query-traversal-options

Conversation

@bbakerman
Copy link
Member

The default is the old behaviour of coercing by default

But this can turned off via options

I used an options class so we can extend with further options in the future.

@bbakerman
Copy link
Member Author

#3648 was the driver for this change

private final Map<String, FragmentDefinition> fragmentsByName;
private final ConditionalNodes conditionalNodes = new ConditionalNodes();

public NodeVisitorWithTypeTracking(QueryVisitor preOrderCallback, QueryVisitor postOrderCallback, Map<String, Object> variables, GraphQLSchema schema, Map<String, FragmentDefinition> fragmentsByName) {
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 public but marked as @internal

Locale.getDefault());
} else {
argumentValues = Collections.emptyMap();
}
Copy link
Member Author

Choose a reason for hiding this comment

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

main change

private final Map<String, Object> variables;

private final GraphQLCompositeType rootParentType;
private final QueryTraversalOptions options;
Copy link
Member Author

Choose a reason for hiding this comment

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

QueryTransformer also uses the NodeTracking code and hence this can apply here as well - why not

rootVars.put(QueryTraversalContext.class, new QueryTraversalContext(rootParentType, null, null, GraphQLContext.getDefault()));

TraverserVisitor<Node> nodeTraverserVisitor = new TraverserVisitor<Node>() {
TraverserVisitor<Node> nodeTraverserVisitor = new TraverserVisitor<>() {
Copy link
Member Author

Choose a reason for hiding this comment

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

tiny fix up - not need for generic

Copy link
Member
@dondonz dondonz left a comment

Choose a reason for hiding this comment

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

Thanks!

@bbakerman bbakerman added this pull request to the merge queue Jul 3, 2024
Merged via the queue into master with commit f5c340a Jul 3, 2024
@dondonz dondonz deleted the query-traversal-options branch July 3, 2024 07:04
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

0