|
1 | 1 | # GraphQL.NET Parser
|
2 | 2 |
|
3 |
| -[](https://github.com/graphql-dotnet/parser/actions/workflows/publish-release.yml) |
4 |
| -[](https://github.com/graphql-dotnet/parser/actions/workflows/publish-preview.yml) |
5 |
| - |
6 |
| -[](https://github.com/graphql-dotnet/parser/actions/workflows/test.yml) |
7 |
| -[](https://github.com/graphql-dotnet/parser/actions/workflows/codeql-analysis.yml) |
| 3 | +[](LICENSE.md) |
8 | 4 | [](https://codecov.io/gh/graphql-dotnet/parser)
|
9 |
| - |
10 |
| -[](https://www.nuget.org/packages/GraphQL-Parser) |
11 | 5 | [](https://www.nuget.org/packages/GraphQL-Parser)
|
| 6 | +[](https://www.nuget.org/packages/GraphQL-Parser) |
| 7 | +[](https://github.com/graphql-dotnet/parser/releases) |
| 8 | +[](https://github.com/graphql-dotnet/parser/commits/master) |
| 9 | + |
12 | 10 |
|
| 11 | +[](https://github.com/graphql-dotnet/parser/graphs/contributors) |
13 | 12 | 
|
14 | 13 | 
|
15 | 14 | 
|
16 | 15 |
|
17 |
| - |
18 |
| - |
19 | 16 | This library contains a lexer and parser as well as the complete [GraphQL AST model](http://spec.graphql.org/October2021/#sec-Appendix-Grammar-Summary)
|
20 | 17 | that allows you to work with GraphQL documents compatible with the [October 2021 spec](https://spec.graphql.org/October2021/).
|
21 | 18 |
|
@@ -63,6 +60,17 @@ information about tokens locations in the source document, then use flag
|
63 | 60 | `IgnoreOptions.Locations`. Or just use `IgnoreOptions.All` and this
|
64 | 61 | will maximize the saving of memory allocated in the managed heap for AST.
|
65 | 62 |
|
| 63 | +You can parse not only entire `GraphQLDocument` but also concrete AST |
| 64 | +nodes. Use generic overload. |
| 65 | + |
| 66 | +```csharp |
| 67 | +string text1 = "enum Color { RED }" |
| 68 | +var ast1 = Parser.Parse<GraphQLEnumTypeDefinition>(text1); |
| 69 | + |
| 70 | +string text2 = "{ a: 1, b: \"abc\", c: RED, d: $id }"; |
| 71 | +var ast2 = Parser.Parse<GraphQLValue>(text2); // returns GraphQLObjectValue |
| 72 | +``` |
| 73 | + |
66 | 74 | ## 3. ASTVisitor
|
67 | 75 |
|
68 | 76 | `ASTVisitor` provides API to traverse AST of the parsed GraphQL document.
|
|
0 commit comments