graphql 1.10.1 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/graphql/core.rb +18 -2
- data/lib/generators/graphql/install_generator.rb +36 -6
- data/lib/generators/graphql/loader_generator.rb +1 -0
- data/lib/generators/graphql/mutation_generator.rb +2 -1
- data/lib/generators/graphql/object_generator.rb +54 -9
- data/lib/generators/graphql/relay.rb +63 -0
- data/lib/generators/graphql/relay_generator.rb +21 -0
- data/lib/generators/graphql/templates/base_argument.erb +2 -0
- data/lib/generators/graphql/templates/base_connection.erb +8 -0
- data/lib/generators/graphql/templates/base_edge.erb +8 -0
- data/lib/generators/graphql/templates/base_enum.erb +2 -0
- data/lib/generators/graphql/templates/base_field.erb +2 -0
- data/lib/generators/graphql/templates/base_input_object.erb +2 -0
- data/lib/generators/graphql/templates/base_interface.erb +2 -0
- data/lib/generators/graphql/templates/base_mutation.erb +2 -0
- data/lib/generators/graphql/templates/base_object.erb +2 -0
- data/lib/generators/graphql/templates/base_scalar.erb +2 -0
- data/lib/generators/graphql/templates/base_union.erb +2 -0
- data/lib/generators/graphql/templates/enum.erb +2 -0
- data/lib/generators/graphql/templates/graphql_controller.erb +16 -12
- data/lib/generators/graphql/templates/interface.erb +2 -0
- data/lib/generators/graphql/templates/loader.erb +2 -0
- data/lib/generators/graphql/templates/mutation.erb +2 -0
- data/lib/generators/graphql/templates/mutation_type.erb +2 -0
- data/lib/generators/graphql/templates/node_type.erb +9 -0
- data/lib/generators/graphql/templates/object.erb +3 -1
- data/lib/generators/graphql/templates/query_type.erb +3 -3
- data/lib/generators/graphql/templates/scalar.erb +2 -0
- data/lib/generators/graphql/templates/schema.erb +21 -33
- data/lib/generators/graphql/templates/union.erb +3 -1
- data/lib/generators/graphql/type_generator.rb +1 -1
- data/lib/graphql/analysis/analyze_query.rb +7 -0
- data/lib/graphql/analysis/ast/field_usage.rb +24 -1
- data/lib/graphql/analysis/ast/query_complexity.rb +126 -109
- data/lib/graphql/analysis/ast/visitor.rb +13 -5
- data/lib/graphql/analysis/ast.rb +11 -2
- data/lib/graphql/argument.rb +3 -3
- data/lib/graphql/backtrace/inspect_result.rb +0 -1
- data/lib/graphql/backtrace/legacy_tracer.rb +56 -0
- data/lib/graphql/backtrace/table.rb +34 -3
- data/lib/graphql/backtrace/traced_error.rb +0 -1
- data/lib/graphql/backtrace/tracer.rb +40 -9
- data/lib/graphql/backtrace.rb +28 -19
- data/lib/graphql/backwards_compatibility.rb +2 -1
- data/lib/graphql/base_type.rb +1 -1
- data/lib/graphql/compatibility/execution_specification/specification_schema.rb +2 -2
- data/lib/graphql/compatibility/execution_specification.rb +1 -0
- data/lib/graphql/compatibility/lazy_execution_specification.rb +2 -0
- data/lib/graphql/compatibility/query_parser_specification.rb +2 -0
- data/lib/graphql/compatibility/schema_parser_specification.rb +2 -0
- data/lib/graphql/dataloader/null_dataloader.rb +22 -0
- data/lib/graphql/dataloader/request.rb +19 -0
- data/lib/graphql/dataloader/request_all.rb +19 -0
- data/lib/graphql/dataloader/source.rb +155 -0
- data/lib/graphql/dataloader.rb +308 -0
- data/lib/graphql/define/assign_global_id_field.rb +2 -2
- data/lib/graphql/define/defined_object_proxy.rb +1 -1
- data/lib/graphql/define/instance_definable.rb +34 -4
- data/lib/graphql/define/type_definer.rb +5 -5
- data/lib/graphql/deprecated_dsl.rb +18 -5
- data/lib/graphql/deprecation.rb +9 -0
- data/lib/graphql/directive.rb +4 -4
- data/lib/graphql/enum_type.rb +7 -1
- data/lib/graphql/execution/errors.rb +110 -7
- data/lib/graphql/execution/execute.rb +8 -1
- data/lib/graphql/execution/instrumentation.rb +1 -1
- data/lib/graphql/execution/interpreter/argument_value.rb +28 -0
- data/lib/graphql/execution/interpreter/arguments.rb +88 -0
- data/lib/graphql/execution/interpreter/arguments_cache.rb +103 -0
- data/lib/graphql/execution/interpreter/handles_raw_value.rb +18 -0
- data/lib/graphql/execution/interpreter/resolve.rb +37 -25
- data/lib/graphql/execution/interpreter/runtime.rb +685 -421
- data/lib/graphql/execution/interpreter.rb +42 -13
- data/lib/graphql/execution/lazy.rb +5 -1
- data/lib/graphql/execution/lookahead.rb +25 -110
- data/lib/graphql/execution/multiplex.rb +37 -25
- data/lib/graphql/field.rb +5 -1
- data/lib/graphql/function.rb +4 -0
- data/lib/graphql/input_object_type.rb +6 -0
- data/lib/graphql/integer_decoding_error.rb +17 -0
- data/lib/graphql/integer_encoding_error.rb +18 -2
- data/lib/graphql/interface_type.rb +7 -0
- data/lib/graphql/internal_representation/document.rb +2 -2
- data/lib/graphql/internal_representation/rewrite.rb +1 -1
- data/lib/graphql/internal_representation/scope.rb +2 -2
- data/lib/graphql/internal_representation/visit.rb +2 -2
- data/lib/graphql/introspection/directive_type.rb +8 -4
- data/lib/graphql/introspection/entry_points.rb +2 -2
- data/lib/graphql/introspection/enum_value_type.rb +2 -2
- data/lib/graphql/introspection/field_type.rb +9 -5
- data/lib/graphql/introspection/input_value_type.rb +15 -3
- data/lib/graphql/introspection/introspection_query.rb +6 -92
- data/lib/graphql/introspection/schema_type.rb +4 -4
- data/lib/graphql/introspection/type_type.rb +16 -12
- data/lib/graphql/introspection.rb +96 -0
- data/lib/graphql/invalid_null_error.rb +18 -0
- data/lib/graphql/language/block_string.rb +20 -5
- data/lib/graphql/language/cache.rb +37 -0
- data/lib/graphql/language/document_from_schema_definition.rb +73 -25
- data/lib/graphql/language/lexer.rb +4 -3
- data/lib/graphql/language/lexer.rl +3 -3
- data/lib/graphql/language/nodes.rb +51 -89
- data/lib/graphql/language/parser.rb +552 -530
- data/lib/graphql/language/parser.y +114 -99
- data/lib/graphql/language/printer.rb +7 -2
- data/lib/graphql/language/sanitized_printer.rb +222 -0
- data/lib/graphql/language/token.rb +0 -4
- data/lib/graphql/language/visitor.rb +2 -2
- data/lib/graphql/language.rb +2 -0
- data/lib/graphql/name_validator.rb +2 -7
- data/lib/graphql/object_type.rb +44 -35
- data/lib/graphql/pagination/active_record_relation_connection.rb +14 -1
- data/lib/graphql/pagination/array_connection.rb +2 -2
- data/lib/graphql/pagination/connection.rb +75 -20
- data/lib/graphql/pagination/connections.rb +83 -31
- data/lib/graphql/pagination/relation_connection.rb +34 -14
- data/lib/graphql/parse_error.rb +0 -1
- data/lib/graphql/query/arguments.rb +4 -3
- data/lib/graphql/query/arguments_cache.rb +1 -2
- data/lib/graphql/query/context.rb +42 -7
- data/lib/graphql/query/executor.rb +0 -1
- data/lib/graphql/query/fingerprint.rb +26 -0
- data/lib/graphql/query/input_validation_result.rb +23 -6
- data/lib/graphql/query/literal_input.rb +1 -1
- data/lib/graphql/query/null_context.rb +24 -8
- data/lib/graphql/query/serial_execution/field_resolution.rb +1 -1
- data/lib/graphql/query/serial_execution.rb +1 -0
- data/lib/graphql/query/validation_pipeline.rb +5 -2
- data/lib/graphql/query/variable_validation_error.rb +1 -1
- data/lib/graphql/query/variables.rb +14 -4
- data/lib/graphql/query.rb +68 -13
- data/lib/graphql/railtie.rb +9 -1
- data/lib/graphql/rake_task.rb +12 -9
- data/lib/graphql/relay/array_connection.rb +10 -12
- data/lib/graphql/relay/base_connection.rb +26 -13
- data/lib/graphql/relay/connection_instrumentation.rb +4 -4
- data/lib/graphql/relay/connection_type.rb +1 -1
- data/lib/graphql/relay/edges_instrumentation.rb +0 -1
- data/lib/graphql/relay/mutation.rb +1 -0
- data/lib/graphql/relay/node.rb +3 -0
- data/lib/graphql/relay/range_add.rb +23 -9
- data/lib/graphql/relay/relation_connection.rb +8 -10
- data/lib/graphql/relay/type_extensions.rb +2 -0
- data/lib/graphql/rubocop/graphql/base_cop.rb +36 -0
- data/lib/graphql/rubocop/graphql/default_null_true.rb +43 -0
- data/lib/graphql/rubocop/graphql/default_required_true.rb +43 -0
- data/lib/graphql/rubocop.rb +4 -0
- data/lib/graphql/scalar_type.rb +16 -1
- data/lib/graphql/schema/addition.rb +247 -0
- data/lib/graphql/schema/argument.rb +210 -12
- data/lib/graphql/schema/base_64_encoder.rb +2 -0
- data/lib/graphql/schema/build_from_definition/resolve_map.rb +3 -1
- data/lib/graphql/schema/build_from_definition.rb +213 -86
- data/lib/graphql/schema/default_type_error.rb +2 -0
- data/lib/graphql/schema/directive/deprecated.rb +1 -1
- data/lib/graphql/schema/directive/feature.rb +1 -1
- data/lib/graphql/schema/directive/flagged.rb +57 -0
- data/lib/graphql/schema/directive/include.rb +1 -1
- data/lib/graphql/schema/directive/skip.rb +1 -1
- data/lib/graphql/schema/directive/transform.rb +14 -2
- data/lib/graphql/schema/directive.rb +78 -2
- data/lib/graphql/schema/enum.rb +80 -9
- data/lib/graphql/schema/enum_value.rb +17 -6
- data/lib/graphql/schema/field/connection_extension.rb +46 -30
- data/lib/graphql/schema/field/scope_extension.rb +1 -1
- data/lib/graphql/schema/field.rb +285 -133
- data/lib/graphql/schema/find_inherited_value.rb +4 -1
- data/lib/graphql/schema/finder.rb +5 -5
- data/lib/graphql/schema/input_object.rb +97 -89
- data/lib/graphql/schema/interface.rb +24 -19
- data/lib/graphql/schema/late_bound_type.rb +2 -2
- data/lib/graphql/schema/list.rb +7 -1
- data/lib/graphql/schema/loader.rb +137 -103
- data/lib/graphql/schema/member/accepts_definition.rb +8 -1
- data/lib/graphql/schema/member/base_dsl_methods.rb +15 -19
- data/lib/graphql/schema/member/build_type.rb +14 -7
- data/lib/graphql/schema/member/has_arguments.rb +205 -12
- data/lib/graphql/schema/member/has_ast_node.rb +4 -1
- data/lib/graphql/schema/member/has_deprecation_reason.rb +25 -0
- data/lib/graphql/schema/member/has_directives.rb +98 -0
- data/lib/graphql/schema/member/has_fields.rb +95 -30
- data/lib/graphql/schema/member/has_interfaces.rb +90 -0
- data/lib/graphql/schema/member/has_unresolved_type_error.rb +15 -0
- data/lib/graphql/schema/member/has_validators.rb +31 -0
- data/lib/graphql/schema/member/instrumentation.rb +0 -1
- data/lib/graphql/schema/member/type_system_helpers.rb +3 -3
- data/lib/graphql/schema/member.rb +6 -0
- data/lib/graphql/schema/middleware_chain.rb +1 -1
- data/lib/graphql/schema/mutation.rb +4 -0
- data/lib/graphql/schema/non_null.rb +5 -0
- data/lib/graphql/schema/object.rb +47 -46
- data/lib/graphql/schema/possible_types.rb +9 -4
- data/lib/graphql/schema/printer.rb +16 -34
- data/lib/graphql/schema/relay_classic_mutation.rb +32 -4
- data/lib/graphql/schema/resolver/has_payload_type.rb +34 -4
- data/lib/graphql/schema/resolver.rb +123 -63
- data/lib/graphql/schema/scalar.rb +11 -1
- data/lib/graphql/schema/subscription.rb +57 -21
- data/lib/graphql/schema/timeout.rb +29 -15
- data/lib/graphql/schema/timeout_middleware.rb +3 -1
- data/lib/graphql/schema/type_expression.rb +1 -1
- data/lib/graphql/schema/type_membership.rb +18 -4
- data/lib/graphql/schema/union.rb +41 -1
- data/lib/graphql/schema/unique_within_type.rb +1 -2
- data/lib/graphql/schema/validation.rb +12 -2
- data/lib/graphql/schema/validator/allow_blank_validator.rb +29 -0
- data/lib/graphql/schema/validator/allow_null_validator.rb +26 -0
- data/lib/graphql/schema/validator/exclusion_validator.rb +33 -0
- data/lib/graphql/schema/validator/format_validator.rb +48 -0
- data/lib/graphql/schema/validator/inclusion_validator.rb +35 -0
- data/lib/graphql/schema/validator/length_validator.rb +59 -0
- data/lib/graphql/schema/validator/numericality_validator.rb +82 -0
- data/lib/graphql/schema/validator/required_validator.rb +68 -0
- data/lib/graphql/schema/validator.rb +174 -0
- data/lib/graphql/schema/warden.rb +153 -28
- data/lib/graphql/schema.rb +364 -330
- data/lib/graphql/static_validation/all_rules.rb +1 -0
- data/lib/graphql/static_validation/base_visitor.rb +8 -5
- data/lib/graphql/static_validation/definition_dependencies.rb +0 -1
- data/lib/graphql/static_validation/error.rb +3 -1
- data/lib/graphql/static_validation/literal_validator.rb +51 -26
- data/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb +44 -87
- data/lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb +22 -6
- data/lib/graphql/static_validation/rules/arguments_are_defined.rb +28 -22
- data/lib/graphql/static_validation/rules/arguments_are_defined_error.rb +4 -2
- data/lib/graphql/static_validation/rules/directives_are_defined.rb +1 -1
- data/lib/graphql/static_validation/rules/fields_will_merge.rb +79 -43
- data/lib/graphql/static_validation/rules/fields_will_merge_error.rb +25 -4
- data/lib/graphql/static_validation/rules/fragments_are_finite.rb +2 -2
- data/lib/graphql/static_validation/rules/input_object_names_are_unique.rb +30 -0
- data/lib/graphql/static_validation/rules/input_object_names_are_unique_error.rb +30 -0
- data/lib/graphql/static_validation/rules/required_arguments_are_present.rb +1 -1
- data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb +6 -7
- data/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb +9 -10
- data/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb +8 -8
- data/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb +4 -2
- data/lib/graphql/static_validation/validation_context.rb +9 -3
- data/lib/graphql/static_validation/validation_timeout_error.rb +25 -0
- data/lib/graphql/static_validation/validator.rb +42 -8
- data/lib/graphql/static_validation.rb +1 -0
- data/lib/graphql/string_encoding_error.rb +13 -3
- data/lib/graphql/subscriptions/action_cable_subscriptions.rb +118 -19
- data/lib/graphql/subscriptions/broadcast_analyzer.rb +81 -0
- data/lib/graphql/subscriptions/default_subscription_resolve_extension.rb +21 -0
- data/lib/graphql/subscriptions/event.rb +81 -30
- data/lib/graphql/subscriptions/instrumentation.rb +0 -1
- data/lib/graphql/subscriptions/serialize.rb +33 -6
- data/lib/graphql/subscriptions/subscription_root.rb +15 -4
- data/lib/graphql/subscriptions.rb +88 -45
- data/lib/graphql/tracing/active_support_notifications_tracing.rb +2 -1
- data/lib/graphql/tracing/appoptics_tracing.rb +173 -0
- data/lib/graphql/tracing/appsignal_tracing.rb +15 -0
- data/lib/graphql/tracing/new_relic_tracing.rb +1 -12
- data/lib/graphql/tracing/platform_tracing.rb +43 -17
- data/lib/graphql/tracing/prometheus_tracing/graphql_collector.rb +4 -1
- data/lib/graphql/tracing/scout_tracing.rb +11 -0
- data/lib/graphql/tracing/skylight_tracing.rb +1 -1
- data/lib/graphql/tracing/statsd_tracing.rb +42 -0
- data/lib/graphql/tracing.rb +9 -33
- data/lib/graphql/types/big_int.rb +5 -1
- data/lib/graphql/types/int.rb +10 -3
- data/lib/graphql/types/iso_8601_date.rb +3 -3
- data/lib/graphql/types/iso_8601_date_time.rb +25 -10
- data/lib/graphql/types/relay/base_connection.rb +6 -90
- data/lib/graphql/types/relay/base_edge.rb +2 -34
- data/lib/graphql/types/relay/connection_behaviors.rb +156 -0
- data/lib/graphql/types/relay/default_relay.rb +27 -0
- data/lib/graphql/types/relay/edge_behaviors.rb +53 -0
- data/lib/graphql/types/relay/has_node_field.rb +41 -0
- data/lib/graphql/types/relay/has_nodes_field.rb +41 -0
- data/lib/graphql/types/relay/node.rb +2 -4
- data/lib/graphql/types/relay/node_behaviors.rb +15 -0
- data/lib/graphql/types/relay/node_field.rb +2 -20
- data/lib/graphql/types/relay/nodes_field.rb +2 -20
- data/lib/graphql/types/relay/page_info.rb +2 -14
- data/lib/graphql/types/relay/page_info_behaviors.rb +25 -0
- data/lib/graphql/types/relay.rb +11 -3
- data/lib/graphql/types/string.rb +8 -2
- data/lib/graphql/unauthorized_error.rb +2 -2
- data/lib/graphql/union_type.rb +2 -0
- data/lib/graphql/upgrader/member.rb +1 -0
- data/lib/graphql/upgrader/schema.rb +1 -0
- data/lib/graphql/version.rb +1 -1
- data/lib/graphql.rb +65 -31
- data/readme.md +3 -6
- metadata +77 -112
- data/lib/graphql/execution/interpreter/hash_response.rb +0 -46
- data/lib/graphql/literal_validation_error.rb +0 -6
- data/lib/graphql/types/relay/base_field.rb +0 -22
- data/lib/graphql/types/relay/base_interface.rb +0 -29
- data/lib/graphql/types/relay/base_object.rb +0 -26
@@ -138,7 +138,7 @@ module GraphQL
|
|
138
138
|
%% write data;
|
139
139
|
|
140
140
|
def self.run_lexer(query_string)
|
141
|
-
data = query_string.unpack(
|
141
|
+
data = query_string.unpack(PACK_DIRECTIVE)
|
142
142
|
eof = data.length
|
143
143
|
|
144
144
|
# Since `Lexer` is a module, store all lexer state
|
@@ -213,13 +213,13 @@ module GraphQL
|
|
213
213
|
quotes_length = block ? 3 : 1
|
214
214
|
value = meta[:data][ts + quotes_length, te - ts - 2 * quotes_length].pack(PACK_DIRECTIVE).force_encoding(UTF_8_ENCODING) || ''
|
215
215
|
line_incr = 0
|
216
|
-
if block && !value.
|
216
|
+
if block && !value.empty?
|
217
217
|
line_incr = value.count("\n")
|
218
218
|
value = GraphQL::Language::BlockString.trim_whitespace(value)
|
219
219
|
end
|
220
220
|
# TODO: replace with `String#match?` when we support only Ruby 2.4+
|
221
221
|
# (It's faster: https://bugs.ruby-lang.org/issues/8110)
|
222
|
-
if !value.valid_encoding? || value
|
222
|
+
if !value.valid_encoding? || !value.match?(VALID_STRING)
|
223
223
|
meta[:tokens] << token = GraphQL::Language::Token.new(
|
224
224
|
:BAD_UNICODE_ESCAPE,
|
225
225
|
value,
|
@@ -39,11 +39,11 @@ module GraphQL
|
|
39
39
|
|
40
40
|
# Value equality
|
41
41
|
# @return [Boolean] True if `self` is equivalent to `other`
|
42
|
-
def
|
42
|
+
def ==(other)
|
43
43
|
return true if equal?(other)
|
44
|
-
other.
|
45
|
-
other.scalars
|
46
|
-
other.children
|
44
|
+
other.kind_of?(self.class) &&
|
45
|
+
other.scalars == self.scalars &&
|
46
|
+
other.children == self.children
|
47
47
|
end
|
48
48
|
|
49
49
|
NO_CHILDREN = [].freeze
|
@@ -65,9 +65,8 @@ module GraphQL
|
|
65
65
|
@query_string = nil
|
66
66
|
end
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
raise GraphQL::RequiredImplementationMissingError, "#{self.class.name}#visit_method shold return a symbol"
|
68
|
+
def children_method_name
|
69
|
+
self.class.children_method_name
|
71
70
|
end
|
72
71
|
|
73
72
|
def position
|
@@ -147,9 +146,10 @@ module GraphQL
|
|
147
146
|
:on_#{name_underscored}
|
148
147
|
end
|
149
148
|
|
150
|
-
|
151
|
-
|
149
|
+
class << self
|
150
|
+
attr_accessor :children_method_name
|
152
151
|
end
|
152
|
+
self.children_method_name = :#{name_underscored}s
|
153
153
|
RUBY
|
154
154
|
end
|
155
155
|
|
@@ -161,7 +161,7 @@ module GraphQL
|
|
161
161
|
# - Add a persistent update method to add a child
|
162
162
|
# - Generate a `#children` method
|
163
163
|
def children_methods(children_of_type)
|
164
|
-
if @children_methods
|
164
|
+
if defined?(@children_methods)
|
165
165
|
raise "Can't re-call .children_methods for #{self} (already have: #{@children_methods})"
|
166
166
|
else
|
167
167
|
@children_methods = children_of_type
|
@@ -204,7 +204,11 @@ module GraphQL
|
|
204
204
|
end
|
205
205
|
|
206
206
|
if defined?(@scalar_methods)
|
207
|
-
|
207
|
+
if !method_defined?(:initialize_node)
|
208
|
+
generate_initialize_node
|
209
|
+
else
|
210
|
+
# This method was defined manually
|
211
|
+
end
|
208
212
|
else
|
209
213
|
raise "Can't generate_initialize_node because scalar_methods wasn't called; call it before children_methods"
|
210
214
|
end
|
@@ -214,7 +218,7 @@ module GraphQL
|
|
214
218
|
# - Add reader methods
|
215
219
|
# - Add a `#scalars` method
|
216
220
|
def scalar_methods(*method_names)
|
217
|
-
if @scalar_methods
|
221
|
+
if defined?(@scalar_methods)
|
218
222
|
raise "Can't re-call .scalar_methods for #{self} (already have: #{@scalar_methods})"
|
219
223
|
else
|
220
224
|
@scalar_methods = method_names
|
@@ -251,7 +255,7 @@ module GraphQL
|
|
251
255
|
return
|
252
256
|
else
|
253
257
|
arguments = scalar_method_names.map { |m| "#{m}: nil"} +
|
254
|
-
@children_methods.keys.map { |m| "#{m}:
|
258
|
+
@children_methods.keys.map { |m| "#{m}: NO_CHILDREN" }
|
255
259
|
|
256
260
|
assignments = scalar_method_names.map { |m| "@#{m} = #{m}"} +
|
257
261
|
@children_methods.keys.map { |m| "@#{m} = #{m}.freeze" }
|
@@ -373,19 +377,11 @@ module GraphQL
|
|
373
377
|
end
|
374
378
|
|
375
379
|
# Override this because default is `:fields`
|
376
|
-
|
377
|
-
:selections
|
378
|
-
end
|
380
|
+
self.children_method_name = :selections
|
379
381
|
end
|
380
382
|
|
381
383
|
# A reusable fragment, defined at document-level.
|
382
384
|
class FragmentDefinition < AbstractNode
|
383
|
-
scalar_methods :name, :type
|
384
|
-
children_methods({
|
385
|
-
selections: GraphQL::Language::Nodes::Field,
|
386
|
-
directives: GraphQL::Language::Nodes::Directive,
|
387
|
-
})
|
388
|
-
|
389
385
|
# @!attribute name
|
390
386
|
# @return [String] the identifier for this fragment, which may be applied with `...#{name}`
|
391
387
|
|
@@ -398,9 +394,13 @@ module GraphQL
|
|
398
394
|
@selections = selections
|
399
395
|
end
|
400
396
|
|
401
|
-
|
402
|
-
|
403
|
-
|
397
|
+
scalar_methods :name, :type
|
398
|
+
children_methods({
|
399
|
+
selections: GraphQL::Language::Nodes::Field,
|
400
|
+
directives: GraphQL::Language::Nodes::Directive,
|
401
|
+
})
|
402
|
+
|
403
|
+
self.children_method_name = :definitions
|
404
404
|
end
|
405
405
|
|
406
406
|
# Application of a named fragment in a selection
|
@@ -408,9 +408,7 @@ module GraphQL
|
|
408
408
|
scalar_methods :name
|
409
409
|
children_methods(directives: GraphQL::Language::Nodes::Directive)
|
410
410
|
|
411
|
-
|
412
|
-
:selections
|
413
|
-
end
|
411
|
+
self.children_method_name = :selections
|
414
412
|
|
415
413
|
# @!attribute name
|
416
414
|
# @return [String] The identifier of the fragment to apply, corresponds with {FragmentDefinition#name}
|
@@ -424,9 +422,7 @@ module GraphQL
|
|
424
422
|
directives: GraphQL::Language::Nodes::Directive,
|
425
423
|
})
|
426
424
|
|
427
|
-
|
428
|
-
:selections
|
429
|
-
end
|
425
|
+
self.children_method_name = :selections
|
430
426
|
|
431
427
|
# @!attribute type
|
432
428
|
# @return [String, nil] Name of the type this fragment applies to, or `nil` if this fragment applies to any type
|
@@ -449,9 +445,7 @@ module GraphQL
|
|
449
445
|
end
|
450
446
|
end
|
451
447
|
|
452
|
-
|
453
|
-
:value
|
454
|
-
end
|
448
|
+
self.children_method_name = :value
|
455
449
|
|
456
450
|
private
|
457
451
|
|
@@ -473,7 +467,6 @@ module GraphQL
|
|
473
467
|
end
|
474
468
|
end
|
475
469
|
|
476
|
-
|
477
470
|
# A list type definition, denoted with `[...]` (used for variable type definitions)
|
478
471
|
class ListType < WrapperType
|
479
472
|
end
|
@@ -494,6 +487,8 @@ module GraphQL
|
|
494
487
|
|
495
488
|
# @!attribute name
|
496
489
|
# @return [String] The identifier for this variable, _without_ `$`
|
490
|
+
|
491
|
+
self.children_method_name = :variables
|
497
492
|
end
|
498
493
|
|
499
494
|
# A query, mutation or subscription.
|
@@ -519,9 +514,7 @@ module GraphQL
|
|
519
514
|
# @!attribute name
|
520
515
|
# @return [String, nil] The name for this operation, or `nil` if unnamed
|
521
516
|
|
522
|
-
|
523
|
-
:definitions
|
524
|
-
end
|
517
|
+
self.children_method_name = :definitions
|
525
518
|
end
|
526
519
|
|
527
520
|
# A type name, used for variable definitions
|
@@ -530,6 +523,7 @@ module GraphQL
|
|
530
523
|
|
531
524
|
# Usage of a variable in a query. Name does _not_ include `$`.
|
532
525
|
class VariableIdentifier < NameOnlyNode
|
526
|
+
self.children_method_name = :value
|
533
527
|
end
|
534
528
|
|
535
529
|
class SchemaDefinition < AbstractNode
|
@@ -538,9 +532,7 @@ module GraphQL
|
|
538
532
|
children_methods({
|
539
533
|
directives: GraphQL::Language::Nodes::Directive,
|
540
534
|
})
|
541
|
-
|
542
|
-
:definitions
|
543
|
-
end
|
535
|
+
self.children_method_name = :definitions
|
544
536
|
end
|
545
537
|
|
546
538
|
class SchemaExtension < AbstractNode
|
@@ -548,9 +540,7 @@ module GraphQL
|
|
548
540
|
children_methods({
|
549
541
|
directives: GraphQL::Language::Nodes::Directive,
|
550
542
|
})
|
551
|
-
|
552
|
-
:definitions
|
553
|
-
end
|
543
|
+
self.children_method_name = :definitions
|
554
544
|
end
|
555
545
|
|
556
546
|
class ScalarTypeDefinition < AbstractNode
|
@@ -560,9 +550,7 @@ module GraphQL
|
|
560
550
|
children_methods({
|
561
551
|
directives: GraphQL::Language::Nodes::Directive,
|
562
552
|
})
|
563
|
-
|
564
|
-
:definitions
|
565
|
-
end
|
553
|
+
self.children_method_name = :definitions
|
566
554
|
end
|
567
555
|
|
568
556
|
class ScalarTypeExtension < AbstractNode
|
@@ -570,9 +558,7 @@ module GraphQL
|
|
570
558
|
children_methods({
|
571
559
|
directives: GraphQL::Language::Nodes::Directive,
|
572
560
|
})
|
573
|
-
|
574
|
-
:definitions
|
575
|
-
end
|
561
|
+
self.children_method_name = :definitions
|
576
562
|
end
|
577
563
|
|
578
564
|
class InputValueDefinition < AbstractNode
|
@@ -582,9 +568,7 @@ module GraphQL
|
|
582
568
|
children_methods({
|
583
569
|
directives: GraphQL::Language::Nodes::Directive,
|
584
570
|
})
|
585
|
-
|
586
|
-
:fields
|
587
|
-
end
|
571
|
+
self.children_method_name = :fields
|
588
572
|
end
|
589
573
|
|
590
574
|
class FieldDefinition < AbstractNode
|
@@ -595,9 +579,7 @@ module GraphQL
|
|
595
579
|
directives: GraphQL::Language::Nodes::Directive,
|
596
580
|
arguments: GraphQL::Language::Nodes::InputValueDefinition,
|
597
581
|
})
|
598
|
-
|
599
|
-
:fields
|
600
|
-
end
|
582
|
+
self.children_method_name = :fields
|
601
583
|
|
602
584
|
# this is so that `children_method_name` of `InputValueDefinition` works properly
|
603
585
|
# with `#replace_child`
|
@@ -618,9 +600,7 @@ module GraphQL
|
|
618
600
|
directives: GraphQL::Language::Nodes::Directive,
|
619
601
|
fields: GraphQL::Language::Nodes::FieldDefinition,
|
620
602
|
})
|
621
|
-
|
622
|
-
:definitions
|
623
|
-
end
|
603
|
+
self.children_method_name = :definitions
|
624
604
|
end
|
625
605
|
|
626
606
|
class ObjectTypeExtension < AbstractNode
|
@@ -629,9 +609,7 @@ module GraphQL
|
|
629
609
|
directives: GraphQL::Language::Nodes::Directive,
|
630
610
|
fields: GraphQL::Language::Nodes::FieldDefinition,
|
631
611
|
})
|
632
|
-
|
633
|
-
:definitions
|
634
|
-
end
|
612
|
+
self.children_method_name = :definitions
|
635
613
|
end
|
636
614
|
|
637
615
|
class InterfaceTypeDefinition < AbstractNode
|
@@ -639,23 +617,21 @@ module GraphQL
|
|
639
617
|
attr_reader :description
|
640
618
|
scalar_methods :name
|
641
619
|
children_methods({
|
620
|
+
interfaces: GraphQL::Language::Nodes::TypeName,
|
642
621
|
directives: GraphQL::Language::Nodes::Directive,
|
643
622
|
fields: GraphQL::Language::Nodes::FieldDefinition,
|
644
623
|
})
|
645
|
-
|
646
|
-
:definitions
|
647
|
-
end
|
624
|
+
self.children_method_name = :definitions
|
648
625
|
end
|
649
626
|
|
650
627
|
class InterfaceTypeExtension < AbstractNode
|
651
628
|
scalar_methods :name
|
652
629
|
children_methods({
|
630
|
+
interfaces: GraphQL::Language::Nodes::TypeName,
|
653
631
|
directives: GraphQL::Language::Nodes::Directive,
|
654
632
|
fields: GraphQL::Language::Nodes::FieldDefinition,
|
655
633
|
})
|
656
|
-
|
657
|
-
:definitions
|
658
|
-
end
|
634
|
+
self.children_method_name = :definitions
|
659
635
|
end
|
660
636
|
|
661
637
|
class UnionTypeDefinition < AbstractNode
|
@@ -665,9 +641,7 @@ module GraphQL
|
|
665
641
|
children_methods({
|
666
642
|
directives: GraphQL::Language::Nodes::Directive,
|
667
643
|
})
|
668
|
-
|
669
|
-
:definitions
|
670
|
-
end
|
644
|
+
self.children_method_name = :definitions
|
671
645
|
end
|
672
646
|
|
673
647
|
class UnionTypeExtension < AbstractNode
|
@@ -676,9 +650,7 @@ module GraphQL
|
|
676
650
|
children_methods({
|
677
651
|
directives: GraphQL::Language::Nodes::Directive,
|
678
652
|
})
|
679
|
-
|
680
|
-
:definitions
|
681
|
-
end
|
653
|
+
self.children_method_name = :definitions
|
682
654
|
end
|
683
655
|
|
684
656
|
class EnumValueDefinition < AbstractNode
|
@@ -688,9 +660,7 @@ module GraphQL
|
|
688
660
|
children_methods({
|
689
661
|
directives: GraphQL::Language::Nodes::Directive,
|
690
662
|
})
|
691
|
-
|
692
|
-
:values
|
693
|
-
end
|
663
|
+
self.children_method_name = :values
|
694
664
|
end
|
695
665
|
|
696
666
|
class EnumTypeDefinition < AbstractNode
|
@@ -701,9 +671,7 @@ module GraphQL
|
|
701
671
|
directives: GraphQL::Language::Nodes::Directive,
|
702
672
|
values: GraphQL::Language::Nodes::EnumValueDefinition,
|
703
673
|
})
|
704
|
-
|
705
|
-
:definitions
|
706
|
-
end
|
674
|
+
self.children_method_name = :definitions
|
707
675
|
end
|
708
676
|
|
709
677
|
class EnumTypeExtension < AbstractNode
|
@@ -712,9 +680,7 @@ module GraphQL
|
|
712
680
|
directives: GraphQL::Language::Nodes::Directive,
|
713
681
|
values: GraphQL::Language::Nodes::EnumValueDefinition,
|
714
682
|
})
|
715
|
-
|
716
|
-
:definitions
|
717
|
-
end
|
683
|
+
self.children_method_name = :definitions
|
718
684
|
end
|
719
685
|
|
720
686
|
class InputObjectTypeDefinition < AbstractNode
|
@@ -725,9 +691,7 @@ module GraphQL
|
|
725
691
|
directives: GraphQL::Language::Nodes::Directive,
|
726
692
|
fields: GraphQL::Language::Nodes::InputValueDefinition,
|
727
693
|
})
|
728
|
-
|
729
|
-
:definitions
|
730
|
-
end
|
694
|
+
self.children_method_name = :definitions
|
731
695
|
end
|
732
696
|
|
733
697
|
class InputObjectTypeExtension < AbstractNode
|
@@ -736,9 +700,7 @@ module GraphQL
|
|
736
700
|
directives: GraphQL::Language::Nodes::Directive,
|
737
701
|
fields: GraphQL::Language::Nodes::InputValueDefinition,
|
738
702
|
})
|
739
|
-
|
740
|
-
:definitions
|
741
|
-
end
|
703
|
+
self.children_method_name = :definitions
|
742
704
|
end
|
743
705
|
end
|
744
706
|
end
|