graphql 1.12.23 → 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/mutation_generator.rb +1 -1
- data/lib/generators/graphql/type_generator.rb +0 -1
- data/lib/graphql/analysis/ast/field_usage.rb +4 -8
- data/lib/graphql/analysis/ast/query_complexity.rb +10 -14
- data/lib/graphql/analysis/ast/visitor.rb +4 -4
- data/lib/graphql/backtrace/table.rb +1 -1
- data/lib/graphql/dataloader.rb +55 -22
- data/lib/graphql/directive.rb +0 -4
- data/lib/graphql/enum_type.rb +5 -1
- data/lib/graphql/execution/errors.rb +1 -0
- data/lib/graphql/execution/interpreter/arguments.rb +1 -1
- data/lib/graphql/execution/interpreter/arguments_cache.rb +2 -2
- data/lib/graphql/execution/interpreter/runtime.rb +20 -12
- data/lib/graphql/execution/lookahead.rb +2 -2
- data/lib/graphql/execution/multiplex.rb +1 -1
- data/lib/graphql/introspection/directive_type.rb +1 -1
- 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 +2 -2
- data/lib/graphql/introspection/input_value_type.rb +4 -4
- data/lib/graphql/introspection/schema_type.rb +2 -2
- data/lib/graphql/introspection/type_type.rb +10 -10
- data/lib/graphql/language/block_string.rb +0 -4
- data/lib/graphql/language/document_from_schema_definition.rb +4 -2
- data/lib/graphql/language/lexer.rb +0 -3
- data/lib/graphql/language/lexer.rl +0 -4
- data/lib/graphql/language/nodes.rb +3 -11
- data/lib/graphql/language/parser.rb +442 -434
- data/lib/graphql/language/parser.y +5 -4
- data/lib/graphql/language/printer.rb +6 -1
- data/lib/graphql/language/sanitized_printer.rb +5 -5
- data/lib/graphql/language/token.rb +0 -4
- data/lib/graphql/name_validator.rb +0 -4
- data/lib/graphql/query/arguments.rb +1 -1
- data/lib/graphql/query/arguments_cache.rb +1 -1
- data/lib/graphql/query/context.rb +5 -2
- data/lib/graphql/query/literal_input.rb +1 -1
- data/lib/graphql/query/null_context.rb +12 -7
- data/lib/graphql/query/serial_execution/field_resolution.rb +1 -1
- data/lib/graphql/query/variables.rb +5 -1
- data/lib/graphql/relay/edges_instrumentation.rb +0 -1
- 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/schema/addition.rb +37 -28
- data/lib/graphql/schema/argument.rb +6 -6
- data/lib/graphql/schema/build_from_definition.rb +5 -5
- data/lib/graphql/schema/directive/feature.rb +1 -1
- data/lib/graphql/schema/directive/flagged.rb +2 -2
- 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 +1 -1
- data/lib/graphql/schema/directive.rb +2 -2
- data/lib/graphql/schema/enum.rb +57 -9
- data/lib/graphql/schema/enum_value.rb +4 -0
- data/lib/graphql/schema/field/connection_extension.rb +1 -1
- data/lib/graphql/schema/field.rb +92 -17
- data/lib/graphql/schema/find_inherited_value.rb +1 -0
- data/lib/graphql/schema/finder.rb +5 -5
- data/lib/graphql/schema/input_object.rb +6 -5
- data/lib/graphql/schema/interface.rb +8 -19
- data/lib/graphql/schema/member/accepts_definition.rb +8 -1
- data/lib/graphql/schema/member/build_type.rb +0 -4
- data/lib/graphql/schema/member/has_arguments.rb +55 -13
- data/lib/graphql/schema/member/has_deprecation_reason.rb +1 -1
- data/lib/graphql/schema/member/has_fields.rb +76 -18
- data/lib/graphql/schema/member/has_interfaces.rb +90 -0
- data/lib/graphql/schema/member.rb +1 -0
- data/lib/graphql/schema/object.rb +7 -74
- data/lib/graphql/schema/printer.rb +1 -1
- data/lib/graphql/schema/relay_classic_mutation.rb +29 -3
- data/lib/graphql/schema/resolver/has_payload_type.rb +27 -2
- data/lib/graphql/schema/resolver.rb +19 -5
- data/lib/graphql/schema/subscription.rb +11 -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 +6 -1
- data/lib/graphql/schema/validator/format_validator.rb +0 -4
- data/lib/graphql/schema/validator/numericality_validator.rb +1 -0
- data/lib/graphql/schema/warden.rb +116 -52
- data/lib/graphql/schema.rb +87 -15
- data/lib/graphql/static_validation/base_visitor.rb +5 -5
- data/lib/graphql/static_validation/definition_dependencies.rb +0 -1
- data/lib/graphql/static_validation/literal_validator.rb +1 -1
- data/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb +1 -1
- data/lib/graphql/static_validation/rules/fields_will_merge.rb +8 -15
- data/lib/graphql/static_validation/rules/required_arguments_are_present.rb +1 -3
- data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb +4 -4
- data/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb +7 -7
- data/lib/graphql/subscriptions/action_cable_subscriptions.rb +6 -4
- data/lib/graphql/subscriptions/event.rb +20 -12
- data/lib/graphql/subscriptions.rb +17 -19
- data/lib/graphql/types/relay/has_node_field.rb +1 -1
- data/lib/graphql/types/relay/has_nodes_field.rb +1 -1
- data/lib/graphql/version.rb +1 -1
- data/lib/graphql.rb +9 -31
- metadata +10 -5
@@ -34,6 +34,7 @@ module GraphQL
|
|
34
34
|
schema: @schema,
|
35
35
|
context: schema_context,
|
36
36
|
)
|
37
|
+
schema_context.warden = @warden
|
37
38
|
end
|
38
39
|
|
39
40
|
def document
|
@@ -87,6 +88,7 @@ module GraphQL
|
|
87
88
|
def build_interface_type_node(interface_type)
|
88
89
|
GraphQL::Language::Nodes::InterfaceTypeDefinition.new(
|
89
90
|
name: interface_type.graphql_name,
|
91
|
+
interfaces: warden.interfaces(interface_type).sort_by(&:graphql_name).map { |type| build_type_name_node(type) },
|
90
92
|
description: interface_type.description,
|
91
93
|
fields: build_field_nodes(warden.fields(interface_type)),
|
92
94
|
directives: directives(interface_type),
|
@@ -194,7 +196,7 @@ module GraphQL
|
|
194
196
|
when "INPUT_OBJECT"
|
195
197
|
GraphQL::Language::Nodes::InputObject.new(
|
196
198
|
arguments: default_value.to_h.map do |arg_name, arg_value|
|
197
|
-
arg_type =
|
199
|
+
arg_type = @warden.arguments(type).find { |a| a.graphql_name == arg_name.to_s }.type
|
198
200
|
GraphQL::Language::Nodes::Argument.new(
|
199
201
|
name: arg_name.to_s,
|
200
202
|
value: build_default_value(arg_value, arg_type)
|
@@ -295,7 +297,7 @@ module GraphQL
|
|
295
297
|
else
|
296
298
|
member.directives.map do |dir|
|
297
299
|
args = []
|
298
|
-
dir.arguments.argument_values.each_value do |arg_value|
|
300
|
+
dir.arguments.argument_values.each_value do |arg_value| # rubocop:disable Development/ContextIsPassedCop -- directive instance method
|
299
301
|
arg_defn = arg_value.definition
|
300
302
|
if arg_defn.default_value? && arg_value.value == arg_defn.default_value
|
301
303
|
next
|
@@ -197,16 +197,7 @@ module GraphQL
|
|
197
197
|
else
|
198
198
|
module_eval <<-RUBY, __FILE__, __LINE__
|
199
199
|
def children
|
200
|
-
@children ||=
|
201
|
-
if #{children_of_type.keys.map { |k| "@#{k}.any?" }.join(" || ")}
|
202
|
-
new_children = []
|
203
|
-
#{children_of_type.keys.map { |k| "new_children.concat(@#{k})" }.join("; ")}
|
204
|
-
new_children.freeze
|
205
|
-
new_children
|
206
|
-
else
|
207
|
-
NO_CHILDREN
|
208
|
-
end
|
209
|
-
end
|
200
|
+
@children ||= (#{children_of_type.keys.map { |k| "@#{k}" }.join(" + ")}).freeze
|
210
201
|
end
|
211
202
|
RUBY
|
212
203
|
end
|
@@ -476,7 +467,6 @@ module GraphQL
|
|
476
467
|
end
|
477
468
|
end
|
478
469
|
|
479
|
-
|
480
470
|
# A list type definition, denoted with `[...]` (used for variable type definitions)
|
481
471
|
class ListType < WrapperType
|
482
472
|
end
|
@@ -627,6 +617,7 @@ module GraphQL
|
|
627
617
|
attr_reader :description
|
628
618
|
scalar_methods :name
|
629
619
|
children_methods({
|
620
|
+
interfaces: GraphQL::Language::Nodes::TypeName,
|
630
621
|
directives: GraphQL::Language::Nodes::Directive,
|
631
622
|
fields: GraphQL::Language::Nodes::FieldDefinition,
|
632
623
|
})
|
@@ -636,6 +627,7 @@ module GraphQL
|
|
636
627
|
class InterfaceTypeExtension < AbstractNode
|
637
628
|
scalar_methods :name
|
638
629
|
children_methods({
|
630
|
+
interfaces: GraphQL::Language::Nodes::TypeName,
|
639
631
|
directives: GraphQL::Language::Nodes::Directive,
|
640
632
|
fields: GraphQL::Language::Nodes::FieldDefinition,
|
641
633
|
})
|