graphiti_errors 1.0.alpha.2 → 1.0.alpha.3
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/README.md +1 -1
- data/gemfiles/rails_4.gemfile +1 -0
- data/gemfiles/rails_4.gemfile.lock +10 -4
- data/gemfiles/rails_5.gemfile +1 -0
- data/gemfiles/rails_5.gemfile.lock +10 -4
- data/graphiti_errors.gemspec +1 -1
- data/lib/graphiti_errors/serializers/validation.rb +6 -6
- data/lib/graphiti_errors/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ee6fb0df9c1138e511b565ce7a4650af63f3661
|
4
|
+
data.tar.gz: 1c5b34e21ebf1287a9bf2e1cd175369354b504d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f1eaacb86a6360f690c00f808fc7fd967a67bfe5c8a92cbc3bd6a6dd31aefebd777aa5b35d0ef9a226bf3fd5875ead8fd53e895f32e353e2f0a8525132adf2d
|
7
|
+
data.tar.gz: 50879fd50d319c2b687c1db975e8e22daaa5b25a1d42190cdc06d2b53c46d93559fd5dc2b6699a7e8d972457ff377ce12132a7ad8cbd4a19ab66f12b76d91a64
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# JsonapiErrorable
|
2
2
|
|
3
|
-
|
3
|
+

|
4
4
|
|
5
5
|
Error handling patterns for jsonapi.org-compatible APIs.
|
6
6
|
|
data/gemfiles/rails_4.gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
|
4
|
+
graphiti_errors (1.0.alpha.2)
|
5
5
|
jsonapi-serializable (~> 0.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -55,12 +55,13 @@ GEM
|
|
55
55
|
erubis (2.7.0)
|
56
56
|
globalid (0.3.7)
|
57
57
|
activesupport (>= 4.1.0)
|
58
|
+
graphiti_spec_helpers (1.0.alpha.2)
|
59
|
+
rspec (~> 3.0)
|
58
60
|
i18n (0.7.0)
|
59
61
|
json (1.8.3)
|
60
62
|
jsonapi-renderer (0.2.0)
|
61
63
|
jsonapi-serializable (0.3.0)
|
62
64
|
jsonapi-renderer (~> 0.2.0)
|
63
|
-
jsonapi_spec_helpers (0.2.0)
|
64
65
|
loofah (2.0.3)
|
65
66
|
nokogiri (>= 1.5.9)
|
66
67
|
mail (2.6.4)
|
@@ -110,6 +111,10 @@ GEM
|
|
110
111
|
rake (>= 0.8.7)
|
111
112
|
thor (>= 0.18.1, < 2.0)
|
112
113
|
rake (10.5.0)
|
114
|
+
rspec (3.5.0)
|
115
|
+
rspec-core (~> 3.5.0)
|
116
|
+
rspec-expectations (~> 3.5.0)
|
117
|
+
rspec-mocks (~> 3.5.0)
|
113
118
|
rspec-core (3.5.3)
|
114
119
|
rspec-support (~> 3.5.0)
|
115
120
|
rspec-expectations (3.5.0)
|
@@ -145,10 +150,11 @@ PLATFORMS
|
|
145
150
|
ruby
|
146
151
|
|
147
152
|
DEPENDENCIES
|
153
|
+
activemodel
|
148
154
|
appraisal
|
149
155
|
bundler (~> 1.11)
|
150
|
-
|
151
|
-
|
156
|
+
graphiti_errors!
|
157
|
+
graphiti_spec_helpers
|
152
158
|
pry
|
153
159
|
pry-byebug
|
154
160
|
rails (~> 4.1)
|
data/gemfiles/rails_5.gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
|
4
|
+
graphiti_errors (1.0.alpha.2)
|
5
5
|
jsonapi-serializable (~> 0.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -57,11 +57,12 @@ GEM
|
|
57
57
|
erubis (2.7.0)
|
58
58
|
globalid (0.3.7)
|
59
59
|
activesupport (>= 4.1.0)
|
60
|
+
graphiti_spec_helpers (1.0.alpha.2)
|
61
|
+
rspec (~> 3.0)
|
60
62
|
i18n (0.7.0)
|
61
63
|
jsonapi-renderer (0.2.0)
|
62
64
|
jsonapi-serializable (0.3.0)
|
63
65
|
jsonapi-renderer (~> 0.2.0)
|
64
|
-
jsonapi_spec_helpers (0.2.0)
|
65
66
|
loofah (2.0.3)
|
66
67
|
nokogiri (>= 1.5.9)
|
67
68
|
mail (2.6.4)
|
@@ -111,6 +112,10 @@ GEM
|
|
111
112
|
rake (>= 0.8.7)
|
112
113
|
thor (>= 0.18.1, < 2.0)
|
113
114
|
rake (10.5.0)
|
115
|
+
rspec (3.5.0)
|
116
|
+
rspec-core (~> 3.5.0)
|
117
|
+
rspec-expectations (~> 3.5.0)
|
118
|
+
rspec-mocks (~> 3.5.0)
|
114
119
|
rspec-core (3.5.3)
|
115
120
|
rspec-support (~> 3.5.0)
|
116
121
|
rspec-expectations (3.5.0)
|
@@ -149,10 +154,11 @@ PLATFORMS
|
|
149
154
|
ruby
|
150
155
|
|
151
156
|
DEPENDENCIES
|
157
|
+
activemodel
|
152
158
|
appraisal
|
153
159
|
bundler (~> 1.11)
|
154
|
-
|
155
|
-
|
160
|
+
graphiti_errors!
|
161
|
+
graphiti_spec_helpers
|
156
162
|
pry
|
157
163
|
pry-byebug
|
158
164
|
rails (~> 5.0)
|
data/graphiti_errors.gemspec
CHANGED
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
26
|
spec.add_development_dependency "rspec-rails", "~> 3.0"
|
27
27
|
spec.add_development_dependency "sqlite3"
|
28
|
-
spec.add_development_dependency "graphiti_spec_helpers"
|
28
|
+
spec.add_development_dependency "graphiti_spec_helpers", '>= 1.0.alpha.3'
|
29
29
|
end
|
@@ -30,7 +30,7 @@ module GraphitiErrors
|
|
30
30
|
return [] unless object.respond_to?(:errors)
|
31
31
|
|
32
32
|
all_errors = attribute_errors
|
33
|
-
all_errors |= relationship_errors(@relationship_payloads)
|
33
|
+
all_errors |= relationship_errors(object, @relationship_payloads)
|
34
34
|
all_errors
|
35
35
|
end
|
36
36
|
|
@@ -105,11 +105,11 @@ module GraphitiErrors
|
|
105
105
|
object.class.respond_to?(:reflect_on_all_associations)
|
106
106
|
end
|
107
107
|
|
108
|
-
def traverse_relationships(relationship_params)
|
108
|
+
def traverse_relationships(model, relationship_params)
|
109
109
|
return unless relationship_params
|
110
110
|
|
111
111
|
relationship_params.each_pair do |name, payload|
|
112
|
-
relationship_objects = Array(
|
112
|
+
relationship_objects = Array(model.send(name))
|
113
113
|
|
114
114
|
relationship_objects.each do |relationship_object|
|
115
115
|
related_payload = payload
|
@@ -123,14 +123,14 @@ module GraphitiErrors
|
|
123
123
|
end
|
124
124
|
|
125
125
|
yield name, relationship_object, related_payload
|
126
|
-
relationship_errors(related_payload[:relationships])
|
126
|
+
relationship_errors(relationship_object, related_payload[:relationships])
|
127
127
|
end
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
-
def relationship_errors(relationship_payloads)
|
131
|
+
def relationship_errors(model, relationship_payloads)
|
132
132
|
errors = []
|
133
|
-
traverse_relationships(relationship_payloads) do |name, model, payload|
|
133
|
+
traverse_relationships(model, relationship_payloads) do |name, model, payload|
|
134
134
|
meta = {}.tap do |hash|
|
135
135
|
hash[:name] = name
|
136
136
|
hash[:type] = payload[:meta][:jsonapi_type]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphiti_errors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.alpha.
|
4
|
+
version: 1.0.alpha.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Richmond
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsonapi-serializable
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 1.0.alpha.3
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 1.0.alpha.3
|
97
97
|
description: Handles application errors and model validations
|
98
98
|
email:
|
99
99
|
- lrichmond1@bloomberg.net
|