简体   繁体   English

如何将AST转换为GraphQL

[英]How to convert AST to GraphQL

We need to rename the fields in the graphQL, so we get the AST of the GraphQL firstly, and modify it as we need.我们需要重命名 graphQL 中的字段,因此我们先获取 GraphQL 的 AST,并根据需要进行修改。 However, I can't find any solution to convert the AST back to the GraphQL.但是,我找不到将 AST 转换回 GraphQL 的任何解决方案。

The parser I use is " GraphQL Do.net Parser"我使用的解析器是“ GraphQL Do.net Parser”

There is a AstPrinter class that can print out the Document or any Ast Node.有一个AstPrinter class 可以打印出Document或任何 Ast 节点。

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

AstPrinter.Print(…)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM