graphql 1.8.16 → 1.8.17
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/schema.rb +8 -1
- data/lib/graphql/version.rb +1 -1
- data/spec/graphql/execution/lazy_spec.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2cf356f246374526f5fca1394326715e96ebc5e
|
4
|
+
data.tar.gz: 9fce5c14aa470be59a4321107c3d3ac91b1b822d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c8c31bfc50559e7c3b167b504babdcf6a3e6aaa91e02e7f30b50eb9e964937c313a3e74300eb24b9a3c7edf6a195ce84f3a39c5a4efb3ae20428d8c65e37559
|
7
|
+
data.tar.gz: 24788f360761ad47b508f7ae1267a0825fc99e0ba4c81457c1c73b56e7f6e144e51c33e1c33a65a8bc424c95575af280bb8e3177608e730018e426b6097ba84a
|
data/lib/graphql/schema.rb
CHANGED
@@ -1065,7 +1065,14 @@ module GraphQL
|
|
1065
1065
|
# @param ctx [GraphQL::Query::Context] the context for this query
|
1066
1066
|
# @return [Object] A GraphQL-ready (non-lazy) object
|
1067
1067
|
def self.sync_lazy(value)
|
1068
|
-
|
1068
|
+
if block_given?
|
1069
|
+
# This was already hit by the instance, just give it back
|
1070
|
+
yield(value)
|
1071
|
+
else
|
1072
|
+
# This was called directly on the class, hit the instance
|
1073
|
+
# which has the lazy method map
|
1074
|
+
self.graphql_definition.sync_lazy(value)
|
1075
|
+
end
|
1069
1076
|
end
|
1070
1077
|
|
1071
1078
|
# @see Schema.sync_lazy for a hook to override
|
data/lib/graphql/version.rb
CHANGED
@@ -10,6 +10,13 @@ describe GraphQL::Execution::Lazy do
|
|
10
10
|
assert_equal 3, res["data"]["int"]
|
11
11
|
end
|
12
12
|
|
13
|
+
it "Works with Query.new" do
|
14
|
+
query_str = '{ int(value: 2, plus: 1) }'
|
15
|
+
query = GraphQL::Query.new(LazyHelpers::LazySchema, query_str)
|
16
|
+
res = query.result
|
17
|
+
assert_equal 3, res["data"]["int"]
|
18
|
+
end
|
19
|
+
|
13
20
|
it "can do nested lazy values" do
|
14
21
|
res = run_query %|
|
15
22
|
{
|