graphiti_errors 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/.standard.yml +3 -0
- data/.travis.yml +22 -6
- data/Gemfile +5 -5
- data/Rakefile +2 -2
- data/gemfiles/rails_4.gemfile +1 -1
- data/gemfiles/rails_5.gemfile +1 -1
- data/graphiti_errors.gemspec +8 -8
- data/lib/graphiti_errors.rb +19 -8
- data/lib/graphiti_errors/exception_handler.rb +5 -5
- data/lib/graphiti_errors/invalid_request/exception_handler.rb +27 -0
- data/lib/graphiti_errors/invalid_request/serializer.rb +37 -0
- data/lib/graphiti_errors/{serializers/validation.rb → validation/serializer.rb} +16 -16
- data/lib/graphiti_errors/version.rb +1 -1
- metadata +25 -12
- data/gemfiles/rails_4.gemfile.lock +0 -166
- data/gemfiles/rails_5.gemfile.lock +0 -170
- data/lib/graphiti_errors/validatable.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 04e34d00b82224f51f3046aff1b085f2476dbff556ae1f3c7e9000b7169e426c
|
4
|
+
data.tar.gz: 5ff55a77fc2e5f1ec771c04de4384a995d4b8cff4399884d2253c54c539e39b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a0cc3e06c62d0234d0642cbf64c01c189d4af2de9cf7976045fb52a352dec554b310a3e3fed2c927284e515084ff0c15865e171471101b533da102c4ab276ba
|
7
|
+
data.tar.gz: 43b3730077e76faf384b37ece7cdcc80a1d1c743b428534ca202c6de4c3ef3c6f442adf7ed3fb395268645c15cf292281116fea12bca6b6ec9759e4e98f5e5d7
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.5.1
|
data/.standard.yml
ADDED
data/.travis.yml
CHANGED
@@ -1,16 +1,32 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
script: "bundle exec rake"
|
7
|
-
|
8
|
-
install: bundle install --retry=3 --jobs=3
|
3
|
+
- 2.4
|
4
|
+
- 2.5
|
5
|
+
- 2.6
|
9
6
|
|
10
7
|
gemfile:
|
11
8
|
- gemfiles/rails_4.gemfile
|
12
9
|
- gemfiles/rails_5.gemfile
|
13
10
|
|
11
|
+
before_install:
|
12
|
+
- gem install bundler -v '1.17.3'
|
13
|
+
|
14
|
+
install: bundle _1.17.3_ install --retry=3 --jobs=3
|
15
|
+
|
16
|
+
env:
|
17
|
+
- COMMAND=standardrb --no-fix --format progress
|
18
|
+
- COMMAND=rspec
|
19
|
+
|
20
|
+
matrix:
|
21
|
+
exclude:
|
22
|
+
- gemfile: gemfiles/rails_4.gemfile
|
23
|
+
rvm: 2.5
|
24
|
+
- gemfile: gemfiles/rails_4.gemfile
|
25
|
+
rvm: 2.6
|
26
|
+
|
27
|
+
script:
|
28
|
+
- bundle _1.17.3_ exec $COMMAND
|
29
|
+
|
14
30
|
deploy:
|
15
31
|
provider: rubygems
|
16
32
|
api_key: $RUBYGEMS_API_KEY
|
data/Gemfile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in graphiti_errors.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
group :test do
|
7
|
-
gem
|
8
|
-
gem
|
9
|
-
gem
|
10
|
-
gem
|
7
|
+
gem "activemodel"
|
8
|
+
gem "appraisal"
|
9
|
+
gem "pry"
|
10
|
+
gem "pry-byebug"
|
11
11
|
end
|
data/Rakefile
CHANGED
data/gemfiles/rails_4.gemfile
CHANGED
data/gemfiles/rails_5.gemfile
CHANGED
data/graphiti_errors.gemspec
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
3
|
+
require "graphiti_errors/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
6
|
spec.name = "graphiti_errors"
|
@@ -9,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
9
8
|
spec.authors = ["Lee Richmond"]
|
10
9
|
spec.email = ["lrichmond1@bloomberg.net"]
|
11
10
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
11
|
+
spec.summary = "Error-handling patterns for JSONAPIs"
|
12
|
+
spec.description = "Handles application errors and model validations"
|
14
13
|
spec.license = "MIT"
|
15
14
|
|
16
15
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
@@ -18,12 +17,13 @@ Gem::Specification.new do |spec|
|
|
18
17
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
18
|
spec.require_paths = ["lib"]
|
20
19
|
|
21
|
-
spec.add_dependency
|
20
|
+
spec.add_dependency "jsonapi-serializable", "~> 0.1"
|
22
21
|
|
23
22
|
# Rails is added in Appraisals
|
24
|
-
spec.add_development_dependency "bundler"
|
23
|
+
spec.add_development_dependency "bundler"
|
25
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
25
|
spec.add_development_dependency "rspec-rails", "~> 3.0"
|
27
26
|
spec.add_development_dependency "sqlite3"
|
28
|
-
spec.add_development_dependency "graphiti_spec_helpers",
|
27
|
+
spec.add_development_dependency "graphiti_spec_helpers", ">= 1.0.alpha.3"
|
28
|
+
spec.add_development_dependency "standard"
|
29
29
|
end
|
data/lib/graphiti_errors.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require "jsonapi/serializable"
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
3
|
+
require "graphiti_errors/version"
|
4
|
+
require "graphiti_errors/exception_handler"
|
5
|
+
require "graphiti_errors/invalid_request/serializer"
|
6
|
+
require "graphiti_errors/invalid_request/exception_handler"
|
7
|
+
require "graphiti_errors/validation/serializer"
|
7
8
|
|
8
9
|
module GraphitiErrors
|
9
10
|
def self.included(klass)
|
@@ -13,12 +14,16 @@ module GraphitiErrors
|
|
13
14
|
end
|
14
15
|
|
15
16
|
def self.inherited(subklass)
|
16
|
-
subklass._errorable_registry =
|
17
|
+
subklass._errorable_registry = _errorable_registry.dup
|
17
18
|
end
|
18
19
|
end
|
19
20
|
klass._errorable_registry = {}
|
20
|
-
klass.send(:include, Validatable)
|
21
21
|
klass.extend ClassMethods
|
22
|
+
|
23
|
+
if defined?(Graphiti::Errors::InvalidRequest)
|
24
|
+
klass.register_exception Graphiti::Errors::InvalidRequest,
|
25
|
+
handler: GraphitiErrors::InvalidRequest::ExceptionHandler
|
26
|
+
end
|
22
27
|
end
|
23
28
|
|
24
29
|
def self.disable!
|
@@ -64,11 +69,17 @@ module GraphitiErrors
|
|
64
69
|
module ClassMethods
|
65
70
|
def register_exception(klass, options = {})
|
66
71
|
exception_klass = options[:handler] || default_exception_handler
|
67
|
-
|
72
|
+
_errorable_registry[klass] = exception_klass.new(options)
|
68
73
|
end
|
69
74
|
|
70
75
|
def default_exception_handler
|
71
76
|
GraphitiErrors::ExceptionHandler
|
72
77
|
end
|
73
78
|
end
|
79
|
+
|
80
|
+
# Backwards compatibility, as Graphiti 1.0.x references GraphitiErrors::Serializers::Validation
|
81
|
+
# where newer versions correctly point to GraphitiErrors::Validation::Serializer
|
82
|
+
module Serializers
|
83
|
+
Validation = GraphitiErrors::Validation::Serializer
|
84
|
+
end
|
74
85
|
end
|
@@ -24,7 +24,7 @@ module GraphitiErrors
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def title
|
27
|
-
@title ||
|
27
|
+
@title || "Error"
|
28
28
|
end
|
29
29
|
|
30
30
|
def detail(error)
|
@@ -45,7 +45,7 @@ module GraphitiErrors
|
|
45
45
|
meta_payload[:__raw_error__] = {
|
46
46
|
message: error.message,
|
47
47
|
debug: error.instance_variable_get(:@__graphiti_debug),
|
48
|
-
backtrace: error.backtrace
|
48
|
+
backtrace: error.backtrace,
|
49
49
|
}
|
50
50
|
end
|
51
51
|
end
|
@@ -58,8 +58,8 @@ module GraphitiErrors
|
|
58
58
|
status: status_code(error).to_s,
|
59
59
|
title: title,
|
60
60
|
detail: detail(error),
|
61
|
-
meta: meta(error)
|
62
|
-
]
|
61
|
+
meta: meta(error),
|
62
|
+
],
|
63
63
|
}
|
64
64
|
end
|
65
65
|
|
@@ -71,7 +71,7 @@ module GraphitiErrors
|
|
71
71
|
return unless log?
|
72
72
|
backtrace = error.backtrace
|
73
73
|
|
74
|
-
if cleaner = backtrace_cleaner
|
74
|
+
if (cleaner = backtrace_cleaner)
|
75
75
|
backtrace = cleaner.clean(backtrace)
|
76
76
|
end
|
77
77
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module GraphitiErrors
|
2
|
+
module InvalidRequest
|
3
|
+
class ExceptionHandler < GraphitiErrors::ExceptionHandler
|
4
|
+
def initialize(options = {})
|
5
|
+
unless options.key?(:log)
|
6
|
+
options[:log] = false
|
7
|
+
end
|
8
|
+
|
9
|
+
super
|
10
|
+
|
11
|
+
@show_raw_error = log?
|
12
|
+
end
|
13
|
+
|
14
|
+
def status_code(error)
|
15
|
+
400
|
16
|
+
end
|
17
|
+
|
18
|
+
def error_payload(error)
|
19
|
+
serializer = InvalidRequest::Serializer.new(error.errors)
|
20
|
+
|
21
|
+
{
|
22
|
+
errors: serializer.rendered_errors,
|
23
|
+
}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module GraphitiErrors
|
2
|
+
module InvalidRequest
|
3
|
+
class Serializer
|
4
|
+
attr_reader :errors
|
5
|
+
def initialize(errors)
|
6
|
+
@errors = errors
|
7
|
+
end
|
8
|
+
|
9
|
+
def rendered_errors
|
10
|
+
errors_payload = []
|
11
|
+
errors.details.each_pair do |attribute, att_errors|
|
12
|
+
att_errors.each_with_index do |error, idx|
|
13
|
+
code = error[:error]
|
14
|
+
message = errors.messages[attribute][idx]
|
15
|
+
|
16
|
+
errors_payload << {
|
17
|
+
code: "bad_request",
|
18
|
+
status: "400",
|
19
|
+
title: "Request Error",
|
20
|
+
detail: errors.full_message(attribute, message),
|
21
|
+
source: {
|
22
|
+
pointer: attribute.to_s.tr(".", "/").gsub(/\[(\d+)\]/, '/\1'),
|
23
|
+
},
|
24
|
+
meta: {
|
25
|
+
attribute: attribute,
|
26
|
+
message: message,
|
27
|
+
code: code,
|
28
|
+
},
|
29
|
+
}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
errors_payload
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module GraphitiErrors
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Validation
|
3
|
+
class Serializer
|
4
4
|
attr_reader :object
|
5
5
|
|
6
6
|
def initialize(object, relationship_payloads = {}, relationship_meta = {})
|
@@ -13,12 +13,12 @@ module GraphitiErrors
|
|
13
13
|
[].tap do |errors|
|
14
14
|
each_error do |attribute, message, code|
|
15
15
|
error = {
|
16
|
-
code:
|
17
|
-
status:
|
18
|
-
title:
|
16
|
+
code: "unprocessable_entity",
|
17
|
+
status: "422",
|
18
|
+
title: "Validation Error",
|
19
19
|
detail: detail_for(attribute, message),
|
20
|
-
source: {
|
21
|
-
meta:
|
20
|
+
source: {pointer: pointer_for(object, attribute)},
|
21
|
+
meta: meta_for(attribute, message, code, @relationship_meta),
|
22
22
|
}
|
23
23
|
|
24
24
|
errors << error
|
@@ -39,8 +39,8 @@ module GraphitiErrors
|
|
39
39
|
def each_error
|
40
40
|
object.errors.messages.each_pair do |attribute, messages|
|
41
41
|
details = if Rails::VERSION::MAJOR >= 5
|
42
|
-
|
43
|
-
|
42
|
+
object.errors.details.find { |k, v| k == attribute }[1]
|
43
|
+
end
|
44
44
|
|
45
45
|
messages.each_with_index do |message, index|
|
46
46
|
code = details[index][:error] if details
|
@@ -68,13 +68,13 @@ module GraphitiErrors
|
|
68
68
|
def meta_for(attribute, message, code, relationship_meta)
|
69
69
|
meta = {
|
70
70
|
attribute: attribute,
|
71
|
-
message: message
|
71
|
+
message: message,
|
72
72
|
}
|
73
|
-
meta
|
73
|
+
meta[:code] = code if Rails::VERSION::MAJOR >= 5
|
74
74
|
|
75
75
|
unless relationship_meta.empty?
|
76
76
|
meta = {
|
77
|
-
relationship: meta.merge(relationship_meta)
|
77
|
+
relationship: meta.merge(relationship_meta),
|
78
78
|
}
|
79
79
|
end
|
80
80
|
|
@@ -83,7 +83,7 @@ module GraphitiErrors
|
|
83
83
|
|
84
84
|
def detail_for(attribute, message)
|
85
85
|
detail = object.errors.full_message(attribute, message)
|
86
|
-
detail = message if attribute.to_s.downcase ==
|
86
|
+
detail = message if attribute.to_s.downcase == "base"
|
87
87
|
detail
|
88
88
|
end
|
89
89
|
|
@@ -114,12 +114,12 @@ module GraphitiErrors
|
|
114
114
|
relationship_objects.each do |relationship_object|
|
115
115
|
related_payload = payload
|
116
116
|
if payload.is_a?(Array)
|
117
|
-
related_payload = payload.find
|
117
|
+
related_payload = payload.find { |p|
|
118
118
|
temp_id = relationship_object
|
119
119
|
.instance_variable_get(:@_jsonapi_temp_id)
|
120
120
|
p[:meta][:temp_id] === temp_id ||
|
121
121
|
p[:meta][:id] == relationship_object.id.to_s
|
122
|
-
|
122
|
+
}
|
123
123
|
end
|
124
124
|
|
125
125
|
yield name, relationship_object, related_payload
|
@@ -134,7 +134,7 @@ module GraphitiErrors
|
|
134
134
|
meta = {}.tap do |hash|
|
135
135
|
hash[:name] = name
|
136
136
|
hash[:type] = payload[:meta][:jsonapi_type]
|
137
|
-
if temp_id = model.instance_variable_get(:@_jsonapi_temp_id)
|
137
|
+
if (temp_id = model.instance_variable_get(:@_jsonapi_temp_id))
|
138
138
|
hash[:'temp-id'] = temp_id
|
139
139
|
else
|
140
140
|
hash[:id] = model.id
|
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.
|
4
|
+
version: 1.1.0
|
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-
|
11
|
+
date: 2019-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsonapi-serializable
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 1.0.alpha.3
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: standard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: Handles application errors and model validations
|
98
112
|
email:
|
99
113
|
- lrichmond1@bloomberg.net
|
@@ -104,6 +118,7 @@ files:
|
|
104
118
|
- ".gitignore"
|
105
119
|
- ".rspec"
|
106
120
|
- ".ruby-version"
|
121
|
+
- ".standard.yml"
|
107
122
|
- ".travis.yml"
|
108
123
|
- Appraisals
|
109
124
|
- Gemfile
|
@@ -115,14 +130,13 @@ files:
|
|
115
130
|
- bin/rspec
|
116
131
|
- bin/setup
|
117
132
|
- gemfiles/rails_4.gemfile
|
118
|
-
- gemfiles/rails_4.gemfile.lock
|
119
133
|
- gemfiles/rails_5.gemfile
|
120
|
-
- gemfiles/rails_5.gemfile.lock
|
121
134
|
- graphiti_errors.gemspec
|
122
135
|
- lib/graphiti_errors.rb
|
123
136
|
- lib/graphiti_errors/exception_handler.rb
|
124
|
-
- lib/graphiti_errors/
|
125
|
-
- lib/graphiti_errors/
|
137
|
+
- lib/graphiti_errors/invalid_request/exception_handler.rb
|
138
|
+
- lib/graphiti_errors/invalid_request/serializer.rb
|
139
|
+
- lib/graphiti_errors/validation/serializer.rb
|
126
140
|
- lib/graphiti_errors/version.rb
|
127
141
|
homepage:
|
128
142
|
licenses:
|
@@ -143,8 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
157
|
- !ruby/object:Gem::Version
|
144
158
|
version: '0'
|
145
159
|
requirements: []
|
146
|
-
|
147
|
-
rubygems_version: 2.6.12
|
160
|
+
rubygems_version: 3.0.1
|
148
161
|
signing_key:
|
149
162
|
specification_version: 4
|
150
163
|
summary: Error-handling patterns for JSONAPIs
|
@@ -1,166 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ..
|
3
|
-
specs:
|
4
|
-
graphiti_errors (1.0.alpha.2)
|
5
|
-
jsonapi-serializable (~> 0.1)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
actionmailer (4.2.6)
|
11
|
-
actionpack (= 4.2.6)
|
12
|
-
actionview (= 4.2.6)
|
13
|
-
activejob (= 4.2.6)
|
14
|
-
mail (~> 2.5, >= 2.5.4)
|
15
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
16
|
-
actionpack (4.2.6)
|
17
|
-
actionview (= 4.2.6)
|
18
|
-
activesupport (= 4.2.6)
|
19
|
-
rack (~> 1.6)
|
20
|
-
rack-test (~> 0.6.2)
|
21
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
22
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
23
|
-
actionview (4.2.6)
|
24
|
-
activesupport (= 4.2.6)
|
25
|
-
builder (~> 3.1)
|
26
|
-
erubis (~> 2.7.0)
|
27
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
28
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
29
|
-
activejob (4.2.6)
|
30
|
-
activesupport (= 4.2.6)
|
31
|
-
globalid (>= 0.3.0)
|
32
|
-
activemodel (4.2.6)
|
33
|
-
activesupport (= 4.2.6)
|
34
|
-
builder (~> 3.1)
|
35
|
-
activerecord (4.2.6)
|
36
|
-
activemodel (= 4.2.6)
|
37
|
-
activesupport (= 4.2.6)
|
38
|
-
arel (~> 6.0)
|
39
|
-
activesupport (4.2.6)
|
40
|
-
i18n (~> 0.7)
|
41
|
-
json (~> 1.7, >= 1.7.7)
|
42
|
-
minitest (~> 5.1)
|
43
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
44
|
-
tzinfo (~> 1.1)
|
45
|
-
appraisal (2.1.0)
|
46
|
-
bundler
|
47
|
-
rake
|
48
|
-
thor (>= 0.14.0)
|
49
|
-
arel (6.0.3)
|
50
|
-
builder (3.2.2)
|
51
|
-
byebug (9.0.5)
|
52
|
-
coderay (1.1.1)
|
53
|
-
concurrent-ruby (1.0.2)
|
54
|
-
diff-lcs (1.2.5)
|
55
|
-
erubis (2.7.0)
|
56
|
-
globalid (0.3.7)
|
57
|
-
activesupport (>= 4.1.0)
|
58
|
-
graphiti_spec_helpers (1.0.alpha.2)
|
59
|
-
rspec (~> 3.0)
|
60
|
-
i18n (0.7.0)
|
61
|
-
json (1.8.3)
|
62
|
-
jsonapi-renderer (0.2.0)
|
63
|
-
jsonapi-serializable (0.3.0)
|
64
|
-
jsonapi-renderer (~> 0.2.0)
|
65
|
-
loofah (2.0.3)
|
66
|
-
nokogiri (>= 1.5.9)
|
67
|
-
mail (2.6.4)
|
68
|
-
mime-types (>= 1.16, < 4)
|
69
|
-
method_source (0.8.2)
|
70
|
-
mime-types (3.1)
|
71
|
-
mime-types-data (~> 3.2015)
|
72
|
-
mime-types-data (3.2016.0521)
|
73
|
-
mini_portile2 (2.1.0)
|
74
|
-
minitest (5.9.0)
|
75
|
-
nokogiri (1.6.8)
|
76
|
-
mini_portile2 (~> 2.1.0)
|
77
|
-
pkg-config (~> 1.1.7)
|
78
|
-
pkg-config (1.1.7)
|
79
|
-
pry (0.10.4)
|
80
|
-
coderay (~> 1.1.0)
|
81
|
-
method_source (~> 0.8.1)
|
82
|
-
slop (~> 3.4)
|
83
|
-
pry-byebug (3.4.0)
|
84
|
-
byebug (~> 9.0)
|
85
|
-
pry (~> 0.10)
|
86
|
-
rack (1.6.4)
|
87
|
-
rack-test (0.6.3)
|
88
|
-
rack (>= 1.0)
|
89
|
-
rails (4.2.6)
|
90
|
-
actionmailer (= 4.2.6)
|
91
|
-
actionpack (= 4.2.6)
|
92
|
-
actionview (= 4.2.6)
|
93
|
-
activejob (= 4.2.6)
|
94
|
-
activemodel (= 4.2.6)
|
95
|
-
activerecord (= 4.2.6)
|
96
|
-
activesupport (= 4.2.6)
|
97
|
-
bundler (>= 1.3.0, < 2.0)
|
98
|
-
railties (= 4.2.6)
|
99
|
-
sprockets-rails
|
100
|
-
rails-deprecated_sanitizer (1.0.3)
|
101
|
-
activesupport (>= 4.2.0.alpha)
|
102
|
-
rails-dom-testing (1.0.7)
|
103
|
-
activesupport (>= 4.2.0.beta, < 5.0)
|
104
|
-
nokogiri (~> 1.6.0)
|
105
|
-
rails-deprecated_sanitizer (>= 1.0.1)
|
106
|
-
rails-html-sanitizer (1.0.3)
|
107
|
-
loofah (~> 2.0)
|
108
|
-
railties (4.2.6)
|
109
|
-
actionpack (= 4.2.6)
|
110
|
-
activesupport (= 4.2.6)
|
111
|
-
rake (>= 0.8.7)
|
112
|
-
thor (>= 0.18.1, < 2.0)
|
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)
|
118
|
-
rspec-core (3.5.3)
|
119
|
-
rspec-support (~> 3.5.0)
|
120
|
-
rspec-expectations (3.5.0)
|
121
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
122
|
-
rspec-support (~> 3.5.0)
|
123
|
-
rspec-mocks (3.5.0)
|
124
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
125
|
-
rspec-support (~> 3.5.0)
|
126
|
-
rspec-rails (3.5.1)
|
127
|
-
actionpack (>= 3.0)
|
128
|
-
activesupport (>= 3.0)
|
129
|
-
railties (>= 3.0)
|
130
|
-
rspec-core (~> 3.5.0)
|
131
|
-
rspec-expectations (~> 3.5.0)
|
132
|
-
rspec-mocks (~> 3.5.0)
|
133
|
-
rspec-support (~> 3.5.0)
|
134
|
-
rspec-support (3.5.0)
|
135
|
-
slop (3.6.0)
|
136
|
-
sprockets (3.7.0)
|
137
|
-
concurrent-ruby (~> 1.0)
|
138
|
-
rack (> 1, < 3)
|
139
|
-
sprockets-rails (3.2.0)
|
140
|
-
actionpack (>= 4.0)
|
141
|
-
activesupport (>= 4.0)
|
142
|
-
sprockets (>= 3.0.0)
|
143
|
-
sqlite3 (1.3.11)
|
144
|
-
thor (0.19.1)
|
145
|
-
thread_safe (0.3.5)
|
146
|
-
tzinfo (1.2.2)
|
147
|
-
thread_safe (~> 0.1)
|
148
|
-
|
149
|
-
PLATFORMS
|
150
|
-
ruby
|
151
|
-
|
152
|
-
DEPENDENCIES
|
153
|
-
activemodel
|
154
|
-
appraisal
|
155
|
-
bundler (~> 1.11)
|
156
|
-
graphiti_errors!
|
157
|
-
graphiti_spec_helpers
|
158
|
-
pry
|
159
|
-
pry-byebug
|
160
|
-
rails (~> 4.1)
|
161
|
-
rake (~> 10.0)
|
162
|
-
rspec-rails (~> 3.0)
|
163
|
-
sqlite3
|
164
|
-
|
165
|
-
BUNDLED WITH
|
166
|
-
1.15.4
|
@@ -1,170 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ..
|
3
|
-
specs:
|
4
|
-
graphiti_errors (1.0.alpha.2)
|
5
|
-
jsonapi-serializable (~> 0.1)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
actioncable (5.0.0.1)
|
11
|
-
actionpack (= 5.0.0.1)
|
12
|
-
nio4r (~> 1.2)
|
13
|
-
websocket-driver (~> 0.6.1)
|
14
|
-
actionmailer (5.0.0.1)
|
15
|
-
actionpack (= 5.0.0.1)
|
16
|
-
actionview (= 5.0.0.1)
|
17
|
-
activejob (= 5.0.0.1)
|
18
|
-
mail (~> 2.5, >= 2.5.4)
|
19
|
-
rails-dom-testing (~> 2.0)
|
20
|
-
actionpack (5.0.0.1)
|
21
|
-
actionview (= 5.0.0.1)
|
22
|
-
activesupport (= 5.0.0.1)
|
23
|
-
rack (~> 2.0)
|
24
|
-
rack-test (~> 0.6.3)
|
25
|
-
rails-dom-testing (~> 2.0)
|
26
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
27
|
-
actionview (5.0.0.1)
|
28
|
-
activesupport (= 5.0.0.1)
|
29
|
-
builder (~> 3.1)
|
30
|
-
erubis (~> 2.7.0)
|
31
|
-
rails-dom-testing (~> 2.0)
|
32
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
33
|
-
activejob (5.0.0.1)
|
34
|
-
activesupport (= 5.0.0.1)
|
35
|
-
globalid (>= 0.3.6)
|
36
|
-
activemodel (5.0.0.1)
|
37
|
-
activesupport (= 5.0.0.1)
|
38
|
-
activerecord (5.0.0.1)
|
39
|
-
activemodel (= 5.0.0.1)
|
40
|
-
activesupport (= 5.0.0.1)
|
41
|
-
arel (~> 7.0)
|
42
|
-
activesupport (5.0.0.1)
|
43
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
44
|
-
i18n (~> 0.7)
|
45
|
-
minitest (~> 5.1)
|
46
|
-
tzinfo (~> 1.1)
|
47
|
-
appraisal (2.1.0)
|
48
|
-
bundler
|
49
|
-
rake
|
50
|
-
thor (>= 0.14.0)
|
51
|
-
arel (7.1.1)
|
52
|
-
builder (3.2.2)
|
53
|
-
byebug (9.0.5)
|
54
|
-
coderay (1.1.1)
|
55
|
-
concurrent-ruby (1.0.2)
|
56
|
-
diff-lcs (1.2.5)
|
57
|
-
erubis (2.7.0)
|
58
|
-
globalid (0.3.7)
|
59
|
-
activesupport (>= 4.1.0)
|
60
|
-
graphiti_spec_helpers (1.0.alpha.2)
|
61
|
-
rspec (~> 3.0)
|
62
|
-
i18n (0.7.0)
|
63
|
-
jsonapi-renderer (0.2.0)
|
64
|
-
jsonapi-serializable (0.3.0)
|
65
|
-
jsonapi-renderer (~> 0.2.0)
|
66
|
-
loofah (2.0.3)
|
67
|
-
nokogiri (>= 1.5.9)
|
68
|
-
mail (2.6.4)
|
69
|
-
mime-types (>= 1.16, < 4)
|
70
|
-
method_source (0.8.2)
|
71
|
-
mime-types (3.1)
|
72
|
-
mime-types-data (~> 3.2015)
|
73
|
-
mime-types-data (3.2016.0521)
|
74
|
-
mini_portile2 (2.1.0)
|
75
|
-
minitest (5.9.0)
|
76
|
-
nio4r (1.2.1)
|
77
|
-
nokogiri (1.6.8)
|
78
|
-
mini_portile2 (~> 2.1.0)
|
79
|
-
pkg-config (~> 1.1.7)
|
80
|
-
pkg-config (1.1.7)
|
81
|
-
pry (0.10.4)
|
82
|
-
coderay (~> 1.1.0)
|
83
|
-
method_source (~> 0.8.1)
|
84
|
-
slop (~> 3.4)
|
85
|
-
pry-byebug (3.4.0)
|
86
|
-
byebug (~> 9.0)
|
87
|
-
pry (~> 0.10)
|
88
|
-
rack (2.0.1)
|
89
|
-
rack-test (0.6.3)
|
90
|
-
rack (>= 1.0)
|
91
|
-
rails (5.0.0.1)
|
92
|
-
actioncable (= 5.0.0.1)
|
93
|
-
actionmailer (= 5.0.0.1)
|
94
|
-
actionpack (= 5.0.0.1)
|
95
|
-
actionview (= 5.0.0.1)
|
96
|
-
activejob (= 5.0.0.1)
|
97
|
-
activemodel (= 5.0.0.1)
|
98
|
-
activerecord (= 5.0.0.1)
|
99
|
-
activesupport (= 5.0.0.1)
|
100
|
-
bundler (>= 1.3.0, < 2.0)
|
101
|
-
railties (= 5.0.0.1)
|
102
|
-
sprockets-rails (>= 2.0.0)
|
103
|
-
rails-dom-testing (2.0.1)
|
104
|
-
activesupport (>= 4.2.0, < 6.0)
|
105
|
-
nokogiri (~> 1.6.0)
|
106
|
-
rails-html-sanitizer (1.0.3)
|
107
|
-
loofah (~> 2.0)
|
108
|
-
railties (5.0.0.1)
|
109
|
-
actionpack (= 5.0.0.1)
|
110
|
-
activesupport (= 5.0.0.1)
|
111
|
-
method_source
|
112
|
-
rake (>= 0.8.7)
|
113
|
-
thor (>= 0.18.1, < 2.0)
|
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)
|
119
|
-
rspec-core (3.5.3)
|
120
|
-
rspec-support (~> 3.5.0)
|
121
|
-
rspec-expectations (3.5.0)
|
122
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
123
|
-
rspec-support (~> 3.5.0)
|
124
|
-
rspec-mocks (3.5.0)
|
125
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
126
|
-
rspec-support (~> 3.5.0)
|
127
|
-
rspec-rails (3.5.1)
|
128
|
-
actionpack (>= 3.0)
|
129
|
-
activesupport (>= 3.0)
|
130
|
-
railties (>= 3.0)
|
131
|
-
rspec-core (~> 3.5.0)
|
132
|
-
rspec-expectations (~> 3.5.0)
|
133
|
-
rspec-mocks (~> 3.5.0)
|
134
|
-
rspec-support (~> 3.5.0)
|
135
|
-
rspec-support (3.5.0)
|
136
|
-
slop (3.6.0)
|
137
|
-
sprockets (3.7.0)
|
138
|
-
concurrent-ruby (~> 1.0)
|
139
|
-
rack (> 1, < 3)
|
140
|
-
sprockets-rails (3.2.0)
|
141
|
-
actionpack (>= 4.0)
|
142
|
-
activesupport (>= 4.0)
|
143
|
-
sprockets (>= 3.0.0)
|
144
|
-
sqlite3 (1.3.11)
|
145
|
-
thor (0.19.1)
|
146
|
-
thread_safe (0.3.5)
|
147
|
-
tzinfo (1.2.2)
|
148
|
-
thread_safe (~> 0.1)
|
149
|
-
websocket-driver (0.6.4)
|
150
|
-
websocket-extensions (>= 0.1.0)
|
151
|
-
websocket-extensions (0.1.2)
|
152
|
-
|
153
|
-
PLATFORMS
|
154
|
-
ruby
|
155
|
-
|
156
|
-
DEPENDENCIES
|
157
|
-
activemodel
|
158
|
-
appraisal
|
159
|
-
bundler (~> 1.11)
|
160
|
-
graphiti_errors!
|
161
|
-
graphiti_spec_helpers
|
162
|
-
pry
|
163
|
-
pry-byebug
|
164
|
-
rails (~> 5.0)
|
165
|
-
rake (~> 10.0)
|
166
|
-
rspec-rails (~> 3.0)
|
167
|
-
sqlite3
|
168
|
-
|
169
|
-
BUNDLED WITH
|
170
|
-
1.15.4
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module GraphitiErrors
|
2
|
-
module Validatable
|
3
|
-
def render_errors_for(record)
|
4
|
-
validation = Serializers::Validation.new \
|
5
|
-
record, deserialized_params.relationships
|
6
|
-
|
7
|
-
render \
|
8
|
-
json: { errors: validation.errors },
|
9
|
-
status: :unprocessable_entity
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|