glia-errors 0.0.1 → 0.3.0
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/Gemfile +1 -1
- data/Gemfile.lock +3 -2
- data/README.md +14 -15
- data/gemfiles/dry_validation_v0.gemfile +1 -1
- data/gemfiles/dry_validation_v1.gemfile +1 -1
- data/glia-errors.gemspec +1 -1
- data/lib/glia/errors.rb +1 -1
- data/lib/glia/errors/client_errors.rb +176 -0
- data/lib/glia/errors/error_types.rb +6 -0
- data/lib/glia/errors/mapper.rb +25 -27
- metadata +4 -12
- data/LICENSE +0 -21
- data/lib/glia/errors/validation_errors.rb +0 -115
- data/test_cases/invalid_format_error_case.json +0 -74
- data/test_cases/invalid_length_error_case.json +0 -106
- data/test_cases/invalid_nested_params_case.json +0 -77
- data/test_cases/invalid_number_error_case.json +0 -90
- data/test_cases/invalid_type_error_case.json +0 -98
- data/test_cases/invalid_value_error_case.json +0 -125
- data/test_cases/missing_value_error_case.json +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71d9c420c3a6350067f4f47cba98ebb07598c203951106c743e8d245938e4fb5
|
4
|
+
data.tar.gz: 2d74dd1fbe3272416010b8ee66b698484002baaf9f2786efde680d6a6292150e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23120c8979c3ad4b4a9524a9ac61deb2a2452f8c44cd79a059099b201e5cc8e07357e102a20c74c2e1716e22154ce930096be2e8d45ceafa1006aacb643a28c6
|
7
|
+
data.tar.gz: 9f0848627646f37ee78b24cd3bf3dea1b193e5541f5302782ce891727cfaeb82b502a56103350de43e41ad284340f8e2cf8848d88febf00b30c1492f7bc74b65
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -13,7 +13,7 @@ GEM
|
|
13
13
|
ast (~> 2.4.1)
|
14
14
|
patience_diff (1.1.0)
|
15
15
|
trollop (~> 1.16)
|
16
|
-
prettier (0.
|
16
|
+
prettier (0.22.0)
|
17
17
|
rainbow (3.0.0)
|
18
18
|
rake (13.0.1)
|
19
19
|
regexp_parser (2.0.0)
|
@@ -58,10 +58,11 @@ GEM
|
|
58
58
|
|
59
59
|
PLATFORMS
|
60
60
|
ruby
|
61
|
+
x86_64-darwin-19
|
61
62
|
|
62
63
|
DEPENDENCIES
|
63
64
|
appraisal
|
64
|
-
prettier (~> 0.
|
65
|
+
prettier (~> 0.22)
|
65
66
|
rake (~> 13.0)
|
66
67
|
rspec (~> 3.10)
|
67
68
|
rubocop (~> 1.5)
|
data/README.md
CHANGED
@@ -1,25 +1,24 @@
|
|
1
|
-
# glia-errors
|
2
|
-
Glia REST API errors (WIP)
|
1
|
+
# glia-errors
|
3
2
|
|
4
|
-
|
3
|
+
Implements Glia errors in Ruby and provides utilities to easily construct them.
|
5
4
|
|
6
|
-
|
5
|
+
# Installation
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
```
|
8
|
+
$ gem install glia-errors
|
9
|
+
```
|
11
10
|
|
12
|
-
|
11
|
+
## Usage
|
13
12
|
|
14
|
-
|
13
|
+
### Require library
|
15
14
|
|
16
15
|
```ruby
|
17
16
|
require 'glia/errors'
|
18
17
|
```
|
19
18
|
|
20
|
-
|
19
|
+
### For Glia developers
|
21
20
|
|
22
|
-
|
21
|
+
#### Map from `dry-validation` result
|
23
22
|
|
24
23
|
Currently 2 `dry-validation` versions are supported:
|
25
24
|
* `v0` up to `0.13`
|
@@ -51,7 +50,7 @@ error = Glia::Errors.from_dry_validation_result(result, ERROR_MAP)
|
|
51
50
|
response = error.to_h
|
52
51
|
```
|
53
52
|
|
54
|
-
|
53
|
+
### For REST API integrators
|
55
54
|
|
56
55
|
```ruby
|
57
56
|
require 'uri'
|
@@ -91,9 +90,9 @@ else
|
|
91
90
|
end
|
92
91
|
```
|
93
92
|
|
94
|
-
|
93
|
+
## Contributing
|
95
94
|
|
96
|
-
|
95
|
+
### Testing
|
97
96
|
|
98
97
|
Glia errors support multiple versions of `dry-validation` and tests are run against each supported major version.
|
99
98
|
Under the hood we use `Appraisal` gem which generals additional gemfiles for each of the versions.
|
@@ -116,7 +115,7 @@ To run tests only for `dry-validation` v0:
|
|
116
115
|
bundle exec rake test_dry_validation_v0
|
117
116
|
```
|
118
117
|
|
119
|
-
|
118
|
+
### Formatting
|
120
119
|
|
121
120
|
```
|
122
121
|
bundle exec rake format
|
data/glia-errors.gemspec
CHANGED
data/lib/glia/errors.rb
CHANGED
@@ -0,0 +1,176 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Glia
|
4
|
+
module Errors
|
5
|
+
# rubocop:disable Style/Documentation
|
6
|
+
class InputValidationError < Error
|
7
|
+
def initialize(error_details:, message: nil)
|
8
|
+
super(
|
9
|
+
type: INPUT_VALIDATION_ERROR,
|
10
|
+
ref: "https://example.com/errors/#{INPUT_VALIDATION_ERROR}.html",
|
11
|
+
message: message,
|
12
|
+
error_details: error_details
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class InvalidNumberError < Error
|
18
|
+
def initialize(field:, message: nil)
|
19
|
+
super(
|
20
|
+
type: INVALID_NUMBER_ERROR,
|
21
|
+
ref: "https://example.com/errors/#{INVALID_NUMBER_ERROR}.html",
|
22
|
+
message: "#{humanize(field)} " + (message || 'is invalid')
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class InvalidValueError < Error
|
28
|
+
def initialize(field:, message: nil)
|
29
|
+
super(
|
30
|
+
type: INVALID_VALUE_ERROR,
|
31
|
+
ref: "https://example.com/errors/#{INVALID_VALUE_ERROR}.html",
|
32
|
+
message: "#{humanize(field)} " + (message || 'is invalid')
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class InvalidLengthError < Error
|
38
|
+
def initialize(field:, message: nil)
|
39
|
+
super(
|
40
|
+
type: INVALID_LENGTH_ERROR,
|
41
|
+
ref: "https://example.com/errors/#{INVALID_LENGTH_ERROR}.html",
|
42
|
+
message: "#{humanize(field)} " + (message || 'length is invalid')
|
43
|
+
)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class InvalidFormatError < Error
|
48
|
+
class Formats
|
49
|
+
DATE_TIME = 'date_time'
|
50
|
+
DATE = 'date'
|
51
|
+
TIME = 'time'
|
52
|
+
UUID = 'uuid'
|
53
|
+
end
|
54
|
+
|
55
|
+
def initialize(field:, format: nil, message: nil)
|
56
|
+
default_message =
|
57
|
+
format ? "has invalid format, required format is #{format}" : 'has invalid format'
|
58
|
+
super(
|
59
|
+
type: INVALID_FORMAT_ERROR,
|
60
|
+
ref: "https://example.com/errors/#{INVALID_FORMAT_ERROR}.html",
|
61
|
+
message: "#{humanize(field)} " + (message || default_message)
|
62
|
+
)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
class InvalidTypeError < Error
|
67
|
+
class Types
|
68
|
+
STRING = 'string'
|
69
|
+
INTEGER = 'integer'
|
70
|
+
NUMBER = 'number'
|
71
|
+
BOOLEAN = 'boolean'
|
72
|
+
ARRAY = 'array'
|
73
|
+
OBJECT = 'object'
|
74
|
+
end
|
75
|
+
|
76
|
+
def initialize(field:, type:, message: nil)
|
77
|
+
super(
|
78
|
+
type: INVALID_TYPE_ERROR,
|
79
|
+
ref: "https://example.com/errors/#{INVALID_TYPE_ERROR}.html",
|
80
|
+
message: "#{humanize(field)} " + (message || "must be of type #{type}")
|
81
|
+
)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
class MissingValueError < Error
|
86
|
+
def initialize(field:, message: nil)
|
87
|
+
super(
|
88
|
+
type: MISSING_VALUE_ERROR,
|
89
|
+
ref: "https://example.com/errors/#{MISSING_VALUE_ERROR}.html",
|
90
|
+
message: "#{humanize(field)} " + (message || 'is missing')
|
91
|
+
)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
class UnknownError < Error
|
96
|
+
def initialize(field:, message: nil)
|
97
|
+
super(
|
98
|
+
type: UNKNOWN_ERROR,
|
99
|
+
ref: "https://example.com/errors/#{UNKNOWN_ERROR}.html",
|
100
|
+
message: "#{humanize(field)} " + (message || 'validation failed with unknown error')
|
101
|
+
)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
class ResourceNotFoundError < Error
|
106
|
+
def initialize(resource:, message: nil)
|
107
|
+
super(
|
108
|
+
type: RESOURCE_NOT_FOUND_ERROR,
|
109
|
+
ref: "https://example.com/errors/#{RESOURCE_NOT_FOUND_ERROR}.html",
|
110
|
+
message: "#{humanize(resource)} " + (message || 'not found'),
|
111
|
+
error_details: { resource: resource }
|
112
|
+
)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
class NotVerifiedError < Error
|
117
|
+
def initialize(resource:, message: nil)
|
118
|
+
super(
|
119
|
+
type: NOT_VERIFIED_ERROR,
|
120
|
+
ref: "https://example.com/errors/#{NOT_VERIFIED_ERROR}.html",
|
121
|
+
message: "#{humanize(resource)} " + (message || 'is not verified'),
|
122
|
+
error_details: { resource: resource }
|
123
|
+
)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
class RemainingAssociationError < Error
|
128
|
+
def initialize(resource:, associated_resource:, message: nil)
|
129
|
+
default_message =
|
130
|
+
"cannot be modified/deleted because it is associated to one or more #{
|
131
|
+
humanize(associated_resource)
|
132
|
+
}(s)"
|
133
|
+
super(
|
134
|
+
type: REMAINING_ASSOCIATION_ERROR,
|
135
|
+
ref: "https://example.com/errors/#{REMAINING_ASSOCIATION_ERROR}.html",
|
136
|
+
message: "#{humanize(resource)} " + (message || default_message),
|
137
|
+
error_details: { resource: resource, associated_resource: associated_resource }
|
138
|
+
)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
class LimitExceededError < Error
|
143
|
+
def initialize(resource:, max:, message: nil)
|
144
|
+
super(
|
145
|
+
type: LIMIT_EXCEEDED_ERROR,
|
146
|
+
ref: "https://example.com/errors/#{LIMIT_EXCEEDED_ERROR}.html",
|
147
|
+
message: "#{humanize(resource)} " + (message || "count must not exceed #{max}"),
|
148
|
+
error_details: { resource: resource, max: max }
|
149
|
+
)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
class ResourceAlreadyExistsError < Error
|
154
|
+
def initialize(resource:, message: nil)
|
155
|
+
super(
|
156
|
+
type: RESOURCE_ALREADY_EXISTS_ERROR,
|
157
|
+
ref: "https://example.com/errors/#{RESOURCE_ALREADY_EXISTS_ERROR}.html",
|
158
|
+
message: "#{humanize(resource)} " + (message || 'already exists'),
|
159
|
+
error_details: { resource: resource }
|
160
|
+
)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
class InvalidResourceStateError < Error
|
165
|
+
def initialize(resource:, state:, message: nil)
|
166
|
+
super(
|
167
|
+
type: INVALID_RESOURCE_STATE_ERROR,
|
168
|
+
ref: "https://example.com/errors/#{INVALID_RESOURCE_STATE_ERROR}.html",
|
169
|
+
message: "#{humanize(resource)} " + (message || "is in invalid state: #{state}"),
|
170
|
+
error_details: { resource: resource, state: state }
|
171
|
+
)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
# rubocop:enable Style/Documentation
|
175
|
+
end
|
176
|
+
end
|
@@ -10,5 +10,11 @@ module Glia
|
|
10
10
|
INVALID_LENGTH_ERROR = 'invalid_length_error'
|
11
11
|
MISSING_VALUE_ERROR = 'missing_value_error'
|
12
12
|
UNKNOWN_ERROR = 'unknown_error'
|
13
|
+
RESOURCE_NOT_FOUND_ERROR = 'resource_not_found_error'
|
14
|
+
NOT_VERIFIED_ERROR = 'not_verified_error'
|
15
|
+
REMAINING_ASSOCIATION_ERROR = 'remaining_association_error'
|
16
|
+
LIMIT_EXCEEDED_ERROR = 'limit_exceeded_error'
|
17
|
+
RESOURCE_ALREADY_EXISTS_ERROR = 'resource_already_exists_error'
|
18
|
+
INVALID_RESOURCE_STATE_ERROR = 'invalid_resource_state_error'
|
13
19
|
end
|
14
20
|
end
|
data/lib/glia/errors/mapper.rb
CHANGED
@@ -46,24 +46,18 @@ module Glia
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
InvalidFormatError::Formats::TIME
|
62
|
-
end
|
63
|
-
InvalidFormatError.new(field: field, format: format)
|
64
|
-
else
|
65
|
-
InvalidTypeError.new(field: field, type: InvalidTypeError::Types::STRING)
|
66
|
-
end
|
49
|
+
INVALID_DATE_FORMAT =
|
50
|
+
lambda do |field, _value, message|
|
51
|
+
format =
|
52
|
+
case message
|
53
|
+
when 'must be a date', 'must be Date'
|
54
|
+
InvalidFormatError::Formats::DATE
|
55
|
+
when 'must be a date time', 'must be DateTime'
|
56
|
+
InvalidFormatError::Formats::DATE_TIME
|
57
|
+
when 'must be a time', 'must be Time'
|
58
|
+
InvalidFormatError::Formats::TIME
|
59
|
+
end
|
60
|
+
InvalidFormatError.new(field: field, format: format)
|
67
61
|
end
|
68
62
|
|
69
63
|
ERROR_MAP = {
|
@@ -83,13 +77,13 @@ module Glia
|
|
83
77
|
'must be Boolean' => INVALID_TYPE_ERROR,
|
84
78
|
'must be a string' => INVALID_TYPE_ERROR,
|
85
79
|
'must be String' => INVALID_TYPE_ERROR,
|
86
|
-
'must be a date time' => INVALID_DATE_FORMAT_OR_TYPE_ERROR,
|
87
|
-
'must be DateTime' => INVALID_DATE_FORMAT_OR_TYPE_ERROR,
|
88
|
-
'must be a date' => INVALID_DATE_FORMAT_OR_TYPE_ERROR,
|
89
|
-
'must be Date' => INVALID_DATE_FORMAT_OR_TYPE_ERROR,
|
90
|
-
'must be a time' => INVALID_DATE_FORMAT_OR_TYPE_ERROR,
|
91
|
-
'must be Time' => INVALID_DATE_FORMAT_OR_TYPE_ERROR,
|
92
80
|
# InvalidFormatError
|
81
|
+
'must be a date time' => INVALID_DATE_FORMAT,
|
82
|
+
'must be DateTime' => INVALID_DATE_FORMAT,
|
83
|
+
'must be a date' => INVALID_DATE_FORMAT,
|
84
|
+
'must be Date' => INVALID_DATE_FORMAT,
|
85
|
+
'must be a time' => INVALID_DATE_FORMAT,
|
86
|
+
'must be Time' => INVALID_DATE_FORMAT,
|
93
87
|
'is in invalid format' => INVALID_FORMAT_ERROR,
|
94
88
|
'is not a valid UUID' => INVALID_UUID_ERROR,
|
95
89
|
# InvalidNumberError
|
@@ -104,9 +98,11 @@ module Glia
|
|
104
98
|
'must be false' => INVALID_VALUE_ERROR,
|
105
99
|
'must include' => INVALID_VALUE_ERROR,
|
106
100
|
'must not include' => INVALID_VALUE_ERROR,
|
107
|
-
'must be
|
108
|
-
|
109
|
-
|
101
|
+
'must be filled' =>
|
102
|
+
lambda do |field, value, _message|
|
103
|
+
# Consider `nil` as invalid value error, but empty string or array as invalid length error
|
104
|
+
value.nil? ? InvalidValueError.new(field: field) : InvalidLengthError.new(field: field)
|
105
|
+
end,
|
110
106
|
'cannot be defined' => INVALID_VALUE_ERROR,
|
111
107
|
# InvalidNumberError or InvalidValueError
|
112
108
|
'must be equal to' => INVALID_NUMBER_OR_VALUE_ERROR,
|
@@ -123,6 +119,8 @@ module Glia
|
|
123
119
|
'bytes long' => INVALID_LENGTH_ERROR,
|
124
120
|
'length must be' => INVALID_LENGTH_ERROR,
|
125
121
|
'length must be within' => INVALID_LENGTH_ERROR,
|
122
|
+
'must be empty' => INVALID_LENGTH_ERROR,
|
123
|
+
'cannot be empty' => INVALID_LENGTH_ERROR,
|
126
124
|
# MissingValueError
|
127
125
|
'is missing' => MISSING_VALUE_ERROR,
|
128
126
|
# Custom format errors
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glia-errors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Glia TechMovers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ''
|
14
14
|
email:
|
@@ -26,24 +26,16 @@ files:
|
|
26
26
|
- Appraisals
|
27
27
|
- Gemfile
|
28
28
|
- Gemfile.lock
|
29
|
-
- LICENSE
|
30
29
|
- README.md
|
31
30
|
- Rakefile
|
32
31
|
- gemfiles/dry_validation_v0.gemfile
|
33
32
|
- gemfiles/dry_validation_v1.gemfile
|
34
33
|
- glia-errors.gemspec
|
35
34
|
- lib/glia/errors.rb
|
35
|
+
- lib/glia/errors/client_errors.rb
|
36
36
|
- lib/glia/errors/error.rb
|
37
37
|
- lib/glia/errors/error_types.rb
|
38
38
|
- lib/glia/errors/mapper.rb
|
39
|
-
- lib/glia/errors/validation_errors.rb
|
40
|
-
- test_cases/invalid_format_error_case.json
|
41
|
-
- test_cases/invalid_length_error_case.json
|
42
|
-
- test_cases/invalid_nested_params_case.json
|
43
|
-
- test_cases/invalid_number_error_case.json
|
44
|
-
- test_cases/invalid_type_error_case.json
|
45
|
-
- test_cases/invalid_value_error_case.json
|
46
|
-
- test_cases/missing_value_error_case.json
|
47
39
|
homepage:
|
48
40
|
licenses:
|
49
41
|
- MIT
|
@@ -63,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
55
|
- !ruby/object:Gem::Version
|
64
56
|
version: '0'
|
65
57
|
requirements: []
|
66
|
-
rubygems_version: 3.
|
58
|
+
rubygems_version: 3.1.2
|
67
59
|
signing_key:
|
68
60
|
specification_version: 4
|
69
61
|
summary: Glia REST API errors
|
data/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2020 Glia Inc.
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
@@ -1,115 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Glia
|
4
|
-
module Errors
|
5
|
-
# InputValidationError
|
6
|
-
class InputValidationError < Error
|
7
|
-
def initialize(error_details:, message: nil)
|
8
|
-
super(
|
9
|
-
type: INPUT_VALIDATION_ERROR,
|
10
|
-
ref: "https://example.com/errors/#{INPUT_VALIDATION_ERROR}.html",
|
11
|
-
message: message,
|
12
|
-
error_details: error_details
|
13
|
-
)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
# InvalidNumberError
|
18
|
-
class InvalidNumberError < Error
|
19
|
-
def initialize(field:)
|
20
|
-
super(
|
21
|
-
type: INVALID_NUMBER_ERROR,
|
22
|
-
ref: "https://example.com/errors/#{INVALID_NUMBER_ERROR}.html",
|
23
|
-
message: "#{humanize(field)} is invalid"
|
24
|
-
)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
# InvalidValueError
|
29
|
-
class InvalidValueError < Error
|
30
|
-
def initialize(field:)
|
31
|
-
super(
|
32
|
-
type: INVALID_VALUE_ERROR,
|
33
|
-
ref: "https://example.com/errors/#{INVALID_VALUE_ERROR}.html",
|
34
|
-
message: "#{humanize(field)} is invalid"
|
35
|
-
)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# InvalidLengthError
|
40
|
-
class InvalidLengthError < Error
|
41
|
-
def initialize(field:)
|
42
|
-
super(
|
43
|
-
type: INVALID_LENGTH_ERROR,
|
44
|
-
ref: "https://example.com/errors/#{INVALID_LENGTH_ERROR}.html",
|
45
|
-
message: "#{humanize(field)} length is invalid"
|
46
|
-
)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# InvalidFormatError
|
51
|
-
class InvalidFormatError < Error
|
52
|
-
class Formats
|
53
|
-
DATE_TIME = 'date_time'
|
54
|
-
DATE = 'date'
|
55
|
-
TIME = 'time'
|
56
|
-
UUID = 'uuid'
|
57
|
-
end
|
58
|
-
|
59
|
-
def initialize(field:, format: nil)
|
60
|
-
super(
|
61
|
-
type: INVALID_FORMAT_ERROR,
|
62
|
-
ref: "https://example.com/errors/#{INVALID_FORMAT_ERROR}.html",
|
63
|
-
message:
|
64
|
-
if format
|
65
|
-
"#{humanize(field)} has invalid format, required format is #{format}"
|
66
|
-
else
|
67
|
-
"#{humanize(field)} has invalid format"
|
68
|
-
end
|
69
|
-
)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
# InvalidTypeError
|
74
|
-
class InvalidTypeError < Error
|
75
|
-
class Types
|
76
|
-
STRING = 'string'
|
77
|
-
INTEGER = 'integer'
|
78
|
-
NUMBER = 'number'
|
79
|
-
BOOLEAN = 'boolean'
|
80
|
-
ARRAY = 'array'
|
81
|
-
OBJECT = 'object'
|
82
|
-
end
|
83
|
-
|
84
|
-
def initialize(field:, type:)
|
85
|
-
super(
|
86
|
-
type: INVALID_TYPE_ERROR,
|
87
|
-
ref: "https://example.com/errors/#{INVALID_TYPE_ERROR}.html",
|
88
|
-
message: "#{humanize(field)} must be of type #{type}"
|
89
|
-
)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
# MissingValueError
|
94
|
-
class MissingValueError < Error
|
95
|
-
def initialize(field:)
|
96
|
-
super(
|
97
|
-
type: MISSING_VALUE_ERROR,
|
98
|
-
ref: "https://example.com/errors/#{MISSING_VALUE_ERROR}.html",
|
99
|
-
message: "#{humanize(field)} is missing"
|
100
|
-
)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
# UnknownError
|
105
|
-
class UnknownError < Error
|
106
|
-
def initialize(field:)
|
107
|
-
super(
|
108
|
-
type: UNKNOWN_ERROR,
|
109
|
-
ref: "https://example.com/errors/#{UNKNOWN_ERROR}.html",
|
110
|
-
message: "#{humanize(field)} validation failed with unknown error"
|
111
|
-
)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"input": {
|
3
|
-
"invalid_format_abc_regex": "defg",
|
4
|
-
"invalid_format_date": "not date",
|
5
|
-
"invalid_format_date_time": "not date time",
|
6
|
-
"invalid_format_time": "not time",
|
7
|
-
"invalid_format_uuid": "not uuid",
|
8
|
-
"invalid_format_e164": "not phone number",
|
9
|
-
"invalid_format_phone_extension": "not phone extension",
|
10
|
-
"invalid_format_email": "not email"
|
11
|
-
},
|
12
|
-
"expectation": {
|
13
|
-
"type": "input_validation_error",
|
14
|
-
"ref": "https://example.com/errors/input_validation_error.html",
|
15
|
-
"error_details": {
|
16
|
-
"invalid_format_abc_regex": [
|
17
|
-
{
|
18
|
-
"type": "invalid_format_error",
|
19
|
-
"ref": "https://example.com/errors/invalid_format_error.html",
|
20
|
-
"message": "Invalid format abc regex has invalid format"
|
21
|
-
}
|
22
|
-
],
|
23
|
-
"invalid_format_date": [
|
24
|
-
{
|
25
|
-
"type": "invalid_format_error",
|
26
|
-
"ref": "https://example.com/errors/invalid_format_error.html",
|
27
|
-
"message": "Invalid format date has invalid format, required format is date"
|
28
|
-
}
|
29
|
-
],
|
30
|
-
"invalid_format_date_time": [
|
31
|
-
{
|
32
|
-
"type": "invalid_format_error",
|
33
|
-
"ref": "https://example.com/errors/invalid_format_error.html",
|
34
|
-
"message": "Invalid format date time has invalid format, required format is date_time"
|
35
|
-
}
|
36
|
-
],
|
37
|
-
"invalid_format_time": [
|
38
|
-
{
|
39
|
-
"type": "invalid_format_error",
|
40
|
-
"ref": "https://example.com/errors/invalid_format_error.html",
|
41
|
-
"message": "Invalid format time has invalid format, required format is time"
|
42
|
-
}
|
43
|
-
],
|
44
|
-
"invalid_format_uuid": [
|
45
|
-
{
|
46
|
-
"type": "invalid_format_error",
|
47
|
-
"ref": "https://example.com/errors/invalid_format_error.html",
|
48
|
-
"message": "Invalid format uuid has invalid format, required format is uuid"
|
49
|
-
}
|
50
|
-
],
|
51
|
-
"invalid_format_e164": [
|
52
|
-
{
|
53
|
-
"type": "invalid_format_error",
|
54
|
-
"ref": "https://example.com/errors/invalid_format_error.html",
|
55
|
-
"message": "Invalid format e164 has invalid format"
|
56
|
-
}
|
57
|
-
],
|
58
|
-
"invalid_format_phone_extension": [
|
59
|
-
{
|
60
|
-
"type": "invalid_format_error",
|
61
|
-
"ref": "https://example.com/errors/invalid_format_error.html",
|
62
|
-
"message": "Invalid format phone extension has invalid format"
|
63
|
-
}
|
64
|
-
],
|
65
|
-
"invalid_format_email": [
|
66
|
-
{
|
67
|
-
"type": "invalid_format_error",
|
68
|
-
"ref": "https://example.com/errors/invalid_format_error.html",
|
69
|
-
"message": "Invalid format email has invalid format"
|
70
|
-
}
|
71
|
-
]
|
72
|
-
}
|
73
|
-
}
|
74
|
-
}
|
@@ -1,106 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"input": {
|
3
|
-
"invalid_length_array_max_length_3": [1, 2, 3, 4],
|
4
|
-
"invalid_length_array_min_length_3": [1, 2],
|
5
|
-
"invalid_length_array_exact_length_3": [1, 2],
|
6
|
-
"invalid_length_array_range_length_1_2": [1, 2, 3],
|
7
|
-
"invalid_length_string_max_length_3": "abcd",
|
8
|
-
"invalid_length_string_min_length_3": "ab",
|
9
|
-
"invalid_length_string_exact_length_3": "ab",
|
10
|
-
"invalid_length_string_range_length_1_2": "abc",
|
11
|
-
"invalid_length_string_max_bytesize_3": "abcd",
|
12
|
-
"invalid_length_string_min_bytesize_3": "a",
|
13
|
-
"invalid_length_string_exact_bytesize_3": "ab",
|
14
|
-
"invalid_length_string_range_bytesize_1_2": "abc"
|
15
|
-
},
|
16
|
-
"expectation": {
|
17
|
-
"type": "input_validation_error",
|
18
|
-
"ref": "https://example.com/errors/input_validation_error.html",
|
19
|
-
"error_details": {
|
20
|
-
"invalid_length_array_max_length_3": [
|
21
|
-
{
|
22
|
-
"type": "invalid_length_error",
|
23
|
-
"ref": "https://example.com/errors/invalid_length_error.html",
|
24
|
-
"message": "Invalid length array max length 3 length is invalid"
|
25
|
-
}
|
26
|
-
],
|
27
|
-
"invalid_length_array_min_length_3": [
|
28
|
-
{
|
29
|
-
"type": "invalid_length_error",
|
30
|
-
"ref": "https://example.com/errors/invalid_length_error.html",
|
31
|
-
"message": "Invalid length array min length 3 length is invalid"
|
32
|
-
}
|
33
|
-
],
|
34
|
-
"invalid_length_array_exact_length_3": [
|
35
|
-
{
|
36
|
-
"type": "invalid_length_error",
|
37
|
-
"ref": "https://example.com/errors/invalid_length_error.html",
|
38
|
-
"message": "Invalid length array exact length 3 length is invalid"
|
39
|
-
}
|
40
|
-
],
|
41
|
-
"invalid_length_array_range_length_1_2": [
|
42
|
-
{
|
43
|
-
"type": "invalid_length_error",
|
44
|
-
"ref": "https://example.com/errors/invalid_length_error.html",
|
45
|
-
"message": "Invalid length array range length 1 2 length is invalid"
|
46
|
-
}
|
47
|
-
],
|
48
|
-
"invalid_length_string_max_length_3": [
|
49
|
-
{
|
50
|
-
"type": "invalid_length_error",
|
51
|
-
"ref": "https://example.com/errors/invalid_length_error.html",
|
52
|
-
"message": "Invalid length string max length 3 length is invalid"
|
53
|
-
}
|
54
|
-
],
|
55
|
-
"invalid_length_string_min_length_3": [
|
56
|
-
{
|
57
|
-
"type": "invalid_length_error",
|
58
|
-
"ref": "https://example.com/errors/invalid_length_error.html",
|
59
|
-
"message": "Invalid length string min length 3 length is invalid"
|
60
|
-
}
|
61
|
-
],
|
62
|
-
"invalid_length_string_exact_length_3": [
|
63
|
-
{
|
64
|
-
"type": "invalid_length_error",
|
65
|
-
"ref": "https://example.com/errors/invalid_length_error.html",
|
66
|
-
"message": "Invalid length string exact length 3 length is invalid"
|
67
|
-
}
|
68
|
-
],
|
69
|
-
"invalid_length_string_range_length_1_2": [
|
70
|
-
{
|
71
|
-
"type": "invalid_length_error",
|
72
|
-
"ref": "https://example.com/errors/invalid_length_error.html",
|
73
|
-
"message": "Invalid length string range length 1 2 length is invalid"
|
74
|
-
}
|
75
|
-
],
|
76
|
-
"invalid_length_string_max_bytesize_3": [
|
77
|
-
{
|
78
|
-
"type": "invalid_length_error",
|
79
|
-
"ref": "https://example.com/errors/invalid_length_error.html",
|
80
|
-
"message": "Invalid length string max bytesize 3 length is invalid"
|
81
|
-
}
|
82
|
-
],
|
83
|
-
"invalid_length_string_min_bytesize_3": [
|
84
|
-
{
|
85
|
-
"type": "invalid_length_error",
|
86
|
-
"ref": "https://example.com/errors/invalid_length_error.html",
|
87
|
-
"message": "Invalid length string min bytesize 3 length is invalid"
|
88
|
-
}
|
89
|
-
],
|
90
|
-
"invalid_length_string_exact_bytesize_3": [
|
91
|
-
{
|
92
|
-
"type": "invalid_length_error",
|
93
|
-
"ref": "https://example.com/errors/invalid_length_error.html",
|
94
|
-
"message": "Invalid length string exact bytesize 3 length is invalid"
|
95
|
-
}
|
96
|
-
],
|
97
|
-
"invalid_length_string_range_bytesize_1_2": [
|
98
|
-
{
|
99
|
-
"type": "invalid_length_error",
|
100
|
-
"ref": "https://example.com/errors/invalid_length_error.html",
|
101
|
-
"message": "Invalid length string range bytesize 1 2 length is invalid"
|
102
|
-
}
|
103
|
-
]
|
104
|
-
}
|
105
|
-
}
|
106
|
-
}
|
@@ -1,77 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"input": {
|
3
|
-
"object": {
|
4
|
-
"invalid_nested_object_value": "invalid"
|
5
|
-
},
|
6
|
-
"array": [
|
7
|
-
{
|
8
|
-
"invalid_nested_array_value": "invalid"
|
9
|
-
},
|
10
|
-
{
|
11
|
-
"invalid_nested_array_value": "valid"
|
12
|
-
},
|
13
|
-
{
|
14
|
-
"invalid_nested_array_value": "invalid"
|
15
|
-
}
|
16
|
-
]
|
17
|
-
},
|
18
|
-
"expectation": {
|
19
|
-
"type": "input_validation_error",
|
20
|
-
"ref": "https://example.com/errors/input_validation_error.html",
|
21
|
-
"error_details": {
|
22
|
-
"object": [
|
23
|
-
{
|
24
|
-
"type": "input_validation_error",
|
25
|
-
"ref": "https://example.com/errors/input_validation_error.html",
|
26
|
-
"error_details": {
|
27
|
-
"invalid_nested_object_value": [
|
28
|
-
{
|
29
|
-
"type": "invalid_value_error",
|
30
|
-
"ref": "https://example.com/errors/invalid_value_error.html",
|
31
|
-
"message": "Invalid nested object value is invalid"
|
32
|
-
}
|
33
|
-
]
|
34
|
-
}
|
35
|
-
}
|
36
|
-
],
|
37
|
-
"array": [
|
38
|
-
{
|
39
|
-
"type": "input_validation_error",
|
40
|
-
"ref": "https://example.com/errors/input_validation_error.html",
|
41
|
-
"error_details": {
|
42
|
-
"0": [
|
43
|
-
{
|
44
|
-
"type": "input_validation_error",
|
45
|
-
"ref": "https://example.com/errors/input_validation_error.html",
|
46
|
-
"error_details": {
|
47
|
-
"invalid_nested_array_value": [
|
48
|
-
{
|
49
|
-
"type": "invalid_value_error",
|
50
|
-
"ref": "https://example.com/errors/invalid_value_error.html",
|
51
|
-
"message": "Invalid nested array value is invalid"
|
52
|
-
}
|
53
|
-
]
|
54
|
-
}
|
55
|
-
}
|
56
|
-
],
|
57
|
-
"2": [
|
58
|
-
{
|
59
|
-
"type": "input_validation_error",
|
60
|
-
"ref": "https://example.com/errors/input_validation_error.html",
|
61
|
-
"error_details": {
|
62
|
-
"invalid_nested_array_value": [
|
63
|
-
{
|
64
|
-
"type": "invalid_value_error",
|
65
|
-
"ref": "https://example.com/errors/invalid_value_error.html",
|
66
|
-
"message": "Invalid nested array value is invalid"
|
67
|
-
}
|
68
|
-
]
|
69
|
-
}
|
70
|
-
}
|
71
|
-
]
|
72
|
-
}
|
73
|
-
}
|
74
|
-
]
|
75
|
-
}
|
76
|
-
}
|
77
|
-
}
|
@@ -1,90 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"input": {
|
3
|
-
"invalid_number_less_than_10": 20,
|
4
|
-
"invalid_number_less_than_or_equal_10": 20,
|
5
|
-
"invalid_number_more_than_10": 5,
|
6
|
-
"invalid_number_more_than_or_equal_10": 5,
|
7
|
-
"invalid_number_equal_10": 5,
|
8
|
-
"invalid_number_not_equal_10": 10,
|
9
|
-
"invalid_number_one_of_1_2": 4,
|
10
|
-
"invalid_number_in_range_1_to_3": 4,
|
11
|
-
"invalid_number_even": 3,
|
12
|
-
"invalid_number_odd": 4
|
13
|
-
},
|
14
|
-
"expectation": {
|
15
|
-
"type": "input_validation_error",
|
16
|
-
"ref": "https://example.com/errors/input_validation_error.html",
|
17
|
-
"error_details": {
|
18
|
-
"invalid_number_less_than_10": [
|
19
|
-
{
|
20
|
-
"type": "invalid_number_error",
|
21
|
-
"ref": "https://example.com/errors/invalid_number_error.html",
|
22
|
-
"message": "Invalid number less than 10 is invalid"
|
23
|
-
}
|
24
|
-
],
|
25
|
-
"invalid_number_less_than_or_equal_10": [
|
26
|
-
{
|
27
|
-
"type": "invalid_number_error",
|
28
|
-
"ref": "https://example.com/errors/invalid_number_error.html",
|
29
|
-
"message": "Invalid number less than or equal 10 is invalid"
|
30
|
-
}
|
31
|
-
],
|
32
|
-
"invalid_number_more_than_10": [
|
33
|
-
{
|
34
|
-
"type": "invalid_number_error",
|
35
|
-
"ref": "https://example.com/errors/invalid_number_error.html",
|
36
|
-
"message": "Invalid number more than 10 is invalid"
|
37
|
-
}
|
38
|
-
],
|
39
|
-
"invalid_number_more_than_or_equal_10": [
|
40
|
-
{
|
41
|
-
"type": "invalid_number_error",
|
42
|
-
"ref": "https://example.com/errors/invalid_number_error.html",
|
43
|
-
"message": "Invalid number more than or equal 10 is invalid"
|
44
|
-
}
|
45
|
-
],
|
46
|
-
"invalid_number_equal_10": [
|
47
|
-
{
|
48
|
-
"type": "invalid_number_error",
|
49
|
-
"ref": "https://example.com/errors/invalid_number_error.html",
|
50
|
-
"message": "Invalid number equal 10 is invalid"
|
51
|
-
}
|
52
|
-
],
|
53
|
-
"invalid_number_not_equal_10": [
|
54
|
-
{
|
55
|
-
"type": "invalid_number_error",
|
56
|
-
"ref": "https://example.com/errors/invalid_number_error.html",
|
57
|
-
"message": "Invalid number not equal 10 is invalid"
|
58
|
-
}
|
59
|
-
],
|
60
|
-
"invalid_number_one_of_1_2": [
|
61
|
-
{
|
62
|
-
"type": "invalid_number_error",
|
63
|
-
"ref": "https://example.com/errors/invalid_number_error.html",
|
64
|
-
"message": "Invalid number one of 1 2 is invalid"
|
65
|
-
}
|
66
|
-
],
|
67
|
-
"invalid_number_in_range_1_to_3": [
|
68
|
-
{
|
69
|
-
"type": "invalid_number_error",
|
70
|
-
"ref": "https://example.com/errors/invalid_number_error.html",
|
71
|
-
"message": "Invalid number in range 1 to 3 is invalid"
|
72
|
-
}
|
73
|
-
],
|
74
|
-
"invalid_number_even": [
|
75
|
-
{
|
76
|
-
"type": "invalid_number_error",
|
77
|
-
"ref": "https://example.com/errors/invalid_number_error.html",
|
78
|
-
"message": "Invalid number even is invalid"
|
79
|
-
}
|
80
|
-
],
|
81
|
-
"invalid_number_odd": [
|
82
|
-
{
|
83
|
-
"type": "invalid_number_error",
|
84
|
-
"ref": "https://example.com/errors/invalid_number_error.html",
|
85
|
-
"message": "Invalid number odd is invalid"
|
86
|
-
}
|
87
|
-
]
|
88
|
-
}
|
89
|
-
}
|
90
|
-
}
|
@@ -1,98 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"input": {
|
3
|
-
"invalid_type_array": 0,
|
4
|
-
"invalid_type_number": "str",
|
5
|
-
"invalid_type_object": 0,
|
6
|
-
"invalid_type_boolean": 0,
|
7
|
-
"invalid_type_integer": 0.0,
|
8
|
-
"invalid_type_float": 0,
|
9
|
-
"invalid_type_decimal": 0,
|
10
|
-
"invalid_type_date": 0,
|
11
|
-
"invalid_type_date_time": 0,
|
12
|
-
"invalid_type_time": 0,
|
13
|
-
"invalid_type_string": 0
|
14
|
-
},
|
15
|
-
"expectation": {
|
16
|
-
"type": "input_validation_error",
|
17
|
-
"ref": "https://example.com/errors/input_validation_error.html",
|
18
|
-
"error_details": {
|
19
|
-
"invalid_type_array": [
|
20
|
-
{
|
21
|
-
"type": "invalid_type_error",
|
22
|
-
"ref": "https://example.com/errors/invalid_type_error.html",
|
23
|
-
"message": "Invalid type array must be of type array"
|
24
|
-
}
|
25
|
-
],
|
26
|
-
"invalid_type_number": [
|
27
|
-
{
|
28
|
-
"type": "invalid_type_error",
|
29
|
-
"ref": "https://example.com/errors/invalid_type_error.html",
|
30
|
-
"message": "Invalid type number must be of type number"
|
31
|
-
}
|
32
|
-
],
|
33
|
-
"invalid_type_object": [
|
34
|
-
{
|
35
|
-
"type": "invalid_type_error",
|
36
|
-
"ref": "https://example.com/errors/invalid_type_error.html",
|
37
|
-
"message": "Invalid type object must be of type object"
|
38
|
-
}
|
39
|
-
],
|
40
|
-
"invalid_type_boolean": [
|
41
|
-
{
|
42
|
-
"type": "invalid_type_error",
|
43
|
-
"ref": "https://example.com/errors/invalid_type_error.html",
|
44
|
-
"message": "Invalid type boolean must be of type boolean"
|
45
|
-
}
|
46
|
-
],
|
47
|
-
"invalid_type_integer": [
|
48
|
-
{
|
49
|
-
"type": "invalid_type_error",
|
50
|
-
"ref": "https://example.com/errors/invalid_type_error.html",
|
51
|
-
"message": "Invalid type integer must be of type integer"
|
52
|
-
}
|
53
|
-
],
|
54
|
-
"invalid_type_float": [
|
55
|
-
{
|
56
|
-
"type": "invalid_type_error",
|
57
|
-
"ref": "https://example.com/errors/invalid_type_error.html",
|
58
|
-
"message": "Invalid type float must be of type number"
|
59
|
-
}
|
60
|
-
],
|
61
|
-
"invalid_type_decimal": [
|
62
|
-
{
|
63
|
-
"type": "invalid_type_error",
|
64
|
-
"ref": "https://example.com/errors/invalid_type_error.html",
|
65
|
-
"message": "Invalid type decimal must be of type number"
|
66
|
-
}
|
67
|
-
],
|
68
|
-
"invalid_type_date": [
|
69
|
-
{
|
70
|
-
"type": "invalid_type_error",
|
71
|
-
"ref": "https://example.com/errors/invalid_type_error.html",
|
72
|
-
"message": "Invalid type date must be of type string"
|
73
|
-
}
|
74
|
-
],
|
75
|
-
"invalid_type_date_time": [
|
76
|
-
{
|
77
|
-
"type": "invalid_type_error",
|
78
|
-
"ref": "https://example.com/errors/invalid_type_error.html",
|
79
|
-
"message": "Invalid type date time must be of type string"
|
80
|
-
}
|
81
|
-
],
|
82
|
-
"invalid_type_time": [
|
83
|
-
{
|
84
|
-
"type": "invalid_type_error",
|
85
|
-
"ref": "https://example.com/errors/invalid_type_error.html",
|
86
|
-
"message": "Invalid type time must be of type string"
|
87
|
-
}
|
88
|
-
],
|
89
|
-
"invalid_type_string": [
|
90
|
-
{
|
91
|
-
"type": "invalid_type_error",
|
92
|
-
"ref": "https://example.com/errors/invalid_type_error.html",
|
93
|
-
"message": "Invalid type string must be of type string"
|
94
|
-
}
|
95
|
-
]
|
96
|
-
}
|
97
|
-
}
|
98
|
-
}
|
@@ -1,125 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"input": {
|
3
|
-
"invalid_value_string_equal_abc": "defg",
|
4
|
-
"invalid_value_string_one_of_a_b_c": "d",
|
5
|
-
"invalid_value_string_not_equal_abc": "abc",
|
6
|
-
"invalid_value_string_not_one_of_a_b_c": "a",
|
7
|
-
"invalid_value_string_empty": "a",
|
8
|
-
"invalid_value_string_not_empty": "",
|
9
|
-
|
10
|
-
"invalid_value_boolean_equal_true": false,
|
11
|
-
"invalid_value_boolean_equal_false": true,
|
12
|
-
|
13
|
-
"invalid_value_array_includes_a": ["b"],
|
14
|
-
"invalid_value_array_excludes_a": ["a"],
|
15
|
-
"invalid_value_array_empty": ["a"],
|
16
|
-
"invalid_value_array_not_empty": [],
|
17
|
-
|
18
|
-
"invalid_value_null": "a",
|
19
|
-
"invalid_value_not_null": null
|
20
|
-
},
|
21
|
-
"expectation": {
|
22
|
-
"type": "input_validation_error",
|
23
|
-
"ref": "https://example.com/errors/input_validation_error.html",
|
24
|
-
"error_details": {
|
25
|
-
"invalid_value_string_equal_abc": [
|
26
|
-
{
|
27
|
-
"type": "invalid_value_error",
|
28
|
-
"ref": "https://example.com/errors/invalid_value_error.html",
|
29
|
-
"message": "Invalid value string equal abc is invalid"
|
30
|
-
}
|
31
|
-
],
|
32
|
-
"invalid_value_string_one_of_a_b_c": [
|
33
|
-
{
|
34
|
-
"type": "invalid_value_error",
|
35
|
-
"ref": "https://example.com/errors/invalid_value_error.html",
|
36
|
-
"message": "Invalid value string one of a b c is invalid"
|
37
|
-
}
|
38
|
-
],
|
39
|
-
"invalid_value_string_not_equal_abc": [
|
40
|
-
{
|
41
|
-
"type": "invalid_value_error",
|
42
|
-
"ref": "https://example.com/errors/invalid_value_error.html",
|
43
|
-
"message": "Invalid value string not equal abc is invalid"
|
44
|
-
}
|
45
|
-
],
|
46
|
-
"invalid_value_string_not_one_of_a_b_c": [
|
47
|
-
{
|
48
|
-
"type": "invalid_value_error",
|
49
|
-
"ref": "https://example.com/errors/invalid_value_error.html",
|
50
|
-
"message": "Invalid value string not one of a b c is invalid"
|
51
|
-
}
|
52
|
-
],
|
53
|
-
"invalid_value_string_empty": [
|
54
|
-
{
|
55
|
-
"type": "invalid_value_error",
|
56
|
-
"ref": "https://example.com/errors/invalid_value_error.html",
|
57
|
-
"message": "Invalid value string empty is invalid"
|
58
|
-
}
|
59
|
-
],
|
60
|
-
"invalid_value_string_not_empty": [
|
61
|
-
{
|
62
|
-
"type": "invalid_value_error",
|
63
|
-
"ref": "https://example.com/errors/invalid_value_error.html",
|
64
|
-
"message": "Invalid value string not empty is invalid"
|
65
|
-
}
|
66
|
-
],
|
67
|
-
"invalid_value_boolean_equal_true": [
|
68
|
-
{
|
69
|
-
"type": "invalid_value_error",
|
70
|
-
"ref": "https://example.com/errors/invalid_value_error.html",
|
71
|
-
"message": "Invalid value boolean equal true is invalid"
|
72
|
-
}
|
73
|
-
],
|
74
|
-
"invalid_value_boolean_equal_false": [
|
75
|
-
{
|
76
|
-
"type": "invalid_value_error",
|
77
|
-
"ref": "https://example.com/errors/invalid_value_error.html",
|
78
|
-
"message": "Invalid value boolean equal false is invalid"
|
79
|
-
}
|
80
|
-
],
|
81
|
-
"invalid_value_array_includes_a": [
|
82
|
-
{
|
83
|
-
"type": "invalid_value_error",
|
84
|
-
"ref": "https://example.com/errors/invalid_value_error.html",
|
85
|
-
"message": "Invalid value array includes a is invalid"
|
86
|
-
}
|
87
|
-
],
|
88
|
-
"invalid_value_array_excludes_a": [
|
89
|
-
{
|
90
|
-
"type": "invalid_value_error",
|
91
|
-
"ref": "https://example.com/errors/invalid_value_error.html",
|
92
|
-
"message": "Invalid value array excludes a is invalid"
|
93
|
-
}
|
94
|
-
],
|
95
|
-
"invalid_value_array_empty": [
|
96
|
-
{
|
97
|
-
"type": "invalid_value_error",
|
98
|
-
"ref": "https://example.com/errors/invalid_value_error.html",
|
99
|
-
"message": "Invalid value array empty is invalid"
|
100
|
-
}
|
101
|
-
],
|
102
|
-
"invalid_value_array_not_empty": [
|
103
|
-
{
|
104
|
-
"type": "invalid_value_error",
|
105
|
-
"ref": "https://example.com/errors/invalid_value_error.html",
|
106
|
-
"message": "Invalid value array not empty is invalid"
|
107
|
-
}
|
108
|
-
],
|
109
|
-
"invalid_value_null": [
|
110
|
-
{
|
111
|
-
"type": "invalid_value_error",
|
112
|
-
"ref": "https://example.com/errors/invalid_value_error.html",
|
113
|
-
"message": "Invalid value null is invalid"
|
114
|
-
}
|
115
|
-
],
|
116
|
-
"invalid_value_not_null": [
|
117
|
-
{
|
118
|
-
"type": "invalid_value_error",
|
119
|
-
"ref": "https://example.com/errors/invalid_value_error.html",
|
120
|
-
"message": "Invalid value not null is invalid"
|
121
|
-
}
|
122
|
-
]
|
123
|
-
}
|
124
|
-
}
|
125
|
-
}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"input": {},
|
3
|
-
"expectation": {
|
4
|
-
"type": "input_validation_error",
|
5
|
-
"ref": "https://example.com/errors/input_validation_error.html",
|
6
|
-
"error_details": {
|
7
|
-
"missing_value": [
|
8
|
-
{
|
9
|
-
"type": "missing_value_error",
|
10
|
-
"ref": "https://example.com/errors/missing_value_error.html",
|
11
|
-
"message": "Missing value is missing"
|
12
|
-
}
|
13
|
-
]
|
14
|
-
}
|
15
|
-
}
|
16
|
-
}
|