-
-
Notifications
You must be signed in to change notification settings - Fork 508
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(biome_graphql_parser): parse union extension (#3010)
- Loading branch information
1 parent
7160fb4
commit 8a26e25
Showing
16 changed files
with
331 additions
and
383 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
3 changes: 3 additions & 0 deletions
3
crates/biome_graphql_parser/tests/graphql_test_suite/err/definitions/union_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,3 @@ | ||
extend union SearchResult | ||
|
||
extend union SearchResult Photo | Person |
117 changes: 117 additions & 0 deletions
117
...iome_graphql_parser/tests/graphql_test_suite/err/definitions/union_extension.graphql.snap
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,117 @@ | ||
--- | ||
source: crates/biome_graphql_parser/tests/spec_test.rs | ||
expression: snapshot | ||
--- | ||
## Input | ||
```graphql | ||
extend union SearchResult | ||
extend union SearchResult Photo | Person | ||
``` | ||
|
||
## AST | ||
|
||
``` | ||
GraphqlRoot { | ||
bom_token: missing (optional), | ||
definitions: GraphqlDefinitionList [ | ||
GraphqlUnionTypeExtension { | ||
extend_token: EXTEND_KW@0..7 "extend" [] [Whitespace(" ")], | ||
union_token: UNION_KW@7..13 "union" [] [Whitespace(" ")], | ||
name: GraphqlName { | ||
value_token: GRAPHQL_NAME@13..25 "SearchResult" [] [], | ||
}, | ||
directives: GraphqlDirectiveList [], | ||
union_members: missing (optional), | ||
}, | ||
GraphqlUnionTypeExtension { | ||
extend_token: EXTEND_KW@25..34 "extend" [Newline("\n"), Newline("\n")] [Whitespace(" ")], | ||
union_token: UNION_KW@34..40 "union" [] [Whitespace(" ")], | ||
name: GraphqlName { | ||
value_token: GRAPHQL_NAME@40..53 "SearchResult" [] [Whitespace(" ")], | ||
}, | ||
directives: GraphqlDirectiveList [], | ||
union_members: GraphqlUnionMemberTypes { | ||
eq_token: missing (required), | ||
bitwise_or_token: missing (optional), | ||
members: GraphqlUnionMemberTypeList [ | ||
GraphqlNamedType { | ||
name: GraphqlName { | ||
value_token: GRAPHQL_NAME@53..59 "Photo" [] [Whitespace(" ")], | ||
}, | ||
}, | ||
PIPE@59..61 "|" [] [Whitespace(" ")], | ||
GraphqlNamedType { | ||
name: GraphqlName { | ||
value_token: GRAPHQL_NAME@61..67 "Person" [] [], | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
eof_token: EOF@67..68 "" [Newline("\n")] [], | ||
} | ||
``` | ||
|
||
## CST | ||
|
||
``` | ||
0: [email protected] | ||
0: (empty) | ||
1: [email protected] | ||
0: [email protected] | ||
0: [email protected] "extend" [] [Whitespace(" ")] | ||
1: [email protected] "union" [] [Whitespace(" ")] | ||
2: [email protected] | ||
0: [email protected] "SearchResult" [] [] | ||
3: [email protected] | ||
4: (empty) | ||
1: [email protected] | ||
0: [email protected] "extend" [Newline("\n"), Newline("\n")] [Whitespace(" ")] | ||
1: [email protected] "union" [] [Whitespace(" ")] | ||
2: [email protected] | ||
0: [email protected] "SearchResult" [] [Whitespace(" ")] | ||
3: [email protected] | ||
4: [email protected] | ||
0: (empty) | ||
1: (empty) | ||
2: [email protected] | ||
0: [email protected] | ||
0: [email protected] | ||
0: [email protected] "Photo" [] [Whitespace(" ")] | ||
1: [email protected] "|" [] [Whitespace(" ")] | ||
2: [email protected] | ||
0: [email protected] | ||
0: [email protected] "Person" [] [] | ||
2: [email protected] "" [Newline("\n")] [] | ||
``` | ||
|
||
## Diagnostics | ||
|
||
``` | ||
union_extension.graphql:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
× Expected at least one directive or union member types | ||
1 │ extend union SearchResult | ||
2 │ | ||
> 3 │ extend union SearchResult Photo | Person | ||
│ ^^^^^^ | ||
4 │ | ||
union_extension.graphql:3:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
× expected `=` but instead found `Photo` | ||
1 │ extend union SearchResult | ||
2 │ | ||
> 3 │ extend union SearchResult Photo | Person | ||
│ ^^^^^ | ||
4 │ | ||
i Remove Photo | ||
``` |
3 changes: 3 additions & 0 deletions
3
crates/biome_graphql_parser/tests/graphql_test_suite/ok/definitions/union_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,3 @@ | ||
extend union SearchResult = Photo | Person | ||
|
||
extend union SearchResult @deprecated |
Oops, something went wrong.