graphiti 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphiti/sideload/polymorphic_belongs_to.rb +9 -7
- data/lib/graphiti/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d04305bd43a58f1a835af8e80a03f599430303cc967a99f4f662679eb5c0968
|
4
|
+
data.tar.gz: 869acd442f3b00895c72023a20ed9080f06559e0ba619b05bc2366169b776b72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82c3cc4fe7cfcc01deca4594460894c00c367f267a6d080bdc98b104e5d29b247ca858a80afc513faeeafc6e5d9fc12fb28dc36765a25d2dc2eab453bb2d5a08
|
7
|
+
data.tar.gz: 5351083894448c44d55cc88de12c2ad81c6319c8e2e7c7afc1a3a3db40b4abff30b51d90ed210cc2c940c013bf367d4f9f06c66b93954836febe2ba316ba6643
|
@@ -114,8 +114,8 @@ class Graphiti::Sideload::PolymorphicBelongsTo < Graphiti::Sideload::BelongsTo
|
|
114
114
|
|
115
115
|
match = ->(c) { c.group_name == group_name.to_sym }
|
116
116
|
if (sideload = children.values.find(&match))
|
117
|
-
|
118
|
-
sideload.resolve(group,
|
117
|
+
duped = remove_invalid_sideloads(sideload.resource, query)
|
118
|
+
sideload.resolve(group, duped, graph_parent)
|
119
119
|
else
|
120
120
|
err = ::Graphiti::Errors::PolymorphicSideloadChildNotFound
|
121
121
|
raise err.new(self, group_name)
|
@@ -127,14 +127,16 @@ class Graphiti::Sideload::PolymorphicBelongsTo < Graphiti::Sideload::BelongsTo
|
|
127
127
|
|
128
128
|
# We may be requesting a relationship that some subclasses support,
|
129
129
|
# but not others. Remove anything we don't support.
|
130
|
+
# TODO: spec to ensure this dupe logic doesn't mutate the original
|
130
131
|
def remove_invalid_sideloads(resource, query)
|
131
|
-
|
132
|
-
|
133
|
-
|
132
|
+
duped = query.dup
|
133
|
+
duped.instance_variable_set(:@hash, nil)
|
134
|
+
duped.instance_variable_set(:@sideloads, ::Graphiti::Util::Hash.deep_dup(query.sideloads))
|
135
|
+
duped.sideloads.each_pair do |key, value|
|
134
136
|
unless resource.class.sideload(key)
|
135
|
-
|
137
|
+
duped.sideloads.delete(key)
|
136
138
|
end
|
137
139
|
end
|
138
|
-
|
140
|
+
duped
|
139
141
|
end
|
140
142
|
end
|
data/lib/graphiti/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphiti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Richmond
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsonapi-serializable
|
@@ -344,8 +344,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
344
344
|
- !ruby/object:Gem::Version
|
345
345
|
version: '0'
|
346
346
|
requirements: []
|
347
|
-
|
348
|
-
rubygems_version: 2.7.6
|
347
|
+
rubygems_version: 3.0.6
|
349
348
|
signing_key:
|
350
349
|
specification_version: 4
|
351
350
|
summary: Easily build jsonapi.org-compatible APIs
|