Skip to content

Commit ea45d0e

Browse files
authored
Merge pull request #4421 from rmosolgo/load-schema-directives
Properly load schema directives from SDL
2 parents 62e3a7a + d611f55 commit ea45d0e

File tree

6 files changed

+1064
-1015
lines changed

6 files changed

+1064
-1015
lines changed

graphql-c_parser/ext/graphql_c_parser_ext/parser.c

Lines changed: 546 additions & 533 deletions
Large diffs are not rendered by default.

graphql-c_parser/ext/graphql_c_parser_ext/parser.y

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,18 +479,22 @@ type_system_definition:
479479
| directive_definition
480480

481481
schema_definition:
482-
SCHEMA directives_list_opt LCURLY operation_type_definition_list RCURLY {
482+
SCHEMA directives_list_opt operation_type_definition_list_opt {
483483
$$ = MAKE_AST_NODE(SchemaDefinition, 6,
484484
rb_ary_entry($1, 1),
485485
rb_ary_entry($1, 2),
486486
// TODO use static strings:
487-
rb_hash_aref($4, rb_str_new_cstr("query")),
488-
rb_hash_aref($4, rb_str_new_cstr("mutation")),
489-
rb_hash_aref($4, rb_str_new_cstr("subscription")),
487+
rb_hash_aref($3, rb_str_new_cstr("query")),
488+
rb_hash_aref($3, rb_str_new_cstr("mutation")),
489+
rb_hash_aref($3, rb_str_new_cstr("subscription")),
490490
$2
491491
);
492492
}
493493

494+
operation_type_definition_list_opt:
495+
/* none */ { $$ = rb_hash_new(); }
496+
| LCURLY operation_type_definition_list RCURLY { $$ = $2; }
497+
494498
operation_type_definition_list:
495499
operation_type_definition {
496500
$$ = rb_hash_new();

0 commit comments

Comments
 (0)