lib/graphql/language/parser.y in graphql-1.8.5 vs lib/graphql/language/parser.y in graphql-1.8.6
- old
+ new
@@ -155,11 +155,11 @@
| ON
| operation_type
| schema_keyword
enum_value_definition:
- enum_name directives_list_opt { return make_node(:EnumValueDefinition, name: val[0], directives: val[1], description: get_description(val[0]), position_source: val[0]) }
+ description_opt enum_name directives_list_opt { return make_node(:EnumValueDefinition, name: val[1], directives: val[2], description: val[0] || get_description(val[1]), position_source: val[0] || val[1]) }
enum_value_definitions:
enum_value_definition { return [val[0]] }
| enum_value_definitions enum_value_definition { return val[0] << val[1] }
@@ -336,15 +336,24 @@
input_object_type_extension:
EXTEND INPUT name directives_list_opt LCURLY input_value_definition_list RCURLY { return make_node(:InputObjectTypeExtension, name: val[2], directives: val[3], fields: val[5], position_source: val[0]) }
| EXTEND INPUT name directives_list { return make_node(:InputObjectTypeExtension, name: val[2], directives: val[3], fields: [], position_source: val[0]) }
- scalar_type_definition: SCALAR name directives_list_opt { return make_node(:ScalarTypeDefinition, name: val[1], directives: val[2], description: get_description(val[0]), position_source: val[0]) }
+ description: STRING
+ description_opt:
+ /* none */
+ | description
+
+ scalar_type_definition:
+ description_opt SCALAR name directives_list_opt {
+ return make_node(:ScalarTypeDefinition, name: val[2], directives: val[3], description: val[0] || get_description(val[1]), position_source: val[0] || val[1])
+ }
+
object_type_definition:
- TYPE name implements_opt directives_list_opt LCURLY field_definition_list RCURLY {
- return make_node(:ObjectTypeDefinition, name: val[1], interfaces: val[2], directives: val[3], fields: val[5], description: get_description(val[0]), position_source: val[0])
+ description_opt TYPE name implements_opt directives_list_opt LCURLY field_definition_list RCURLY {
+ return make_node(:ObjectTypeDefinition, name: val[2], interfaces: val[3], directives: val[4], fields: val[6], description: val[0] || get_description(val[1]), position_source: val[0] || val[1])
}
implements_opt:
/* none */ { return [] }
| implements
@@ -361,12 +370,12 @@
legacy_interfaces_list:
name { return [make_node(:TypeName, name: val[0], position_source: val[0])] }
| legacy_interfaces_list name { val[0] << make_node(:TypeName, name: val[1], position_source: val[1]) }
input_value_definition:
- name COLON type default_value_opt directives_list_opt {
- return make_node(:InputValueDefinition, name: val[0], type: val[2], default_value: val[3], directives: val[4], description: get_description(val[0]), position_source: val[0])
+ description_opt name COLON type default_value_opt directives_list_opt {
+ return make_node(:InputValueDefinition, name: val[1], type: val[3], default_value: val[4], directives: val[5], description: val[0] || get_description(val[1]), position_source: val[0] || val[1])
}
input_value_definition_list:
input_value_definition { return [val[0]] }
| input_value_definition_list input_value_definition { val[0] << val[1] }
@@ -374,45 +383,45 @@
arguments_definitions_opt:
/* none */ { return [] }
| LPAREN input_value_definition_list RPAREN { return val[1] }
field_definition:
- name arguments_definitions_opt COLON type directives_list_opt {
- return make_node(:FieldDefinition, name: val[0], arguments: val[1], type: val[3], directives: val[4], description: get_description(val[0]), position_source: val[0])
+ description_opt name arguments_definitions_opt COLON type directives_list_opt {
+ return make_node(:FieldDefinition, name: val[1], arguments: val[2], type: val[4], directives: val[5], description: val[0] || get_description(val[1]), position_source: val[0] || val[1])
}
field_definition_list:
/* none */ { return [] }
| field_definition { return [val[0]] }
| field_definition_list field_definition { val[0] << val[1] }
interface_type_definition:
- INTERFACE name directives_list_opt LCURLY field_definition_list RCURLY {
- return make_node(:InterfaceTypeDefinition, name: val[1], directives: val[2], fields: val[4], description: get_description(val[0]), position_source: val[0])
+ description_opt INTERFACE name directives_list_opt LCURLY field_definition_list RCURLY {
+ return make_node(:InterfaceTypeDefinition, name: val[2], directives: val[3], fields: val[5], description: val[0] || get_description(val[1]), position_source: val[0] || val[1])
}
union_members:
name { return [make_node(:TypeName, name: val[0], position_source: val[0])]}
| union_members PIPE name { val[0] << make_node(:TypeName, name: val[2], position_source: val[2]) }
union_type_definition:
- UNION name directives_list_opt EQUALS union_members {
- return make_node(:UnionTypeDefinition, name: val[1], directives: val[2], types: val[4], description: get_description(val[0]), position_source: val[0])
+ description_opt UNION name directives_list_opt EQUALS union_members {
+ return make_node(:UnionTypeDefinition, name: val[2], directives: val[3], types: val[5], description: val[0] || get_description(val[1]), position_source: val[0] || val[1])
}
enum_type_definition:
- ENUM name directives_list_opt LCURLY enum_value_definitions RCURLY {
- return make_node(:EnumTypeDefinition, name: val[1], directives: val[2], values: val[4], description: get_description(val[0]), position_source: val[0])
+ description_opt ENUM name directives_list_opt LCURLY enum_value_definitions RCURLY {
+ return make_node(:EnumTypeDefinition, name: val[2], directives: val[3], values: val[5], description: val[0] || get_description(val[1]), position_source: val[0] || val[1])
}
input_object_type_definition:
- INPUT name directives_list_opt LCURLY input_value_definition_list RCURLY {
- return make_node(:InputObjectTypeDefinition, name: val[1], directives: val[2], fields: val[4], description: get_description(val[0]), position_source: val[0])
+ description_opt INPUT name directives_list_opt LCURLY input_value_definition_list RCURLY {
+ return make_node(:InputObjectTypeDefinition, name: val[2], directives: val[3], fields: val[5], description: val[0] || get_description(val[1]), position_source: val[0] || val[1])
}
directive_definition:
- DIRECTIVE DIR_SIGN name arguments_definitions_opt ON directive_locations {
- return make_node(:DirectiveDefinition, name: val[2], arguments: val[3], locations: val[5], description: get_description(val[0]), position_source: val[0])
+ description_opt DIRECTIVE DIR_SIGN name arguments_definitions_opt ON directive_locations {
+ return make_node(:DirectiveDefinition, name: val[3], arguments: val[4], locations: val[6], description: val[0] || get_description(val[1]), position_source: val[0] || val[1])
}
directive_locations:
name { return [make_node(:DirectiveLocation, name: val[0].to_s, position_source: val[0])] }
| directive_locations PIPE name { val[0] << make_node(:DirectiveLocation, name: val[2].to_s, position_source: val[2]) }