-
-
Notifications
You must be signed in to change notification settings - Fork 540
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(graphql_parser): parse enum extension
- Loading branch information
1 parent
312e46f
commit 2b6e286
Showing
17 changed files
with
776 additions
and
375 deletions.
There are no files selected for viewing
52 changes: 29 additions & 23 deletions
52
crates/biome_graphql_factory/src/generated/node_factory.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
44 changes: 2 additions & 42 deletions
44
crates/biome_graphql_factory/src/generated/syntax_factory.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
crates/biome_graphql_parser/tests/graphql_test_suite/err/definitions/enum_extension.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
extend enum Direction | ||
|
||
extend enum Direction | ||
NORTH | ||
} | ||
|
119 changes: 119 additions & 0 deletions
119
...e_graphql_parser/tests/graphql_test_suite/err/definitions/enum_extension.graphql.snap.new
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
--- | ||
source: crates/biome_graphql_parser/tests/spec_test.rs | ||
assertion_line: 114 | ||
expression: snapshot | ||
--- | ||
## Input | ||
```graphql | ||
extend enum Direction | ||
|
||
extend enum Direction | ||
NORTH | ||
} | ||
|
||
|
||
``` | ||
|
||
## AST | ||
|
||
``` | ||
GraphqlRoot { | ||
bom_token: missing (optional), | ||
definitions: GraphqlDefinitionList [ | ||
GraphqlEnumTypeExtension { | ||
extend_token: EXTEND_KW@0..7 "extend" [] [Whitespace(" ")], | ||
enum_token: ENUM_KW@7..12 "enum" [] [Whitespace(" ")], | ||
name: GraphqlName { | ||
value_token: GRAPHQL_NAME@12..21 "Direction" [] [], | ||
}, | ||
directives: GraphqlDirectiveList [], | ||
enum_values: missing (optional), | ||
}, | ||
GraphqlEnumTypeExtension { | ||
extend_token: EXTEND_KW@21..30 "extend" [Newline("\n"), Newline("\n")] [Whitespace(" ")], | ||
enum_token: ENUM_KW@30..35 "enum" [] [Whitespace(" ")], | ||
name: GraphqlName { | ||
value_token: GRAPHQL_NAME@35..44 "Direction" [] [], | ||
}, | ||
directives: GraphqlDirectiveList [], | ||
enum_values: GraphqlEnumValuesDefinition { | ||
l_curly_token: missing (required), | ||
values: GraphqlEnumValueList [ | ||
GraphqlEnumValueDefinition { | ||
description: missing (optional), | ||
value: GraphqlEnumValue { | ||
graphql_name: GraphqlName { | ||
value_token: GRAPHQL_NAME@44..52 "NORTH" [Newline("\n"), Whitespace(" ")] [], | ||
}, | ||
}, | ||
directives: GraphqlDirectiveList [], | ||
}, | ||
], | ||
r_curly_token: R_CURLY@52..54 "}" [Newline("\n")] [], | ||
}, | ||
}, | ||
], | ||
eof_token: EOF@54..56 "" [Newline("\n"), Newline("\n")] [], | ||
} | ||
``` | ||
|
||
## CST | ||
|
||
``` | ||
0: GRAPHQL_ROOT@0..56 | ||
0: (empty) | ||
1: GRAPHQL_DEFINITION_LIST@0..54 | ||
0: GRAPHQL_ENUM_TYPE_EXTENSION@0..21 | ||
0: EXTEND_KW@0..7 "extend" [] [Whitespace(" ")] | ||
1: ENUM_KW@7..12 "enum" [] [Whitespace(" ")] | ||
2: GRAPHQL_NAME@12..21 | ||
0: GRAPHQL_NAME@12..21 "Direction" [] [] | ||
3: GRAPHQL_DIRECTIVE_LIST@21..21 | ||
4: (empty) | ||
1: GRAPHQL_ENUM_TYPE_EXTENSION@21..54 | ||
0: EXTEND_KW@21..30 "extend" [Newline("\n"), Newline("\n")] [Whitespace(" ")] | ||
1: ENUM_KW@30..35 "enum" [] [Whitespace(" ")] | ||
2: GRAPHQL_NAME@35..44 | ||
0: GRAPHQL_NAME@35..44 "Direction" [] [] | ||
3: GRAPHQL_DIRECTIVE_LIST@44..44 | ||
4: GRAPHQL_ENUM_VALUES_DEFINITION@44..54 | ||
0: (empty) | ||
1: GRAPHQL_ENUM_VALUE_LIST@44..52 | ||
0: GRAPHQL_ENUM_VALUE_DEFINITION@44..52 | ||
0: (empty) | ||
1: GRAPHQL_ENUM_VALUE@44..52 | ||
0: GRAPHQL_NAME@44..52 | ||
0: GRAPHQL_NAME@44..52 "NORTH" [Newline("\n"), Whitespace(" ")] [] | ||
2: GRAPHQL_DIRECTIVE_LIST@52..52 | ||
2: R_CURLY@52..54 "}" [Newline("\n")] [] | ||
2: EOF@54..56 "" [Newline("\n"), Newline("\n")] [] | ||
|
||
``` | ||
|
||
## Diagnostics | ||
|
||
``` | ||
enum_extension.graphql:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
||
× Expected at least one directive or a set of enum values | ||
|
||
1 │ extend enum Direction | ||
2 │ | ||
> 3 │ extend enum Direction | ||
│ ^^^^^^ | ||
4 │ NORTH | ||
5 │ } | ||
|
||
enum_extension.graphql:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
||
× expected `{` but instead found `NORTH` | ||
|
||
3 │ extend enum Direction | ||
> 4 │ NORTH | ||
│ ^^^^^ | ||
5 │ } | ||
6 │ | ||
|
||
i Remove NORTH | ||
|
||
``` |
Oops, something went wrong.