How to convert AST to GraphQL

498 Views Asked by At

We need to rename the fields in the graphQL, so we get the AST of the GraphQL firstly, and modify it as we need. However, I can't find any solution to convert the AST back to the GraphQL.

The parser I use is "GraphQL Dotnet Parser"

1

There are 1 best solutions below

0
Joe McBride On

There is a AstPrinter class that can print out the Document or any Ast Node.

https://github.com/graphql-dotnet/graphql-dotnet/blob/master/src/GraphQL/Utilities/AstPrinter.cs

AstPrinter.Print(…)