How do I write a Visitor method to insert a Field in a SelectionSet? #3633
richardkyee
started this conversation in
General
Replies: 1 comment 5 replies
-
|
This above code is pseudo code. I have debugged the visitField method and it is getting called and the new field is getting traversed but the Node that is returned from the transform method is unchanged from the input. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to modify a GraphQL Document Query to insert a new field in the document by replacing a fieldA with fieldB which then contains fieldA.
I have tried using AstTransformer.transformer(document, visitor) to do the transform by overriding the
public TraversalControl visitField(Field field, TraverserContext data) method
and creating a new Field and then calling data.changeNode(newField) but the Document remains unchanged.
Beta Was this translation helpful? Give feedback.
All reactions