graphql_parser ast stringification
micimize opened this issue · comments
I'd like to use graphql_parser
for traversing, modifying, then restringifying a document.
Do you all plan on adding stringification? I'm thinking it would parallel the span logic pretty closely
I have no such plans, but you could send in a PR for it.
As-is, you can technically call FileSpan.highlight()
, and other functionality from package:source_span
.
@micimize and @thosakwe, I also need this. The tool I'm building would benefit from being able to write GraphQL documents based on documents provided to it. What I specifically need is a serializer for FragmentDefinitionContext
. The tool I'm building has a corner case where it needs to add fields from an interface type to a fragment definition and emit the resulting fragment with the included fields. I wouldn't mind adding this functionality in a PR, but I could use some guidance on where to start.
I plan to do some maintenance this weekend, after my finals are over. Might be able to get this going.
I indent to use https://pub.dartlang.org/packages/code_buffer, so that the outputted text can be indented/prettified, at least to some extent.
Each node will have a String toSource()
.
Stringification will also be in the upcoming graphql_parser
release, provided through a visitor (this is also a new feature).
At this point, graphql_server
has moved to using the parser from package:gql
(https://github.com/gql-dart/gql), which has visitors, etc. I'll keep this open for a few days, but I recommend moving over to that, as graphql_parser
will soon be deprecated in favor of there being a single GraphQL parser in the Dart ecosystem.
yeah graphql_flutter
has already moved to using it's document nodes. Will go ahead and close
Cool, that works better in the grand scheme of things, because this repo is really focused mostly on execution. I have a feeling this will also help close several other long-standing issues.