graphql 1.5.11 → 1.5.12
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/graphql/internal_representation/node.rb +2 -2
- data/lib/graphql/relay/connection_resolve.rb +4 -1
- data/lib/graphql/version.rb +1 -1
- data/spec/graphql/internal_representation/rewrite_spec.rb +38 -1
- data/spec/graphql/relay/connection_resolve_spec.rb +22 -14
- data/spec/support/star_wars/schema.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e204a82f5db905b17eeaa50f14e7b2af0ddff12
|
4
|
+
data.tar.gz: 6c7029686c56fb6ad2ef90084381131f1f06a68c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4de6aa1e85f4e2b51ae00866c00fd3ef0b201059ccb6a28a74a97cfe1528b1739086585db4488911893a781b8a0857fd318175e95fd135e91e5cb091cfc55d6
|
7
|
+
data.tar.gz: 59ef188909e4f03b6793cf00c935e05bc4fd45f91e1910b068529a4661e7261d778c7e3d78b5b55cd563cc5e23fe5be8cb1a989a56180dff4df48380c3aea286
|
@@ -116,8 +116,8 @@ module GraphQL
|
|
116
116
|
# Selections are merged in place, not copied.
|
117
117
|
def deep_merge_node(new_parent, scope: nil, merge_self: true)
|
118
118
|
if merge_self
|
119
|
-
@ast_nodes
|
120
|
-
@definitions
|
119
|
+
@ast_nodes |= new_parent.ast_nodes
|
120
|
+
@definitions |= new_parent.definitions
|
121
121
|
end
|
122
122
|
scope ||= Scope.new(@query, @return_type)
|
123
123
|
new_parent.scoped_children.each do |obj_type, new_fields|
|
data/lib/graphql/version.rb
CHANGED
@@ -6,6 +6,7 @@ describe GraphQL::InternalRepresentation::Rewrite do
|
|
6
6
|
GraphQL::Schema.from_definition <<-GRAPHQL
|
7
7
|
type Query {
|
8
8
|
plant(id: ID!): Plant
|
9
|
+
fruit(id: ID!): [Fruit!]
|
9
10
|
}
|
10
11
|
|
11
12
|
union Plant = Grain | Fruit | Vegetable | Nut
|
@@ -44,7 +45,11 @@ describe GraphQL::InternalRepresentation::Rewrite do
|
|
44
45
|
habitats: [Habitat]
|
45
46
|
}
|
46
47
|
|
47
|
-
|
48
|
+
interface Environ {
|
49
|
+
seasons: [String]
|
50
|
+
}
|
51
|
+
|
52
|
+
type Habitat implements Environ {
|
48
53
|
residentName: String!
|
49
54
|
averageWeight: Int!
|
50
55
|
seasons: [String]
|
@@ -287,6 +292,38 @@ describe GraphQL::InternalRepresentation::Rewrite do
|
|
287
292
|
end
|
288
293
|
end
|
289
294
|
|
295
|
+
describe "fragment merging bug" do
|
296
|
+
let(:query_string) {
|
297
|
+
<<-GRAPHQL
|
298
|
+
{
|
299
|
+
...Frag1
|
300
|
+
__type(name: "Query") {
|
301
|
+
...Frag2
|
302
|
+
}
|
303
|
+
}
|
304
|
+
|
305
|
+
fragment Frag1 on Query {
|
306
|
+
__type(name: "Query") {
|
307
|
+
...Frag2
|
308
|
+
}
|
309
|
+
}
|
310
|
+
|
311
|
+
fragment Frag2 on __Type {
|
312
|
+
__typename
|
313
|
+
}
|
314
|
+
GRAPHQL
|
315
|
+
}
|
316
|
+
|
317
|
+
it "finishes" do
|
318
|
+
doc = rewrite_result.operation_definitions[nil]
|
319
|
+
type_node = doc.typed_children[schema.types["Query"]]["__type"]
|
320
|
+
typename_node = type_node.typed_children[schema.types["__Type"]]["__typename"]
|
321
|
+
assert_equal 1, typename_node.ast_nodes.size
|
322
|
+
assert_equal 15, typename_node.ast_node.line
|
323
|
+
assert_equal 9, typename_node.ast_node.col
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
290
327
|
describe "fragment definition without query" do
|
291
328
|
let(:query_string) {
|
292
329
|
<<-GRAPHQL
|
@@ -2,44 +2,52 @@
|
|
2
2
|
require "spec_helper"
|
3
3
|
|
4
4
|
describe GraphQL::Relay::ConnectionResolve do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
name
|
13
|
-
}
|
5
|
+
let(:query_string) { <<-GRAPHQL
|
6
|
+
query getShips($name: String!){
|
7
|
+
rebels {
|
8
|
+
ships(nameIncludes: $name) {
|
9
|
+
edges {
|
10
|
+
node {
|
11
|
+
name
|
14
12
|
}
|
15
13
|
}
|
16
14
|
}
|
17
15
|
}
|
18
|
-
GRAPHQL
|
19
16
|
}
|
17
|
+
GRAPHQL
|
18
|
+
}
|
20
19
|
|
20
|
+
describe "when an execution error is returned" do
|
21
21
|
it "adds an error" do
|
22
|
-
result = star_wars_query(query_string, { "
|
22
|
+
result = star_wars_query(query_string, { "name" => "error"})
|
23
23
|
assert_equal 1, result["errors"].length
|
24
24
|
assert_equal "error from within connection", result["errors"][0]["message"]
|
25
25
|
end
|
26
26
|
|
27
27
|
it "adds an error for a lazy error" do
|
28
|
-
result = star_wars_query(query_string, { "
|
28
|
+
result = star_wars_query(query_string, { "name" => "lazyError"})
|
29
29
|
assert_equal 1, result["errors"].length
|
30
30
|
assert_equal "lazy error from within connection", result["errors"][0]["message"]
|
31
31
|
end
|
32
32
|
|
33
33
|
it "adds an error for a lazy raised error" do
|
34
|
-
result = star_wars_query(query_string, { "
|
34
|
+
result = star_wars_query(query_string, { "name" => "lazyRaisedError"})
|
35
35
|
assert_equal 1, result["errors"].length
|
36
36
|
assert_equal "lazy raised error from within connection", result["errors"][0]["message"]
|
37
37
|
end
|
38
38
|
|
39
39
|
it "adds an error for a raised error" do
|
40
|
-
result = star_wars_query(query_string, { "
|
40
|
+
result = star_wars_query(query_string, { "name" => "raisedError"})
|
41
41
|
assert_equal 1, result["errors"].length
|
42
42
|
assert_equal "error raised from within connection", result["errors"][0]["message"]
|
43
43
|
end
|
44
44
|
end
|
45
|
+
|
46
|
+
describe "when nil is returned" do
|
47
|
+
it "becomes null" do
|
48
|
+
result = star_wars_query(query_string, { "name" => "null" })
|
49
|
+
conn = result["data"]["rebels"]["ships"]
|
50
|
+
assert_equal nil, conn
|
51
|
+
end
|
52
|
+
end
|
45
53
|
end
|
@@ -102,6 +102,8 @@ module StarWars
|
|
102
102
|
all_ships = LazyWrapper.new { GraphQL::ExecutionError.new("lazy error from within connection") }
|
103
103
|
when "lazyRaisedError"
|
104
104
|
all_ships = LazyWrapper.new { raise GraphQL::ExecutionError.new("lazy raised error from within connection") }
|
105
|
+
when "null"
|
106
|
+
all_ships = nil
|
105
107
|
else
|
106
108
|
all_ships = all_ships.select { |ship| ship.name.include?(args[:nameIncludes])}
|
107
109
|
end
|
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.5.
|
4
|
+
version: 1.5.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|