-
Notifications
You must be signed in to change notification settings - Fork 43
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
Allow to parse value literals #295
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## master #295 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 85 85
Lines 4526 4532 +6
Branches 455 455
=========================================
+ Hits 4526 4532 +6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@Shane32 I'm rewriting https://github.com/sungam3r/graphql-introspection-model now. I decided to completely remove my own |
@@ -661,6 +661,7 @@ namespace GraphQLParser | |||
public static class Parser | |||
{ | |||
public static GraphQLParser.AST.GraphQLDocument Parse(GraphQLParser.ROM source, GraphQLParser.ParserOptions options = default) { } | |||
public static GraphQLParser.AST.GraphQLValue ParseValue(GraphQLParser.ROM source, GraphQLParser.ParserOptions options = default) { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note - it seems that we could make more methods public to allow parse concrete parts of document.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I was thinking like "couldn't we just have Parse" return whatever was parsed? Then cast it to whatever type was desired or something? But the problem is that the parser wouldn't know the initial state -- if, for example, it was parsing a list of arguments or a list of directives.
We could perhaps add Parse<T>
where T is a node type, and then a switch typeof(T)
logic to bump into the correct code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then you could write Parse<GraphQLValue>
if you want that, or Parse<List<GraphQLArgument>>
if you are parsing that, etc, with very little API changes and somewhat intuitive behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really a fan of a million different public Parse...
methods. Hopefully they are all exposed as protected methods or something so anyone CAN use them if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a subject to discuss for v9.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to parse values returned from introspection request, mostly default values of arguments. Our current design allows to parse only entire GraphQL document.
Related project - https://github.com/sungam3r/graphql-introspection-model