glia-errors 0.0.1 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +3 -2
- data/README.md +14 -16
- 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 +2 -1
- data/lib/glia/errors/client_errors.rb +212 -0
- data/lib/glia/errors/error.rb +9 -1
- data/lib/glia/errors/error_types.rb +13 -0
- data/lib/glia/errors/mapper.rb +25 -27
- data/lib/glia/errors/server_errors.rb +27 -0
- metadata +6 -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
@@ -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
|
-
}
|