interactor-validation 0.3.8 → 0.4.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/README.md +218 -1355
- data/benchmark/validation_benchmark.rb +0 -3
- data/lib/interactor/validation/configuration.rb +4 -26
- data/lib/interactor/validation/core_ext.rb +120 -0
- data/lib/interactor/validation/errors.rb +49 -0
- data/lib/interactor/validation/params.rb +6 -16
- data/lib/interactor/validation/validates.rb +118 -816
- data/lib/interactor/validation/validators/array.rb +20 -0
- data/lib/interactor/validation/validators/boolean.rb +15 -0
- data/lib/interactor/validation/validators/format.rb +17 -0
- data/lib/interactor/validation/validators/hash.rb +43 -0
- data/lib/interactor/validation/validators/inclusion.rb +17 -0
- data/lib/interactor/validation/validators/length.rb +46 -0
- data/lib/interactor/validation/validators/numeric.rb +46 -0
- data/lib/interactor/validation/validators/presence.rb +16 -0
- data/lib/interactor/validation/version.rb +1 -1
- data/lib/interactor/validation.rb +13 -44
- data/smoke_test.rb +252 -0
- metadata +28 -44
- data/lib/interactor/validation/error_codes.rb +0 -51
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: interactor-validation
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Wilson Anciro
|
|
@@ -10,73 +10,47 @@ cert_chain: []
|
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
|
-
name:
|
|
14
|
-
requirement: !ruby/object:Gem::Requirement
|
|
15
|
-
requirements:
|
|
16
|
-
- - ">="
|
|
17
|
-
- !ruby/object:Gem::Version
|
|
18
|
-
version: '6.0'
|
|
19
|
-
- - "<"
|
|
20
|
-
- !ruby/object:Gem::Version
|
|
21
|
-
version: '9.0'
|
|
22
|
-
type: :runtime
|
|
23
|
-
prerelease: false
|
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
requirements:
|
|
26
|
-
- - ">="
|
|
27
|
-
- !ruby/object:Gem::Version
|
|
28
|
-
version: '6.0'
|
|
29
|
-
- - "<"
|
|
30
|
-
- !ruby/object:Gem::Version
|
|
31
|
-
version: '9.0'
|
|
32
|
-
- !ruby/object:Gem::Dependency
|
|
33
|
-
name: activesupport
|
|
13
|
+
name: interactor
|
|
34
14
|
requirement: !ruby/object:Gem::Requirement
|
|
35
15
|
requirements:
|
|
36
|
-
- - "
|
|
37
|
-
- !ruby/object:Gem::Version
|
|
38
|
-
version: '6.0'
|
|
39
|
-
- - "<"
|
|
16
|
+
- - "~>"
|
|
40
17
|
- !ruby/object:Gem::Version
|
|
41
|
-
version: '
|
|
18
|
+
version: '3.0'
|
|
42
19
|
type: :runtime
|
|
43
20
|
prerelease: false
|
|
44
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
45
22
|
requirements:
|
|
46
|
-
- - "
|
|
47
|
-
- !ruby/object:Gem::Version
|
|
48
|
-
version: '6.0'
|
|
49
|
-
- - "<"
|
|
23
|
+
- - "~>"
|
|
50
24
|
- !ruby/object:Gem::Version
|
|
51
|
-
version: '
|
|
25
|
+
version: '3.0'
|
|
52
26
|
- !ruby/object:Gem::Dependency
|
|
53
|
-
name:
|
|
27
|
+
name: fuubar
|
|
54
28
|
requirement: !ruby/object:Gem::Requirement
|
|
55
29
|
requirements:
|
|
56
30
|
- - "~>"
|
|
57
31
|
- !ruby/object:Gem::Version
|
|
58
|
-
version: '
|
|
59
|
-
type: :
|
|
32
|
+
version: '2.5'
|
|
33
|
+
type: :development
|
|
60
34
|
prerelease: false
|
|
61
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
62
36
|
requirements:
|
|
63
37
|
- - "~>"
|
|
64
38
|
- !ruby/object:Gem::Version
|
|
65
|
-
version: '
|
|
39
|
+
version: '2.5'
|
|
66
40
|
- !ruby/object:Gem::Dependency
|
|
67
|
-
name:
|
|
41
|
+
name: pry
|
|
68
42
|
requirement: !ruby/object:Gem::Requirement
|
|
69
43
|
requirements:
|
|
70
44
|
- - "~>"
|
|
71
45
|
- !ruby/object:Gem::Version
|
|
72
|
-
version: '
|
|
46
|
+
version: '0.14'
|
|
73
47
|
type: :development
|
|
74
48
|
prerelease: false
|
|
75
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
76
50
|
requirements:
|
|
77
51
|
- - "~>"
|
|
78
52
|
- !ruby/object:Gem::Version
|
|
79
|
-
version: '
|
|
53
|
+
version: '0.14'
|
|
80
54
|
- !ruby/object:Gem::Dependency
|
|
81
55
|
name: rspec
|
|
82
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -119,8 +93,8 @@ dependencies:
|
|
|
119
93
|
- - "~>"
|
|
120
94
|
- !ruby/object:Gem::Version
|
|
121
95
|
version: '0.22'
|
|
122
|
-
description:
|
|
123
|
-
|
|
96
|
+
description: Lightweight, zero-dependency validation for Interactor service objects.
|
|
97
|
+
Supports presence, format, length, inclusion, numericality, and nested validations.
|
|
124
98
|
email:
|
|
125
99
|
- konekred@gmail.com
|
|
126
100
|
executables: []
|
|
@@ -135,11 +109,21 @@ files:
|
|
|
135
109
|
- benchmark/validation_benchmark.rb
|
|
136
110
|
- lib/interactor/validation.rb
|
|
137
111
|
- lib/interactor/validation/configuration.rb
|
|
138
|
-
- lib/interactor/validation/
|
|
112
|
+
- lib/interactor/validation/core_ext.rb
|
|
113
|
+
- lib/interactor/validation/errors.rb
|
|
139
114
|
- lib/interactor/validation/params.rb
|
|
140
115
|
- lib/interactor/validation/validates.rb
|
|
116
|
+
- lib/interactor/validation/validators/array.rb
|
|
117
|
+
- lib/interactor/validation/validators/boolean.rb
|
|
118
|
+
- lib/interactor/validation/validators/format.rb
|
|
119
|
+
- lib/interactor/validation/validators/hash.rb
|
|
120
|
+
- lib/interactor/validation/validators/inclusion.rb
|
|
121
|
+
- lib/interactor/validation/validators/length.rb
|
|
122
|
+
- lib/interactor/validation/validators/numeric.rb
|
|
123
|
+
- lib/interactor/validation/validators/presence.rb
|
|
141
124
|
- lib/interactor/validation/version.rb
|
|
142
125
|
- sig/interactor/validation.rbs
|
|
126
|
+
- smoke_test.rb
|
|
143
127
|
homepage: https://github.com/zyxzen/interactor-validation
|
|
144
128
|
licenses:
|
|
145
129
|
- MIT
|
|
@@ -160,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
160
144
|
- !ruby/object:Gem::Version
|
|
161
145
|
version: '0'
|
|
162
146
|
requirements: []
|
|
163
|
-
rubygems_version: 3.
|
|
147
|
+
rubygems_version: 3.7.2
|
|
164
148
|
specification_version: 4
|
|
165
|
-
summary:
|
|
149
|
+
summary: Minimal parameter validation for Interactor
|
|
166
150
|
test_files: []
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Interactor
|
|
4
|
-
module Validation
|
|
5
|
-
# Error code constants for structured error messages
|
|
6
|
-
module ErrorCodes
|
|
7
|
-
REQUIRED = "IS_REQUIRED"
|
|
8
|
-
MUST_BE_BOOLEAN = "MUST_BE_BOOLEAN"
|
|
9
|
-
INVALID_FORMAT = "INVALID_FORMAT"
|
|
10
|
-
NOT_IN_ALLOWED_VALUES = "NOT_IN_ALLOWED_VALUES"
|
|
11
|
-
MUST_BE_A_NUMBER = "MUST_BE_A_NUMBER"
|
|
12
|
-
INVALID_TYPE = "INVALID_TYPE"
|
|
13
|
-
REGEX_TIMEOUT = "REGEX_TIMEOUT"
|
|
14
|
-
ARRAY_TOO_LARGE = "ARRAY_TOO_LARGE"
|
|
15
|
-
|
|
16
|
-
# Generate length error codes
|
|
17
|
-
def self.exceeds_max_length(count)
|
|
18
|
-
"EXCEEDS_MAX_LENGTH_#{count}"
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def self.below_min_length(count)
|
|
22
|
-
"BELOW_MIN_LENGTH_#{count}"
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def self.must_be_length(count)
|
|
26
|
-
"MUST_BE_LENGTH_#{count}"
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# Generate numeric comparison error codes
|
|
30
|
-
def self.must_be_greater_than(count)
|
|
31
|
-
"MUST_BE_GREATER_THAN_#{count}"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def self.must_be_at_least(count)
|
|
35
|
-
"MUST_BE_AT_LEAST_#{count}"
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def self.must_be_less_than(count)
|
|
39
|
-
"MUST_BE_LESS_THAN_#{count}"
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def self.must_be_at_most(count)
|
|
43
|
-
"MUST_BE_AT_MOST_#{count}"
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def self.must_be_equal_to(count)
|
|
47
|
-
"MUST_BE_EQUAL_TO_#{count}"
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|