graphql 1.11.2 → 1.11.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of graphql might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/generators/graphql/core.rb +8 -0
- data/lib/generators/graphql/object_generator.rb +2 -0
- data/lib/generators/graphql/templates/base_argument.erb +2 -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 +2 -0
- 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/object.erb +2 -0
- data/lib/generators/graphql/templates/query_type.erb +2 -0
- data/lib/generators/graphql/templates/scalar.erb +2 -0
- data/lib/generators/graphql/templates/schema.erb +2 -0
- data/lib/generators/graphql/templates/union.erb +3 -1
- data/lib/graphql.rb +17 -0
- data/lib/graphql/argument.rb +3 -3
- data/lib/graphql/backtrace/tracer.rb +2 -1
- data/lib/graphql/define/assign_global_id_field.rb +2 -2
- data/lib/graphql/execution/interpreter.rb +10 -0
- data/lib/graphql/execution/interpreter/arguments.rb +21 -6
- data/lib/graphql/execution/interpreter/arguments_cache.rb +8 -0
- data/lib/graphql/execution/interpreter/runtime.rb +94 -67
- data/lib/graphql/integer_decoding_error.rb +17 -0
- data/lib/graphql/introspection.rb +96 -0
- data/lib/graphql/introspection/field_type.rb +7 -3
- data/lib/graphql/introspection/input_value_type.rb +6 -0
- data/lib/graphql/introspection/introspection_query.rb +6 -92
- data/lib/graphql/introspection/type_type.rb +7 -3
- data/lib/graphql/invalid_null_error.rb +1 -1
- data/lib/graphql/language/block_string.rb +24 -5
- data/lib/graphql/language/lexer.rb +7 -3
- data/lib/graphql/language/lexer.rl +7 -3
- data/lib/graphql/language/nodes.rb +1 -1
- data/lib/graphql/language/parser.rb +107 -103
- data/lib/graphql/language/parser.y +4 -0
- data/lib/graphql/language/sanitized_printer.rb +59 -26
- data/lib/graphql/name_validator.rb +6 -7
- data/lib/graphql/pagination/connections.rb +11 -3
- data/lib/graphql/query.rb +6 -3
- data/lib/graphql/query/context.rb +34 -4
- data/lib/graphql/query/fingerprint.rb +2 -0
- data/lib/graphql/query/validation_pipeline.rb +4 -1
- data/lib/graphql/relay/array_connection.rb +2 -2
- data/lib/graphql/relay/range_add.rb +14 -5
- data/lib/graphql/schema.rb +49 -18
- data/lib/graphql/schema/argument.rb +56 -10
- data/lib/graphql/schema/build_from_definition.rb +67 -38
- data/lib/graphql/schema/build_from_definition/resolve_map.rb +3 -1
- data/lib/graphql/schema/default_type_error.rb +2 -0
- data/lib/graphql/schema/directive/deprecated.rb +1 -1
- data/lib/graphql/schema/field.rb +32 -16
- data/lib/graphql/schema/field/connection_extension.rb +44 -37
- data/lib/graphql/schema/field/scope_extension.rb +1 -1
- data/lib/graphql/schema/input_object.rb +5 -3
- data/lib/graphql/schema/interface.rb +1 -1
- data/lib/graphql/schema/late_bound_type.rb +2 -2
- data/lib/graphql/schema/loader.rb +1 -0
- data/lib/graphql/schema/member/build_type.rb +14 -4
- data/lib/graphql/schema/member/has_arguments.rb +54 -53
- data/lib/graphql/schema/member/has_fields.rb +17 -7
- data/lib/graphql/schema/member/type_system_helpers.rb +2 -2
- data/lib/graphql/schema/mutation.rb +4 -0
- data/lib/graphql/schema/relay_classic_mutation.rb +4 -2
- data/lib/graphql/schema/resolver.rb +6 -0
- data/lib/graphql/schema/resolver/has_payload_type.rb +2 -1
- data/lib/graphql/schema/subscription.rb +2 -12
- data/lib/graphql/schema/timeout.rb +29 -15
- data/lib/graphql/schema/unique_within_type.rb +1 -2
- data/lib/graphql/schema/validation.rb +8 -0
- data/lib/graphql/schema/warden.rb +2 -3
- data/lib/graphql/static_validation.rb +1 -0
- data/lib/graphql/static_validation/all_rules.rb +1 -0
- data/lib/graphql/static_validation/rules/fields_will_merge.rb +25 -17
- 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/validation_timeout_error.rb +25 -0
- data/lib/graphql/static_validation/validator.rb +29 -7
- data/lib/graphql/subscriptions.rb +32 -22
- data/lib/graphql/subscriptions/action_cable_subscriptions.rb +21 -7
- data/lib/graphql/tracing/appoptics_tracing.rb +10 -2
- data/lib/graphql/tracing/platform_tracing.rb +1 -1
- data/lib/graphql/tracing/prometheus_tracing/graphql_collector.rb +4 -1
- data/lib/graphql/types/int.rb +9 -2
- data/lib/graphql/types/iso_8601_date_time.rb +2 -1
- data/lib/graphql/types/relay/base_connection.rb +8 -6
- data/lib/graphql/types/relay/base_edge.rb +2 -1
- data/lib/graphql/types/string.rb +7 -1
- data/lib/graphql/unauthorized_error.rb +1 -1
- data/lib/graphql/version.rb +1 -1
- data/readme.md +1 -1
- metadata +10 -6
@@ -55,7 +55,15 @@ module GraphQL
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def platform_field_key(type, field)
|
58
|
-
"graphql.#{type.
|
58
|
+
"graphql.#{type.graphql_name}.#{field.graphql_name}"
|
59
|
+
end
|
60
|
+
|
61
|
+
def platform_authorized_key(type)
|
62
|
+
"graphql.authorized.#{type.graphql_name}"
|
63
|
+
end
|
64
|
+
|
65
|
+
def platform_resolve_type_key(type)
|
66
|
+
"graphql.resolve_type.#{type.graphql_name}"
|
59
67
|
end
|
60
68
|
|
61
69
|
private
|
@@ -107,7 +115,7 @@ module GraphQL
|
|
107
115
|
else
|
108
116
|
[key, data[key]]
|
109
117
|
end
|
110
|
-
end.flatten.each_slice(2).to_h.merge(Spec: 'graphql')
|
118
|
+
end.flatten(2).each_slice(2).to_h.merge(Spec: 'graphql')
|
111
119
|
end
|
112
120
|
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
113
121
|
|
@@ -16,7 +16,10 @@ module GraphQL
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def collect(object)
|
19
|
-
|
19
|
+
default_labels = { key: object['key'], platform_key: object['platform_key'] }
|
20
|
+
custom = object['custom_labels']
|
21
|
+
labels = custom.nil? ? default_labels : default_labels.merge(custom)
|
22
|
+
|
20
23
|
@graphql_gauge.observe object['duration'], labels
|
21
24
|
end
|
22
25
|
|
data/lib/graphql/types/int.rb
CHANGED
@@ -9,8 +9,15 @@ module GraphQL
|
|
9
9
|
MIN = -(2**31)
|
10
10
|
MAX = (2**31) - 1
|
11
11
|
|
12
|
-
def self.coerce_input(value,
|
13
|
-
value.is_a?(Integer)
|
12
|
+
def self.coerce_input(value, ctx)
|
13
|
+
return if !value.is_a?(Integer)
|
14
|
+
|
15
|
+
if value >= MIN && value <= MAX
|
16
|
+
value
|
17
|
+
else
|
18
|
+
err = GraphQL::IntegerDecodingError.new(value)
|
19
|
+
ctx.schema.type_error(err, ctx)
|
20
|
+
end
|
14
21
|
end
|
15
22
|
|
16
23
|
def self.coerce_result(value, ctx)
|
@@ -48,7 +48,7 @@ module GraphQL
|
|
48
48
|
# It's called when you subclass this base connection, trying to use the
|
49
49
|
# class name to set defaults. You can call it again in the class definition
|
50
50
|
# to override the default (or provide a value, if the default lookup failed).
|
51
|
-
def edge_type(edge_type_class, edge_class: GraphQL::Relay::Edge, node_type: edge_type_class.node_type, nodes_field: true)
|
51
|
+
def edge_type(edge_type_class, edge_class: GraphQL::Relay::Edge, node_type: edge_type_class.node_type, nodes_field: true, node_nullable: true)
|
52
52
|
# Set this connection's graphql name
|
53
53
|
node_type_name = node_type.graphql_name
|
54
54
|
|
@@ -61,7 +61,7 @@ module GraphQL
|
|
61
61
|
description: "A list of edges.",
|
62
62
|
edge_class: edge_class
|
63
63
|
|
64
|
-
define_nodes_field if nodes_field
|
64
|
+
define_nodes_field(node_nullable) if nodes_field
|
65
65
|
|
66
66
|
description("The connection type for #{node_type_name}.")
|
67
67
|
end
|
@@ -90,10 +90,12 @@ module GraphQL
|
|
90
90
|
|
91
91
|
private
|
92
92
|
|
93
|
-
def define_nodes_field
|
94
|
-
|
95
|
-
|
96
|
-
|
93
|
+
def define_nodes_field(nullable = true)
|
94
|
+
type = nullable ? [@node_type, null: true] : [@node_type]
|
95
|
+
field :nodes, type,
|
96
|
+
null: nullable,
|
97
|
+
description: "A list of nodes.",
|
98
|
+
connection: false
|
97
99
|
end
|
98
100
|
end
|
99
101
|
|
@@ -33,7 +33,8 @@ module GraphQL
|
|
33
33
|
if node_type
|
34
34
|
@node_type = node_type
|
35
35
|
# Add a default `node` field
|
36
|
-
field :node, node_type, null: null, description: "The item at the end of the edge."
|
36
|
+
field :node, node_type, null: null, description: "The item at the end of the edge.",
|
37
|
+
connection: false
|
37
38
|
end
|
38
39
|
@node_type
|
39
40
|
end
|
data/lib/graphql/types/string.rb
CHANGED
@@ -7,7 +7,13 @@ module GraphQL
|
|
7
7
|
|
8
8
|
def self.coerce_result(value, ctx)
|
9
9
|
str = value.to_s
|
10
|
-
str.encoding == Encoding::UTF_8
|
10
|
+
if str.encoding == Encoding::UTF_8
|
11
|
+
str
|
12
|
+
elsif str.frozen?
|
13
|
+
str.encode(Encoding::UTF_8)
|
14
|
+
else
|
15
|
+
str.encode!(Encoding::UTF_8)
|
16
|
+
end
|
11
17
|
rescue EncodingError
|
12
18
|
err = GraphQL::StringEncodingError.new(str)
|
13
19
|
ctx.schema.type_error(err, ctx)
|
@@ -22,7 +22,7 @@ module GraphQL
|
|
22
22
|
@object = object
|
23
23
|
@type = type
|
24
24
|
@context = context
|
25
|
-
message ||= "An instance of #{object.class} failed #{type.
|
25
|
+
message ||= "An instance of #{object.class} failed #{type.graphql_name}'s authorization check"
|
26
26
|
super(message)
|
27
27
|
end
|
28
28
|
end
|
data/lib/graphql/version.rb
CHANGED
data/readme.md
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
A Ruby implementation of [GraphQL](https://graphql.org/).
|
10
10
|
|
11
11
|
- [Website](https://graphql-ruby.org/)
|
12
|
-
- [API Documentation](https://www.rubydoc.info/
|
12
|
+
- [API Documentation](https://www.rubydoc.info/github/rmosolgo/graphql-ruby)
|
13
13
|
- [Newsletter](https://tinyletter.com/graphql-ruby)
|
14
14
|
|
15
15
|
## Installation
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|
@@ -445,6 +445,7 @@ files:
|
|
445
445
|
- lib/graphql/id_type.rb
|
446
446
|
- lib/graphql/input_object_type.rb
|
447
447
|
- lib/graphql/int_type.rb
|
448
|
+
- lib/graphql/integer_decoding_error.rb
|
448
449
|
- lib/graphql/integer_encoding_error.rb
|
449
450
|
- lib/graphql/interface_type.rb
|
450
451
|
- lib/graphql/internal_representation.rb
|
@@ -650,6 +651,8 @@ files:
|
|
650
651
|
- lib/graphql/static_validation/rules/fragments_are_on_composite_types_error.rb
|
651
652
|
- lib/graphql/static_validation/rules/fragments_are_used.rb
|
652
653
|
- lib/graphql/static_validation/rules/fragments_are_used_error.rb
|
654
|
+
- lib/graphql/static_validation/rules/input_object_names_are_unique.rb
|
655
|
+
- lib/graphql/static_validation/rules/input_object_names_are_unique_error.rb
|
653
656
|
- lib/graphql/static_validation/rules/mutation_root_exists.rb
|
654
657
|
- lib/graphql/static_validation/rules/mutation_root_exists_error.rb
|
655
658
|
- lib/graphql/static_validation/rules/no_definitions_are_present.rb
|
@@ -676,6 +679,7 @@ files:
|
|
676
679
|
- lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb
|
677
680
|
- lib/graphql/static_validation/type_stack.rb
|
678
681
|
- lib/graphql/static_validation/validation_context.rb
|
682
|
+
- lib/graphql/static_validation/validation_timeout_error.rb
|
679
683
|
- lib/graphql/static_validation/validator.rb
|
680
684
|
- lib/graphql/string_encoding_error.rb
|
681
685
|
- lib/graphql/string_type.rb
|
@@ -737,7 +741,7 @@ metadata:
|
|
737
741
|
source_code_uri: https://github.com/rmosolgo/graphql-ruby
|
738
742
|
bug_tracker_uri: https://github.com/rmosolgo/graphql-ruby/issues
|
739
743
|
mailing_list_uri: https://tinyletter.com/graphql-ruby
|
740
|
-
post_install_message:
|
744
|
+
post_install_message:
|
741
745
|
rdoc_options: []
|
742
746
|
require_paths:
|
743
747
|
- lib
|
@@ -752,8 +756,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
752
756
|
- !ruby/object:Gem::Version
|
753
757
|
version: '0'
|
754
758
|
requirements: []
|
755
|
-
rubygems_version: 3.
|
756
|
-
signing_key:
|
759
|
+
rubygems_version: 3.2.3
|
760
|
+
signing_key:
|
757
761
|
specification_version: 4
|
758
762
|
summary: A GraphQL language and runtime for Ruby
|
759
763
|
test_files: []
|