graphql 1.8.0.pre4 → 1.8.0.pre5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphql/base_type.rb +10 -27
- data/lib/graphql/compatibility/query_parser_specification.rb +7 -0
- data/lib/graphql/field.rb +3 -3
- data/lib/graphql/internal_representation/node.rb +32 -13
- data/lib/graphql/internal_representation/visit.rb +3 -6
- data/lib/graphql/language.rb +1 -0
- data/lib/graphql/language/block_string.rb +47 -0
- data/lib/graphql/language/lexer.rb +129 -68
- data/lib/graphql/language/lexer.rl +13 -4
- data/lib/graphql/language/nodes.rb +6 -3
- data/lib/graphql/language/printer.rb +1 -1
- data/lib/graphql/language/token.rb +1 -1
- data/lib/graphql/query.rb +1 -1
- data/lib/graphql/relay.rb +1 -0
- data/lib/graphql/relay/connection_type.rb +5 -3
- data/lib/graphql/relay/edge_type.rb +2 -1
- data/lib/graphql/relay/type_extensions.rb +30 -0
- data/lib/graphql/schema.rb +25 -0
- data/lib/graphql/schema/build_from_definition.rb +2 -0
- data/lib/graphql/schema/field.rb +3 -0
- data/lib/graphql/schema/finder.rb +153 -0
- data/lib/graphql/schema/member.rb +3 -1
- data/lib/graphql/schema/printer.rb +1 -1
- data/lib/graphql/static_validation/rules/fields_will_merge.rb +15 -8
- data/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb +11 -1
- data/lib/graphql/tracing/data_dog_tracing.rb +13 -9
- data/lib/graphql/upgrader/member.rb +19 -8
- data/lib/graphql/version.rb +1 -1
- data/spec/graphql/backtrace_spec.rb +10 -0
- data/spec/graphql/directive_spec.rb +3 -1
- data/spec/graphql/language/block_string_spec.rb +70 -0
- data/spec/graphql/language/lexer_spec.rb +9 -0
- data/spec/graphql/query_spec.rb +1 -1
- data/spec/graphql/schema/field_spec.rb +8 -0
- data/spec/graphql/schema/finder_spec.rb +135 -0
- data/spec/graphql/schema/printer_spec.rb +48 -5
- data/spec/graphql/schema_spec.rb +7 -0
- data/spec/graphql/upgrader/member_spec.rb +25 -0
- metadata +23 -2
data/spec/graphql/schema_spec.rb
CHANGED
@@ -17,6 +17,13 @@ describe GraphQL::Schema do
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
describe "#find" do
|
21
|
+
it "finds a member using a string path" do
|
22
|
+
field = schema.find("Edible.fatContent")
|
23
|
+
assert_equal "fatContent", field.name
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
20
27
|
describe "#union_memberships" do
|
21
28
|
it "returns a list of unions that include the type" do
|
22
29
|
assert_equal [schema.types["Animal"], schema.types["AnimalAsCow"]], schema.union_memberships(schema.types["Cow"])
|
@@ -251,6 +251,31 @@ describe GraphQL::Upgrader::Member do
|
|
251
251
|
}
|
252
252
|
assert_equal new, upgrade(old)
|
253
253
|
end
|
254
|
+
|
255
|
+
it "fixes argument access: string -> sym, camel -> underscore" do
|
256
|
+
old = %{
|
257
|
+
field :firstName, !types.String do
|
258
|
+
argument :someArg, types.String, default_value: "abc"
|
259
|
+
argument :someArg2, types.String, default_value: "abc"
|
260
|
+
resolve ->(obj, args, ctx) {
|
261
|
+
args["someArg"] if args.key?("someArg")
|
262
|
+
args[:someArg2]
|
263
|
+
}
|
264
|
+
end
|
265
|
+
}
|
266
|
+
new = %{
|
267
|
+
field :first_name, String, null: false do
|
268
|
+
argument :some_arg, String, default_value: "abc", required: false
|
269
|
+
argument :some_arg2, String, default_value: "abc", required: false
|
270
|
+
end
|
271
|
+
|
272
|
+
def first_name(**args)
|
273
|
+
args[:some_arg] if args.key?(:some_arg)
|
274
|
+
args[:some_arg2]
|
275
|
+
end
|
276
|
+
}
|
277
|
+
assert_equal new, upgrade(old)
|
278
|
+
end
|
254
279
|
end
|
255
280
|
|
256
281
|
|
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.8.0.
|
4
|
+
version: 1.8.0.pre5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01
|
11
|
+
date: 2018-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 3.0.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: memory_profiler
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: minitest
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -428,6 +442,7 @@ files:
|
|
428
442
|
- lib/graphql/invalid_name_error.rb
|
429
443
|
- lib/graphql/invalid_null_error.rb
|
430
444
|
- lib/graphql/language.rb
|
445
|
+
- lib/graphql/language/block_string.rb
|
431
446
|
- lib/graphql/language/comments.rb
|
432
447
|
- lib/graphql/language/definition_slice.rb
|
433
448
|
- lib/graphql/language/document_from_schema_definition.rb
|
@@ -483,6 +498,7 @@ files:
|
|
483
498
|
- lib/graphql/relay/page_info.rb
|
484
499
|
- lib/graphql/relay/range_add.rb
|
485
500
|
- lib/graphql/relay/relation_connection.rb
|
501
|
+
- lib/graphql/relay/type_extensions.rb
|
486
502
|
- lib/graphql/runtime_type_error.rb
|
487
503
|
- lib/graphql/scalar_type.rb
|
488
504
|
- lib/graphql/schema.rb
|
@@ -498,6 +514,7 @@ files:
|
|
498
514
|
- lib/graphql/schema/field.rb
|
499
515
|
- lib/graphql/schema/field/dynamic_resolve.rb
|
500
516
|
- lib/graphql/schema/field/unwrapped_resolve.rb
|
517
|
+
- lib/graphql/schema/finder.rb
|
501
518
|
- lib/graphql/schema/input_object.rb
|
502
519
|
- lib/graphql/schema/interface.rb
|
503
520
|
- lib/graphql/schema/introspection_system.rb
|
@@ -937,6 +954,7 @@ files:
|
|
937
954
|
- spec/graphql/introspection/schema_type_spec.rb
|
938
955
|
- spec/graphql/introspection/type_by_name_field_spec.rb
|
939
956
|
- spec/graphql/introspection/type_type_spec.rb
|
957
|
+
- spec/graphql/language/block_string_spec.rb
|
940
958
|
- spec/graphql/language/definition_slice_spec.rb
|
941
959
|
- spec/graphql/language/document_from_schema_definition_spec.rb
|
942
960
|
- spec/graphql/language/equality_spec.rb
|
@@ -974,6 +992,7 @@ files:
|
|
974
992
|
- spec/graphql/schema/catchall_middleware_spec.rb
|
975
993
|
- spec/graphql/schema/enum_spec.rb
|
976
994
|
- spec/graphql/schema/field_spec.rb
|
995
|
+
- spec/graphql/schema/finder_spec.rb
|
977
996
|
- spec/graphql/schema/input_object_spec.rb
|
978
997
|
- spec/graphql/schema/instrumentation_spec.rb
|
979
998
|
- spec/graphql/schema/interface_spec.rb
|
@@ -1426,6 +1445,7 @@ test_files:
|
|
1426
1445
|
- spec/graphql/introspection/schema_type_spec.rb
|
1427
1446
|
- spec/graphql/introspection/type_by_name_field_spec.rb
|
1428
1447
|
- spec/graphql/introspection/type_type_spec.rb
|
1448
|
+
- spec/graphql/language/block_string_spec.rb
|
1429
1449
|
- spec/graphql/language/definition_slice_spec.rb
|
1430
1450
|
- spec/graphql/language/document_from_schema_definition_spec.rb
|
1431
1451
|
- spec/graphql/language/equality_spec.rb
|
@@ -1463,6 +1483,7 @@ test_files:
|
|
1463
1483
|
- spec/graphql/schema/catchall_middleware_spec.rb
|
1464
1484
|
- spec/graphql/schema/enum_spec.rb
|
1465
1485
|
- spec/graphql/schema/field_spec.rb
|
1486
|
+
- spec/graphql/schema/finder_spec.rb
|
1466
1487
|
- spec/graphql/schema/input_object_spec.rb
|
1467
1488
|
- spec/graphql/schema/instrumentation_spec.rb
|
1468
1489
|
- spec/graphql/schema/interface_spec.rb
|