graphql 1.9.7 → 1.9.8
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.
- checksums.yaml +4 -4
- data/lib/generators/graphql/install_generator.rb +2 -1
- data/lib/generators/graphql/templates/base_argument.erb +4 -0
- data/lib/generators/graphql/templates/base_field.erb +2 -0
- data/lib/generators/graphql/templates/base_input_object.erb +1 -0
- data/lib/graphql/analysis/ast/query_complexity.rb +34 -18
- data/lib/graphql/argument.rb +8 -2
- data/lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb +1 -1
- data/lib/graphql/language/lexer.rb +24 -13
- data/lib/graphql/language/lexer.rl +23 -13
- data/lib/graphql/query/arguments.rb +16 -15
- data/lib/graphql/schema.rb +105 -48
- data/lib/graphql/schema/argument.rb +12 -1
- data/lib/graphql/schema/build_from_definition.rb +3 -0
- data/lib/graphql/schema/field.rb +3 -8
- data/lib/graphql/schema/find_inherited_value.rb +20 -0
- data/lib/graphql/schema/input_object.rb +1 -3
- data/lib/graphql/schema/loader.rb +1 -0
- data/lib/graphql/schema/member/base_dsl_methods.rb +7 -18
- data/lib/graphql/schema/member/has_arguments.rb +4 -9
- data/lib/graphql/schema/member/has_fields.rb +14 -0
- data/lib/graphql/schema/member/relay_shortcuts.rb +2 -2
- data/lib/graphql/schema/resolver.rb +31 -8
- data/lib/graphql/schema/resolver/has_payload_type.rb +3 -2
- data/lib/graphql/schema/subscription.rb +1 -1
- data/lib/graphql/static_validation/rules/required_arguments_are_present.rb +1 -1
- data/lib/graphql/version.rb +1 -1
- data/spec/graphql/analysis/analyze_query_spec.rb +14 -25
- data/spec/graphql/analysis/ast/max_query_complexity_spec.rb +7 -19
- data/spec/graphql/analysis/ast/max_query_depth_spec.rb +5 -12
- data/spec/graphql/analysis/max_query_complexity_spec.rb +12 -20
- data/spec/graphql/analysis/max_query_depth_spec.rb +6 -13
- data/spec/graphql/language/lexer_spec.rb +19 -1
- data/spec/graphql/schema/argument_spec.rb +1 -1
- data/spec/graphql/schema/build_from_definition_spec.rb +10 -0
- data/spec/graphql/schema/catchall_middleware_spec.rb +6 -9
- data/spec/graphql/schema/input_object_spec.rb +25 -0
- data/spec/graphql/schema/loader_spec.rb +65 -1
- data/spec/graphql/schema/object_spec.rb +21 -0
- data/spec/graphql/schema/resolver_spec.rb +30 -1
- data/spec/graphql/schema_spec.rb +135 -0
- data/spec/graphql/static_validation/rules/required_arguments_are_present_spec.rb +25 -0
- data/spec/integration/rails/generators/graphql/install_generator_spec.rb +20 -0
- data/spec/integration/tmp/app/graphql/types/page_type.rb +5 -0
- data/spec/support/dummy/schema.rb +1 -1
- data/spec/support/lazy_helpers.rb +1 -1
- data/spec/support/parser/filename_example_invalid_utf8.graphql +1 -0
- metadata +10 -132
- data/spec/integration/tmp/app/graphql/types/date_type.rb +0 -14
- data/spec/integration/tmp/dummy/Gemfile +0 -50
- data/spec/integration/tmp/dummy/README.md +0 -24
- data/spec/integration/tmp/dummy/Rakefile +0 -6
- data/spec/integration/tmp/dummy/app/assets/config/manifest.js +0 -3
- data/spec/integration/tmp/dummy/app/assets/javascripts/application.js +0 -16
- data/spec/integration/tmp/dummy/app/assets/javascripts/cable.js +0 -13
- data/spec/integration/tmp/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/integration/tmp/dummy/app/channels/application_cable/channel.rb +0 -5
- data/spec/integration/tmp/dummy/app/channels/application_cable/connection.rb +0 -5
- data/spec/integration/tmp/dummy/app/controllers/application_controller.rb +0 -4
- data/spec/integration/tmp/dummy/app/controllers/graphql_controller.rb +0 -44
- data/spec/integration/tmp/dummy/app/helpers/application_helper.rb +0 -3
- data/spec/integration/tmp/dummy/app/jobs/application_job.rb +0 -3
- data/spec/integration/tmp/dummy/app/mailers/application_mailer.rb +0 -5
- data/spec/integration/tmp/dummy/app/mydirectory/dummy_schema.rb +0 -5
- data/spec/integration/tmp/dummy/app/mydirectory/mutations/update_name.rb +0 -15
- data/spec/integration/tmp/dummy/app/mydirectory/types/base_enum.rb +0 -5
- data/spec/integration/tmp/dummy/app/mydirectory/types/base_input_object.rb +0 -5
- data/spec/integration/tmp/dummy/app/mydirectory/types/base_interface.rb +0 -6
- data/spec/integration/tmp/dummy/app/mydirectory/types/base_object.rb +0 -5
- data/spec/integration/tmp/dummy/app/mydirectory/types/base_scalar.rb +0 -5
- data/spec/integration/tmp/dummy/app/mydirectory/types/base_union.rb +0 -5
- data/spec/integration/tmp/dummy/app/mydirectory/types/mutation_type.rb +0 -12
- data/spec/integration/tmp/dummy/app/mydirectory/types/query_type.rb +0 -14
- data/spec/integration/tmp/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/integration/tmp/dummy/app/views/layouts/mailer.html.erb +0 -13
- data/spec/integration/tmp/dummy/app/views/layouts/mailer.text.erb +0 -1
- data/spec/integration/tmp/dummy/bin/bundle +0 -3
- data/spec/integration/tmp/dummy/bin/rails +0 -4
- data/spec/integration/tmp/dummy/bin/rake +0 -4
- data/spec/integration/tmp/dummy/bin/setup +0 -34
- data/spec/integration/tmp/dummy/bin/update +0 -29
- data/spec/integration/tmp/dummy/config.ru +0 -5
- data/spec/integration/tmp/dummy/config/application.rb +0 -26
- data/spec/integration/tmp/dummy/config/boot.rb +0 -4
- data/spec/integration/tmp/dummy/config/cable.yml +0 -9
- data/spec/integration/tmp/dummy/config/environment.rb +0 -6
- data/spec/integration/tmp/dummy/config/environments/development.rb +0 -52
- data/spec/integration/tmp/dummy/config/environments/production.rb +0 -84
- data/spec/integration/tmp/dummy/config/environments/test.rb +0 -43
- data/spec/integration/tmp/dummy/config/initializers/application_controller_renderer.rb +0 -9
- data/spec/integration/tmp/dummy/config/initializers/assets.rb +0 -12
- data/spec/integration/tmp/dummy/config/initializers/backtrace_silencers.rb +0 -8
- data/spec/integration/tmp/dummy/config/initializers/cookies_serializer.rb +0 -6
- data/spec/integration/tmp/dummy/config/initializers/filter_parameter_logging.rb +0 -5
- data/spec/integration/tmp/dummy/config/initializers/inflections.rb +0 -17
- data/spec/integration/tmp/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/integration/tmp/dummy/config/initializers/new_framework_defaults.rb +0 -24
- data/spec/integration/tmp/dummy/config/initializers/session_store.rb +0 -4
- data/spec/integration/tmp/dummy/config/initializers/wrap_parameters.rb +0 -10
- data/spec/integration/tmp/dummy/config/locales/en.yml +0 -23
- data/spec/integration/tmp/dummy/config/puma.rb +0 -48
- data/spec/integration/tmp/dummy/config/routes.rb +0 -9
- data/spec/integration/tmp/dummy/config/secrets.yml +0 -22
- data/spec/integration/tmp/dummy/db/seeds.rb +0 -8
- data/spec/integration/tmp/dummy/log/test.log +0 -0
- data/spec/integration/tmp/dummy/public/404.html +0 -67
- data/spec/integration/tmp/dummy/public/422.html +0 -67
- data/spec/integration/tmp/dummy/public/500.html +0 -66
- data/spec/integration/tmp/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/integration/tmp/dummy/public/apple-touch-icon.png +0 -0
- data/spec/integration/tmp/dummy/public/favicon.ico +0 -0
- data/spec/integration/tmp/dummy/public/robots.txt +0 -5
- data/spec/integration/tmp/dummy/test/test_helper.rb +0 -8
|
@@ -312,4 +312,25 @@ describe GraphQL::Schema::Object do
|
|
|
312
312
|
assert_equal({"data" => skip_value }, res.to_h)
|
|
313
313
|
end
|
|
314
314
|
end
|
|
315
|
+
|
|
316
|
+
describe "when fields conflict with built-ins" do
|
|
317
|
+
it "warns when no override" do
|
|
318
|
+
expected_warning = "X's `field :method` conflicts with a built-in method, use `resolver_method:` to pick a different resolver method for this field (for example, `resolver_method: :resolve_method` and `def resolve_method`)\n"
|
|
319
|
+
assert_output "", expected_warning do
|
|
320
|
+
Class.new(GraphQL::Schema::Object) do
|
|
321
|
+
graphql_name "X"
|
|
322
|
+
field :method, String, null: true
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
it "doesn't warn with an override" do
|
|
328
|
+
assert_output "", "" do
|
|
329
|
+
Class.new(GraphQL::Schema::Object) do
|
|
330
|
+
graphql_name "X"
|
|
331
|
+
field :method, String, null: true, resolver_method: :resolve_method
|
|
332
|
+
end
|
|
333
|
+
end
|
|
334
|
+
end
|
|
335
|
+
end
|
|
315
336
|
end
|
|
@@ -186,12 +186,20 @@ describe GraphQL::Schema::Resolver do
|
|
|
186
186
|
class IntegerWrapper < GraphQL::Schema::Object
|
|
187
187
|
implements HasValue
|
|
188
188
|
field :value, Integer, null: false, method: :itself
|
|
189
|
+
|
|
190
|
+
def self.authorized?(value, ctx)
|
|
191
|
+
if ctx[:max_value] && value > ctx[:max_value]
|
|
192
|
+
false
|
|
193
|
+
else
|
|
194
|
+
true
|
|
195
|
+
end
|
|
196
|
+
end
|
|
189
197
|
end
|
|
190
198
|
|
|
191
199
|
class PrepResolver9 < BaseResolver
|
|
192
200
|
argument :int_id, ID, required: true, loads: HasValue
|
|
193
201
|
# Make sure the lazy object is resolved properly:
|
|
194
|
-
type HasValue, null:
|
|
202
|
+
type HasValue, null: true
|
|
195
203
|
def object_from_id(type, id, ctx)
|
|
196
204
|
# Make sure a lazy object is handled appropriately
|
|
197
205
|
LazyBlock.new {
|
|
@@ -555,6 +563,11 @@ describe GraphQL::Schema::Resolver do
|
|
|
555
563
|
refute res.key?("errors"), "#{description}: silent auth failure (no top-level error)"
|
|
556
564
|
end
|
|
557
565
|
|
|
566
|
+
it "keeps track of the `loads:` option" do
|
|
567
|
+
arg = ResolverTest::MutationWithNullableLoadsArgument.arguments["labelId"]
|
|
568
|
+
assert_equal ResolverTest::HasValue, arg.loads
|
|
569
|
+
end
|
|
570
|
+
|
|
558
571
|
describe "ready?" do
|
|
559
572
|
it "can raise errors" do
|
|
560
573
|
res = exec_query("{ int: prepResolver5(int: 5) }")
|
|
@@ -657,6 +670,22 @@ describe GraphQL::Schema::Resolver do
|
|
|
657
670
|
res = exec_query("{ prepResolver14(input: {}) { number } }")
|
|
658
671
|
assert_equal 1, res["data"]["prepResolver14"]["number"]
|
|
659
672
|
end
|
|
673
|
+
|
|
674
|
+
it "uses loaded objects" do
|
|
675
|
+
query_str = "{ prepResolver9(intId: 9) { value } }"
|
|
676
|
+
# This will cause an unauthorized response
|
|
677
|
+
# by `HasValue.authorized?`
|
|
678
|
+
context = { max_value: 8 }
|
|
679
|
+
res = exec_query(query_str, context: context)
|
|
680
|
+
assert_nil res["data"]["prepResolver9"]
|
|
681
|
+
# This is OK
|
|
682
|
+
context = { max_value: 900 }
|
|
683
|
+
res = exec_query(query_str, context: context)
|
|
684
|
+
assert_equal 51, res["data"]["prepResolver9"]["value"]
|
|
685
|
+
# This is the transformation applied by the resolver,
|
|
686
|
+
# just make sure it matches the response
|
|
687
|
+
assert_equal 51, (9 + "HasValue".size) * 3
|
|
688
|
+
end
|
|
660
689
|
end
|
|
661
690
|
end
|
|
662
691
|
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require "spec_helper"
|
|
3
|
+
|
|
4
|
+
describe GraphQL::Schema do
|
|
5
|
+
describe "inheritance" do
|
|
6
|
+
class DummyFeature1 < GraphQL::Schema::Directive::Feature
|
|
7
|
+
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
class DummyFeature2 < GraphQL::Schema::Directive::Feature
|
|
11
|
+
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
let(:base_schema) do
|
|
15
|
+
Class.new(GraphQL::Schema) do
|
|
16
|
+
query GraphQL::Schema::Object
|
|
17
|
+
mutation GraphQL::Schema::Object
|
|
18
|
+
subscription GraphQL::Schema::Object
|
|
19
|
+
max_complexity 1
|
|
20
|
+
max_depth 2
|
|
21
|
+
default_max_page_size 3
|
|
22
|
+
error_bubbling false
|
|
23
|
+
disable_introspection_entry_points
|
|
24
|
+
orphan_types Jazz::Ensemble
|
|
25
|
+
introspection Module.new
|
|
26
|
+
cursor_encoder Object.new
|
|
27
|
+
query_execution_strategy Object.new
|
|
28
|
+
mutation_execution_strategy Object.new
|
|
29
|
+
subscription_execution_strategy Object.new
|
|
30
|
+
context_class Class.new
|
|
31
|
+
directives [DummyFeature1]
|
|
32
|
+
tracer GraphQL::Tracing::DataDogTracing
|
|
33
|
+
query_analyzer Object.new
|
|
34
|
+
multiplex_analyzer Object.new
|
|
35
|
+
rescue_from(StandardError) { }
|
|
36
|
+
instrument :field, GraphQL::Relay::EdgesInstrumentation
|
|
37
|
+
middleware (Proc.new {})
|
|
38
|
+
use GraphQL::Backtrace
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "inherits configuration from its superclass" do
|
|
43
|
+
schema = Class.new(base_schema)
|
|
44
|
+
assert_equal base_schema.query, schema.query
|
|
45
|
+
assert_equal base_schema.mutation, schema.mutation
|
|
46
|
+
assert_equal base_schema.subscription, schema.subscription
|
|
47
|
+
assert_equal base_schema.introspection, schema.introspection
|
|
48
|
+
assert_equal base_schema.cursor_encoder, schema.cursor_encoder
|
|
49
|
+
assert_equal base_schema.query_execution_strategy, schema.query_execution_strategy
|
|
50
|
+
assert_equal base_schema.mutation_execution_strategy, schema.mutation_execution_strategy
|
|
51
|
+
assert_equal base_schema.subscription_execution_strategy, schema.subscription_execution_strategy
|
|
52
|
+
assert_equal base_schema.max_complexity, schema.max_complexity
|
|
53
|
+
assert_equal base_schema.max_depth, schema.max_depth
|
|
54
|
+
assert_equal base_schema.default_max_page_size, schema.default_max_page_size
|
|
55
|
+
assert_equal base_schema.error_bubbling, schema.error_bubbling
|
|
56
|
+
assert_equal base_schema.orphan_types, schema.orphan_types
|
|
57
|
+
assert_equal base_schema.context_class, schema.context_class
|
|
58
|
+
assert_equal base_schema.directives, schema.directives
|
|
59
|
+
assert_equal base_schema.tracers, schema.tracers
|
|
60
|
+
assert_equal base_schema.query_analyzers, schema.query_analyzers
|
|
61
|
+
assert_equal base_schema.multiplex_analyzers, schema.multiplex_analyzers
|
|
62
|
+
assert_equal base_schema.rescues, schema.rescues
|
|
63
|
+
assert_equal base_schema.instrumenters, schema.instrumenters
|
|
64
|
+
assert_equal base_schema.middleware.steps.size, schema.middleware.steps.size
|
|
65
|
+
assert_equal base_schema.disable_introspection_entry_points?, schema.disable_introspection_entry_points?
|
|
66
|
+
assert_equal [GraphQL::Backtrace], schema.plugins.map(&:first)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it "can override configuration from its superclass" do
|
|
70
|
+
schema = Class.new(base_schema)
|
|
71
|
+
query = Class.new(GraphQL::Schema::Object) do
|
|
72
|
+
graphql_name 'Query'
|
|
73
|
+
end
|
|
74
|
+
schema.query(query)
|
|
75
|
+
mutation = Class.new(GraphQL::Schema::Object) do
|
|
76
|
+
graphql_name 'Mutation'
|
|
77
|
+
end
|
|
78
|
+
schema.mutation(mutation)
|
|
79
|
+
subscription = Class.new(GraphQL::Schema::Object) do
|
|
80
|
+
graphql_name 'Subscription'
|
|
81
|
+
end
|
|
82
|
+
schema.subscription(subscription)
|
|
83
|
+
introspection = Module.new
|
|
84
|
+
schema.introspection(introspection)
|
|
85
|
+
cursor_encoder = Object.new
|
|
86
|
+
schema.cursor_encoder(cursor_encoder)
|
|
87
|
+
query_execution_strategy = Object.new
|
|
88
|
+
schema.query_execution_strategy(query_execution_strategy)
|
|
89
|
+
mutation_execution_strategy = Object.new
|
|
90
|
+
schema.mutation_execution_strategy(mutation_execution_strategy)
|
|
91
|
+
subscription_execution_strategy = Object.new
|
|
92
|
+
schema.subscription_execution_strategy(subscription_execution_strategy)
|
|
93
|
+
context_class = Class.new
|
|
94
|
+
schema.context_class(context_class)
|
|
95
|
+
schema.max_complexity(10)
|
|
96
|
+
schema.max_depth(20)
|
|
97
|
+
schema.default_max_page_size(30)
|
|
98
|
+
schema.error_bubbling(true)
|
|
99
|
+
schema.orphan_types(Jazz::InstrumentType)
|
|
100
|
+
schema.directives([DummyFeature2])
|
|
101
|
+
query_analyzer = Object.new
|
|
102
|
+
schema.query_analyzer(query_analyzer)
|
|
103
|
+
multiplex_analyzer = Object.new
|
|
104
|
+
schema.multiplex_analyzer(multiplex_analyzer)
|
|
105
|
+
schema.use(GraphQL::Execution::Interpreter)
|
|
106
|
+
schema.instrument(:field, GraphQL::Relay::ConnectionInstrumentation)
|
|
107
|
+
schema.rescue_from(GraphQL::ExecutionError)
|
|
108
|
+
schema.tracer(GraphQL::Tracing::NewRelicTracing)
|
|
109
|
+
schema.middleware(Proc.new {})
|
|
110
|
+
|
|
111
|
+
assert_equal query.graphql_definition, schema.query
|
|
112
|
+
assert_equal mutation.graphql_definition, schema.mutation
|
|
113
|
+
assert_equal subscription.graphql_definition, schema.subscription
|
|
114
|
+
assert_equal introspection, schema.introspection
|
|
115
|
+
assert_equal cursor_encoder, schema.cursor_encoder
|
|
116
|
+
assert_equal query_execution_strategy, schema.query_execution_strategy
|
|
117
|
+
assert_equal mutation_execution_strategy, schema.mutation_execution_strategy
|
|
118
|
+
assert_equal subscription_execution_strategy, schema.subscription_execution_strategy
|
|
119
|
+
assert_equal context_class, schema.context_class
|
|
120
|
+
assert_equal 10, schema.max_complexity
|
|
121
|
+
assert_equal 20, schema.max_depth
|
|
122
|
+
assert_equal 30, schema.default_max_page_size
|
|
123
|
+
assert schema.error_bubbling
|
|
124
|
+
assert_equal [Jazz::Ensemble, Jazz::InstrumentType], schema.orphan_types
|
|
125
|
+
assert_equal schema.directives, GraphQL::Schema.default_directives.merge(DummyFeature1.graphql_name => DummyFeature1, DummyFeature2.graphql_name => DummyFeature2)
|
|
126
|
+
assert_equal base_schema.query_analyzers + [query_analyzer], schema.query_analyzers
|
|
127
|
+
assert_equal base_schema.multiplex_analyzers + [multiplex_analyzer], schema.multiplex_analyzers
|
|
128
|
+
assert_equal [GraphQL::Backtrace, GraphQL::Execution::Interpreter], schema.plugins.map(&:first)
|
|
129
|
+
assert_equal [GraphQL::Relay::EdgesInstrumentation, GraphQL::Relay::ConnectionInstrumentation], schema.instrumenters[:field]
|
|
130
|
+
assert_equal [GraphQL::ExecutionError, StandardError], schema.rescues.keys.sort_by(&:name)
|
|
131
|
+
assert_equal [GraphQL::Tracing::DataDogTracing, GraphQL::Tracing::NewRelicTracing], schema.tracers
|
|
132
|
+
assert_equal 3, schema.middleware.steps.size
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
@@ -70,4 +70,29 @@ describe GraphQL::StaticValidation::RequiredArgumentsArePresent do
|
|
|
70
70
|
assert_equal(expected_errors, errors)
|
|
71
71
|
end
|
|
72
72
|
end
|
|
73
|
+
|
|
74
|
+
describe "when a required arg is hidden" do
|
|
75
|
+
class Query < GraphQL::Schema::Object
|
|
76
|
+
field :int, Integer, null: true do
|
|
77
|
+
argument :input, Integer, required: true do
|
|
78
|
+
def visible?(*)
|
|
79
|
+
false
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def int(input: -1)
|
|
85
|
+
input
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
class HiddenArgSchema < GraphQL::Schema
|
|
90
|
+
query(Query)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it "Doesn't require a hidden input" do
|
|
94
|
+
res = HiddenArgSchema.execute("{ int }")
|
|
95
|
+
assert_equal -1, res["data"]["int"]
|
|
96
|
+
end
|
|
97
|
+
end
|
|
73
98
|
end
|
|
@@ -65,6 +65,26 @@ RUBY
|
|
|
65
65
|
|
|
66
66
|
assert_file "app/graphql/types/query_type.rb", expected_query_type
|
|
67
67
|
assert_file "app/controllers/graphql_controller.rb", EXPECTED_GRAPHQLS_CONTROLLER
|
|
68
|
+
expected_base_field = <<-RUBY
|
|
69
|
+
module Types
|
|
70
|
+
class BaseField < GraphQL::Schema::Field
|
|
71
|
+
argument_class Types::BaseArgument
|
|
72
|
+
|
|
73
|
+
def resolve_field(obj, args, ctx)
|
|
74
|
+
resolve(obj, args, ctx)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
RUBY
|
|
79
|
+
assert_file "app/graphql/types/base_field.rb", expected_base_field
|
|
80
|
+
|
|
81
|
+
expected_base_argument = <<-RUBY
|
|
82
|
+
module Types
|
|
83
|
+
class BaseArgument < GraphQL::Schema::Argument
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
RUBY
|
|
87
|
+
assert_file "app/graphql/types/base_argument.rb", expected_base_argument
|
|
68
88
|
end
|
|
69
89
|
|
|
70
90
|
test "it allows for a user-specified install directory" do
|
|
@@ -445,7 +445,7 @@ module Dummy
|
|
|
445
445
|
GLOBAL_VALUES = []
|
|
446
446
|
|
|
447
447
|
class ReplaceValuesInput < BaseInputObject
|
|
448
|
-
argument :values, [Integer], required: true
|
|
448
|
+
argument :values, [Integer], required: true, method_access: false
|
|
449
449
|
end
|
|
450
450
|
|
|
451
451
|
class DairyAppMutation < BaseObject
|
|
@@ -123,7 +123,7 @@ module LazyHelpers
|
|
|
123
123
|
end
|
|
124
124
|
|
|
125
125
|
field :list_sum, [LazySum, null: true], null: true do
|
|
126
|
-
argument :values, [Integer], required: true
|
|
126
|
+
argument :values, [Integer], required: true, method_access: false
|
|
127
127
|
end
|
|
128
128
|
def list_sum(values:)
|
|
129
129
|
values.map { |v| v == MAGIC_NUMBER_THAT_RETURNS_NIL ? nil : v }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"�"
|
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.9.
|
|
4
|
+
version: 1.9.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robert Mosolgo
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-07-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: benchmark-ips
|
|
@@ -335,6 +335,7 @@ files:
|
|
|
335
335
|
- lib/generators/graphql/mutation_generator.rb
|
|
336
336
|
- lib/generators/graphql/object_generator.rb
|
|
337
337
|
- lib/generators/graphql/scalar_generator.rb
|
|
338
|
+
- lib/generators/graphql/templates/base_argument.erb
|
|
338
339
|
- lib/generators/graphql/templates/base_enum.erb
|
|
339
340
|
- lib/generators/graphql/templates/base_field.erb
|
|
340
341
|
- lib/generators/graphql/templates/base_input_object.erb
|
|
@@ -546,6 +547,7 @@ files:
|
|
|
546
547
|
- lib/graphql/schema/field/connection_extension.rb
|
|
547
548
|
- lib/graphql/schema/field/scope_extension.rb
|
|
548
549
|
- lib/graphql/schema/field_extension.rb
|
|
550
|
+
- lib/graphql/schema/find_inherited_value.rb
|
|
549
551
|
- lib/graphql/schema/finder.rb
|
|
550
552
|
- lib/graphql/schema/input_object.rb
|
|
551
553
|
- lib/graphql/schema/interface.rb
|
|
@@ -906,6 +908,7 @@ files:
|
|
|
906
908
|
- spec/graphql/schema/unique_within_type_spec.rb
|
|
907
909
|
- spec/graphql/schema/validation_spec.rb
|
|
908
910
|
- spec/graphql/schema/warden_spec.rb
|
|
911
|
+
- spec/graphql/schema_spec.rb
|
|
909
912
|
- spec/graphql/static_validation/rules/argument_literals_are_compatible_spec.rb
|
|
910
913
|
- spec/graphql/static_validation/rules/argument_names_are_unique_spec.rb
|
|
911
914
|
- spec/graphql/static_validation/rules/arguments_are_defined_spec.rb
|
|
@@ -981,71 +984,7 @@ files:
|
|
|
981
984
|
- spec/integration/rails/graphql/schema_spec.rb
|
|
982
985
|
- spec/integration/rails/graphql/tracing/active_support_notifications_tracing_spec.rb
|
|
983
986
|
- spec/integration/rails/spec_helper.rb
|
|
984
|
-
- spec/integration/tmp/app/graphql/types/
|
|
985
|
-
- spec/integration/tmp/dummy/Gemfile
|
|
986
|
-
- spec/integration/tmp/dummy/README.md
|
|
987
|
-
- spec/integration/tmp/dummy/Rakefile
|
|
988
|
-
- spec/integration/tmp/dummy/app/assets/config/manifest.js
|
|
989
|
-
- spec/integration/tmp/dummy/app/assets/javascripts/application.js
|
|
990
|
-
- spec/integration/tmp/dummy/app/assets/javascripts/cable.js
|
|
991
|
-
- spec/integration/tmp/dummy/app/assets/stylesheets/application.css
|
|
992
|
-
- spec/integration/tmp/dummy/app/channels/application_cable/channel.rb
|
|
993
|
-
- spec/integration/tmp/dummy/app/channels/application_cable/connection.rb
|
|
994
|
-
- spec/integration/tmp/dummy/app/controllers/application_controller.rb
|
|
995
|
-
- spec/integration/tmp/dummy/app/controllers/graphql_controller.rb
|
|
996
|
-
- spec/integration/tmp/dummy/app/helpers/application_helper.rb
|
|
997
|
-
- spec/integration/tmp/dummy/app/jobs/application_job.rb
|
|
998
|
-
- spec/integration/tmp/dummy/app/mailers/application_mailer.rb
|
|
999
|
-
- spec/integration/tmp/dummy/app/mydirectory/dummy_schema.rb
|
|
1000
|
-
- spec/integration/tmp/dummy/app/mydirectory/mutations/update_name.rb
|
|
1001
|
-
- spec/integration/tmp/dummy/app/mydirectory/types/base_enum.rb
|
|
1002
|
-
- spec/integration/tmp/dummy/app/mydirectory/types/base_input_object.rb
|
|
1003
|
-
- spec/integration/tmp/dummy/app/mydirectory/types/base_interface.rb
|
|
1004
|
-
- spec/integration/tmp/dummy/app/mydirectory/types/base_object.rb
|
|
1005
|
-
- spec/integration/tmp/dummy/app/mydirectory/types/base_scalar.rb
|
|
1006
|
-
- spec/integration/tmp/dummy/app/mydirectory/types/base_union.rb
|
|
1007
|
-
- spec/integration/tmp/dummy/app/mydirectory/types/mutation_type.rb
|
|
1008
|
-
- spec/integration/tmp/dummy/app/mydirectory/types/query_type.rb
|
|
1009
|
-
- spec/integration/tmp/dummy/app/views/layouts/application.html.erb
|
|
1010
|
-
- spec/integration/tmp/dummy/app/views/layouts/mailer.html.erb
|
|
1011
|
-
- spec/integration/tmp/dummy/app/views/layouts/mailer.text.erb
|
|
1012
|
-
- spec/integration/tmp/dummy/bin/bundle
|
|
1013
|
-
- spec/integration/tmp/dummy/bin/rails
|
|
1014
|
-
- spec/integration/tmp/dummy/bin/rake
|
|
1015
|
-
- spec/integration/tmp/dummy/bin/setup
|
|
1016
|
-
- spec/integration/tmp/dummy/bin/update
|
|
1017
|
-
- spec/integration/tmp/dummy/config.ru
|
|
1018
|
-
- spec/integration/tmp/dummy/config/application.rb
|
|
1019
|
-
- spec/integration/tmp/dummy/config/boot.rb
|
|
1020
|
-
- spec/integration/tmp/dummy/config/cable.yml
|
|
1021
|
-
- spec/integration/tmp/dummy/config/environment.rb
|
|
1022
|
-
- spec/integration/tmp/dummy/config/environments/development.rb
|
|
1023
|
-
- spec/integration/tmp/dummy/config/environments/production.rb
|
|
1024
|
-
- spec/integration/tmp/dummy/config/environments/test.rb
|
|
1025
|
-
- spec/integration/tmp/dummy/config/initializers/application_controller_renderer.rb
|
|
1026
|
-
- spec/integration/tmp/dummy/config/initializers/assets.rb
|
|
1027
|
-
- spec/integration/tmp/dummy/config/initializers/backtrace_silencers.rb
|
|
1028
|
-
- spec/integration/tmp/dummy/config/initializers/cookies_serializer.rb
|
|
1029
|
-
- spec/integration/tmp/dummy/config/initializers/filter_parameter_logging.rb
|
|
1030
|
-
- spec/integration/tmp/dummy/config/initializers/inflections.rb
|
|
1031
|
-
- spec/integration/tmp/dummy/config/initializers/mime_types.rb
|
|
1032
|
-
- spec/integration/tmp/dummy/config/initializers/new_framework_defaults.rb
|
|
1033
|
-
- spec/integration/tmp/dummy/config/initializers/session_store.rb
|
|
1034
|
-
- spec/integration/tmp/dummy/config/initializers/wrap_parameters.rb
|
|
1035
|
-
- spec/integration/tmp/dummy/config/locales/en.yml
|
|
1036
|
-
- spec/integration/tmp/dummy/config/puma.rb
|
|
1037
|
-
- spec/integration/tmp/dummy/config/routes.rb
|
|
1038
|
-
- spec/integration/tmp/dummy/config/secrets.yml
|
|
1039
|
-
- spec/integration/tmp/dummy/db/seeds.rb
|
|
1040
|
-
- spec/integration/tmp/dummy/log/test.log
|
|
1041
|
-
- spec/integration/tmp/dummy/public/404.html
|
|
1042
|
-
- spec/integration/tmp/dummy/public/422.html
|
|
1043
|
-
- spec/integration/tmp/dummy/public/500.html
|
|
1044
|
-
- spec/integration/tmp/dummy/public/apple-touch-icon-precomposed.png
|
|
1045
|
-
- spec/integration/tmp/dummy/public/apple-touch-icon.png
|
|
1046
|
-
- spec/integration/tmp/dummy/public/favicon.ico
|
|
1047
|
-
- spec/integration/tmp/dummy/public/robots.txt
|
|
1048
|
-
- spec/integration/tmp/dummy/test/test_helper.rb
|
|
987
|
+
- spec/integration/tmp/app/graphql/types/page_type.rb
|
|
1049
988
|
- spec/spec_helper.rb
|
|
1050
989
|
- spec/support/dummy/data.rb
|
|
1051
990
|
- spec/support/dummy/schema.rb
|
|
@@ -1059,6 +998,7 @@ files:
|
|
|
1059
998
|
- spec/support/parser/filename_example.graphql
|
|
1060
999
|
- spec/support/parser/filename_example_error_1.graphql
|
|
1061
1000
|
- spec/support/parser/filename_example_error_2.graphql
|
|
1001
|
+
- spec/support/parser/filename_example_invalid_utf8.graphql
|
|
1062
1002
|
- spec/support/skylight.rb
|
|
1063
1003
|
- spec/support/star_wars/schema.rb
|
|
1064
1004
|
- spec/support/static_validation_helpers.rb
|
|
@@ -1168,71 +1108,7 @@ test_files:
|
|
|
1168
1108
|
- spec/integration/mongoid/star_trek/schema.rb
|
|
1169
1109
|
- spec/integration/mongoid/star_trek/data.rb
|
|
1170
1110
|
- spec/integration/mongoid/graphql/relay/mongo_relation_connection_spec.rb
|
|
1171
|
-
- spec/integration/tmp/
|
|
1172
|
-
- spec/integration/tmp/dummy/app/mydirectory/types/base_enum.rb
|
|
1173
|
-
- spec/integration/tmp/dummy/app/mydirectory/types/base_interface.rb
|
|
1174
|
-
- spec/integration/tmp/dummy/app/mydirectory/types/base_scalar.rb
|
|
1175
|
-
- spec/integration/tmp/dummy/app/mydirectory/types/mutation_type.rb
|
|
1176
|
-
- spec/integration/tmp/dummy/app/mydirectory/types/query_type.rb
|
|
1177
|
-
- spec/integration/tmp/dummy/app/mydirectory/types/base_object.rb
|
|
1178
|
-
- spec/integration/tmp/dummy/app/mydirectory/types/base_union.rb
|
|
1179
|
-
- spec/integration/tmp/dummy/app/mydirectory/mutations/update_name.rb
|
|
1180
|
-
- spec/integration/tmp/dummy/app/mydirectory/dummy_schema.rb
|
|
1181
|
-
- spec/integration/tmp/dummy/app/mailers/application_mailer.rb
|
|
1182
|
-
- spec/integration/tmp/dummy/app/jobs/application_job.rb
|
|
1183
|
-
- spec/integration/tmp/dummy/app/controllers/application_controller.rb
|
|
1184
|
-
- spec/integration/tmp/dummy/app/controllers/graphql_controller.rb
|
|
1185
|
-
- spec/integration/tmp/dummy/app/views/layouts/application.html.erb
|
|
1186
|
-
- spec/integration/tmp/dummy/app/views/layouts/mailer.html.erb
|
|
1187
|
-
- spec/integration/tmp/dummy/app/views/layouts/mailer.text.erb
|
|
1188
|
-
- spec/integration/tmp/dummy/app/assets/config/manifest.js
|
|
1189
|
-
- spec/integration/tmp/dummy/app/assets/javascripts/cable.js
|
|
1190
|
-
- spec/integration/tmp/dummy/app/assets/javascripts/application.js
|
|
1191
|
-
- spec/integration/tmp/dummy/app/assets/stylesheets/application.css
|
|
1192
|
-
- spec/integration/tmp/dummy/app/helpers/application_helper.rb
|
|
1193
|
-
- spec/integration/tmp/dummy/app/channels/application_cable/connection.rb
|
|
1194
|
-
- spec/integration/tmp/dummy/app/channels/application_cable/channel.rb
|
|
1195
|
-
- spec/integration/tmp/dummy/test/test_helper.rb
|
|
1196
|
-
- spec/integration/tmp/dummy/bin/update
|
|
1197
|
-
- spec/integration/tmp/dummy/bin/rake
|
|
1198
|
-
- spec/integration/tmp/dummy/bin/setup
|
|
1199
|
-
- spec/integration/tmp/dummy/bin/bundle
|
|
1200
|
-
- spec/integration/tmp/dummy/bin/rails
|
|
1201
|
-
- spec/integration/tmp/dummy/config/secrets.yml
|
|
1202
|
-
- spec/integration/tmp/dummy/config/routes.rb
|
|
1203
|
-
- spec/integration/tmp/dummy/config/locales/en.yml
|
|
1204
|
-
- spec/integration/tmp/dummy/config/cable.yml
|
|
1205
|
-
- spec/integration/tmp/dummy/config/environments/production.rb
|
|
1206
|
-
- spec/integration/tmp/dummy/config/environments/development.rb
|
|
1207
|
-
- spec/integration/tmp/dummy/config/environments/test.rb
|
|
1208
|
-
- spec/integration/tmp/dummy/config/environment.rb
|
|
1209
|
-
- spec/integration/tmp/dummy/config/application.rb
|
|
1210
|
-
- spec/integration/tmp/dummy/config/puma.rb
|
|
1211
|
-
- spec/integration/tmp/dummy/config/boot.rb
|
|
1212
|
-
- spec/integration/tmp/dummy/config/initializers/application_controller_renderer.rb
|
|
1213
|
-
- spec/integration/tmp/dummy/config/initializers/backtrace_silencers.rb
|
|
1214
|
-
- spec/integration/tmp/dummy/config/initializers/mime_types.rb
|
|
1215
|
-
- spec/integration/tmp/dummy/config/initializers/filter_parameter_logging.rb
|
|
1216
|
-
- spec/integration/tmp/dummy/config/initializers/session_store.rb
|
|
1217
|
-
- spec/integration/tmp/dummy/config/initializers/wrap_parameters.rb
|
|
1218
|
-
- spec/integration/tmp/dummy/config/initializers/new_framework_defaults.rb
|
|
1219
|
-
- spec/integration/tmp/dummy/config/initializers/assets.rb
|
|
1220
|
-
- spec/integration/tmp/dummy/config/initializers/cookies_serializer.rb
|
|
1221
|
-
- spec/integration/tmp/dummy/config/initializers/inflections.rb
|
|
1222
|
-
- spec/integration/tmp/dummy/config.ru
|
|
1223
|
-
- spec/integration/tmp/dummy/README.md
|
|
1224
|
-
- spec/integration/tmp/dummy/Rakefile
|
|
1225
|
-
- spec/integration/tmp/dummy/public/favicon.ico
|
|
1226
|
-
- spec/integration/tmp/dummy/public/422.html
|
|
1227
|
-
- spec/integration/tmp/dummy/public/apple-touch-icon.png
|
|
1228
|
-
- spec/integration/tmp/dummy/public/500.html
|
|
1229
|
-
- spec/integration/tmp/dummy/public/404.html
|
|
1230
|
-
- spec/integration/tmp/dummy/public/apple-touch-icon-precomposed.png
|
|
1231
|
-
- spec/integration/tmp/dummy/public/robots.txt
|
|
1232
|
-
- spec/integration/tmp/dummy/db/seeds.rb
|
|
1233
|
-
- spec/integration/tmp/dummy/Gemfile
|
|
1234
|
-
- spec/integration/tmp/dummy/log/test.log
|
|
1235
|
-
- spec/integration/tmp/app/graphql/types/date_type.rb
|
|
1111
|
+
- spec/integration/tmp/app/graphql/types/page_type.rb
|
|
1236
1112
|
- spec/integration/rails/spec_helper.rb
|
|
1237
1113
|
- spec/integration/rails/data.rb
|
|
1238
1114
|
- spec/integration/rails/graphql/tracing/active_support_notifications_tracing_spec.rb
|
|
@@ -1268,6 +1144,7 @@ test_files:
|
|
|
1268
1144
|
- spec/support/error_bubbling_helpers.rb
|
|
1269
1145
|
- spec/support/new_relic.rb
|
|
1270
1146
|
- spec/support/parser/filename_example_error_1.graphql
|
|
1147
|
+
- spec/support/parser/filename_example_invalid_utf8.graphql
|
|
1271
1148
|
- spec/support/parser/filename_example_error_2.graphql
|
|
1272
1149
|
- spec/support/parser/filename_example.graphql
|
|
1273
1150
|
- spec/support/lazy_helpers.rb
|
|
@@ -1425,6 +1302,7 @@ test_files:
|
|
|
1425
1302
|
- spec/graphql/query/executor_spec.rb
|
|
1426
1303
|
- spec/graphql/query/arguments_spec.rb
|
|
1427
1304
|
- spec/graphql/string_type_spec.rb
|
|
1305
|
+
- spec/graphql/schema_spec.rb
|
|
1428
1306
|
- spec/graphql/enum_type_spec.rb
|
|
1429
1307
|
- spec/graphql/subscriptions_spec.rb
|
|
1430
1308
|
- spec/graphql/id_type_spec.rb
|