graphql 0.16.0 → 0.16.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphql/internal_representation/definition.rb +0 -0
- data/lib/graphql/internal_representation/rewrite.rb +1 -0
- data/lib/graphql/version.rb +1 -1
- data/spec/graphql/analysis/query_complexity_spec.rb +1 -1
- data/spec/graphql/introspection/schema_type_spec.rb +1 -0
- data/spec/graphql/union_type_spec.rb +43 -0
- data/spec/support/dairy_app.rb +4 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e4d95f2f01d1d24633dc5b6c062a67e6a752379
|
4
|
+
data.tar.gz: 19634030a6f735243babd83be75d9279c2987795
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 189c9d0eacdc54969b15f412dbb968c3a1d9aadedd0ccd4e74cc3e9afaf1af33c83c0f4a9b911ed563a3fc9dc8f256c75d74d013832273038087ae38734abeb2
|
7
|
+
data.tar.gz: 675427c4e5233153a58f6ff3a2abbe754e9216261872d666301ceeeeb1919b8098c4b7bdf2ee8065ccb781d3ad35c6a2bfa7f1e0e5e719486176655831032efb
|
File without changes
|
@@ -167,6 +167,7 @@ module GraphQL
|
|
167
167
|
# Merge `node` into `parent_node`'s children, as `name`, applying `extra_directives`
|
168
168
|
def deep_merge_child(parent_node, name, node, extra_directives)
|
169
169
|
child_node = parent_node.children[name] ||= node.dup
|
170
|
+
child_node.on_types.merge(node.on_types)
|
170
171
|
node.children.each do |merge_child_name, merge_child_node|
|
171
172
|
deep_merge_child(child_node, merge_child_name, merge_child_node, [])
|
172
173
|
end
|
data/lib/graphql/version.rb
CHANGED
@@ -18,6 +18,7 @@ describe GraphQL::Introspection::SchemaType do
|
|
18
18
|
"types" => DummySchema.types.values.map { |t| t.name.nil? ? (p t; raise("no name for #{t}")) : {"name" => t.name} },
|
19
19
|
"queryType"=>{
|
20
20
|
"fields"=>[
|
21
|
+
{"name"=>"allDairy"},
|
21
22
|
{"name"=>"cheese"},
|
22
23
|
{"name"=>"cow"},
|
23
24
|
{"name"=>"dairy"},
|
@@ -28,4 +28,47 @@ describe GraphQL::UnionType do
|
|
28
28
|
it '#include? returns false if type is not in possible_types' do
|
29
29
|
assert_equal(false, union.include?(type_3))
|
30
30
|
end
|
31
|
+
|
32
|
+
describe "list of union type" do
|
33
|
+
describe "fragment spreads" do
|
34
|
+
let(:result) { DummySchema.execute(query_string) }
|
35
|
+
let(:query_string) {%|
|
36
|
+
{
|
37
|
+
allDairy {
|
38
|
+
__typename
|
39
|
+
... milkFields
|
40
|
+
... cheeseFields
|
41
|
+
}
|
42
|
+
}
|
43
|
+
fragment milkFields on Milk {
|
44
|
+
id
|
45
|
+
source
|
46
|
+
origin
|
47
|
+
flavors
|
48
|
+
}
|
49
|
+
|
50
|
+
fragment cheeseFields on Cheese {
|
51
|
+
id
|
52
|
+
source
|
53
|
+
origin
|
54
|
+
flavor
|
55
|
+
}
|
56
|
+
|}
|
57
|
+
|
58
|
+
it "resolves the right fragment on the right item" do
|
59
|
+
all_dairy = result["data"]["allDairy"]
|
60
|
+
cheeses = all_dairy.first(3)
|
61
|
+
cheeses.each do |cheese|
|
62
|
+
assert_equal "Cheese", cheese["__typename"]
|
63
|
+
assert_equal ["__typename", "id", "source", "origin", "flavor"], cheese.keys
|
64
|
+
end
|
65
|
+
|
66
|
+
milks = all_dairy.last(1)
|
67
|
+
milks.each do |milk|
|
68
|
+
assert_equal "Milk", milk["__typename"]
|
69
|
+
assert_equal ["__typename", "id", "source", "origin", "flavors"], milk.keys
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
31
74
|
end
|
data/spec/support/dairy_app.rb
CHANGED
@@ -241,6 +241,10 @@ QueryType = GraphQL::ObjectType.define do
|
|
241
241
|
}
|
242
242
|
end
|
243
243
|
|
244
|
+
field :allDairy, types[DairyProductUnion] do
|
245
|
+
resolve -> (obj, args, ctx) { CHEESES.values + MILKS.values }
|
246
|
+
end
|
247
|
+
|
244
248
|
field :error do
|
245
249
|
description "Raise an error"
|
246
250
|
type GraphQL::STRING_TYPE
|
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: 0.16.
|
4
|
+
version: 0.16.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: codeclimate-test-reporter
|
@@ -219,6 +219,7 @@ files:
|
|
219
219
|
- lib/graphql/int_type.rb
|
220
220
|
- lib/graphql/interface_type.rb
|
221
221
|
- lib/graphql/internal_representation.rb
|
222
|
+
- lib/graphql/internal_representation/definition.rb
|
222
223
|
- lib/graphql/internal_representation/node.rb
|
223
224
|
- lib/graphql/internal_representation/rewrite.rb
|
224
225
|
- lib/graphql/introspection.rb
|