Skip to content

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

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

Merged
merged 2 commits into from
Jul 3, 2024

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

@@ -50,13 +51,20 @@ public class NodeVisitorWithTypeTracking extends NodeVisitorStub {
private final GraphQLSchema schema;
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 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


Map<Class<?>, Object> rootVars = new LinkedHashMap<>();
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
1 check passed
@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