Skip to content

Commit 5bd9005

Browse files
authored
fix: support more keywords as enum variants (#1128)
Fixes #1127
1 parent 67f30f1 commit 5bd9005

File tree

7 files changed

+91273
-2646
lines changed

7 files changed

+91273
-2646
lines changed

cynic-parser/src/parser/executable.lalrpop

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,20 @@ EnumValue: StringId = {
405405
<s:RawIdent> => ast.ident(s),
406406
schema => ast.ident("schema"),
407407
query => ast.ident("query"),
408+
mutation => ast.ident("mutation"),
409+
subscription => ast.ident("subscription"),
408410
ty => ast.ident("type"),
409411
input => ast.ident("input"),
412+
implements => ast.ident("implements"),
413+
interface => ast.ident("interface"),
414+
"enum" => ast.ident("enum"),
415+
union => ast.ident("union"),
416+
scalar => ast.ident("scalar"),
417+
extend => ast.ident("extend"),
418+
directive => ast.ident("directive"),
419+
repeatable => ast.ident("repeatable"),
420+
on => ast.ident("on"),
421+
fragment => ast.ident("fragment"),
410422
}
411423

412424
Name: StringId = <s:Ident> => ast.ident(s);

cynic-parser/src/parser/executable.rs

Lines changed: 1724 additions & 1184 deletions
Large diffs are not rendered by default.

cynic-parser/src/parser/schema.lalrpop

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,20 @@ EnumValue: StringId = {
528528
<s:RawIdent> => ast.ident(s),
529529
schema => ast.ident("schema"),
530530
query => ast.ident("query"),
531+
mutation => ast.ident("mutation"),
532+
subscription => ast.ident("subscription"),
531533
ty => ast.ident("type"),
532534
input => ast.ident("input"),
535+
implements => ast.ident("implements"),
536+
interface => ast.ident("interface"),
537+
"enum" => ast.ident("enum"),
538+
union => ast.ident("union"),
539+
scalar => ast.ident("scalar"),
540+
extend => ast.ident("extend"),
541+
directive => ast.ident("directive"),
542+
repeatable => ast.ident("repeatable"),
543+
on => ast.ident("on"),
544+
fragment => ast.ident("fragment"),
533545
}
534546

535547
Directives: IdRange<DirectiveId> = {

cynic-parser/src/parser/schema.rs

Lines changed: 2002 additions & 1462 deletions
Large diffs are not rendered by default.

cynic-parser/tests/actual_schemas.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,5 @@ schema_tests!(simple, "../../schemas/simple.graphql");
4444
schema_tests!(starwars, "../../schemas/starwars.schema.graphql");
4545

4646
schema_tests!(test_cases, "../../schemas/test_cases.graphql");
47+
48+
schema_tests!(octopus, "../../schemas/octopus.graphql");

0 commit comments

Comments
 (0)