validate-params 0.12.4 → 0.12.5
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/CHANGELOG.md +5 -1
- data/Gemfile.lock +1 -1
- data/lib/validate_params/param_builder.rb +3 -3
- data/lib/validate_params/param_validator.rb +6 -0
- data/lib/validate_params/validatable.rb +0 -6
- data/lib/validate_params/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0efef56bcd7c8b05e33859d21078422a2a772d3dbb8241a9d0a0e5818c085a6
|
4
|
+
data.tar.gz: 23936b451c39e8b6425498c75383b4742ab8e43850f83960aeb200846d59dd32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 963d02b70917dfb1c81dbe672c62ff750c3ed76ae39943eb719e8385b90cf53e588c0d4599cff3551b367650f43a3f0b88cc975a7147e3a3f6f934670f99092f
|
7
|
+
data.tar.gz: 1ef4c60aba7a23cff17ad899ebe6996b77312203a0a5c11509dcc53bf66c6cd4801eb03d4af63e5fefcae4ce086de115e919c2e11b15390bd81d9a15c409d7e6
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -14,9 +14,9 @@ module ValidateParams
|
|
14
14
|
if children.any?
|
15
15
|
case type.to_s
|
16
16
|
when "Hash"
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
children.each do |child|
|
18
|
+
child_value = value[child.field] if value.is_a?(Hash) || value.is_a?(ActionController::Parameters)
|
19
|
+
child.valid?(child_value, errors)
|
20
20
|
end
|
21
21
|
when "Array"
|
22
22
|
values = value ? Array.wrap(value) : [nil]
|
@@ -30,6 +30,12 @@ module ValidateParams
|
|
30
30
|
end
|
31
31
|
|
32
32
|
private
|
33
|
+
def hash
|
34
|
+
return if @value.is_a?(Hash) || @value.is_a?(ActionController::Parameters)
|
35
|
+
|
36
|
+
@errors << { message: error_message }
|
37
|
+
end
|
38
|
+
|
33
39
|
def array
|
34
40
|
return if Types::Array.valid?(@value, **@options)
|
35
41
|
|
@@ -79,9 +79,6 @@ module ValidateParams
|
|
79
79
|
apply_default_values(sub_params, sub_validation)
|
80
80
|
end
|
81
81
|
elsif validation.type == Hash
|
82
|
-
# Skip in case hash is configured and string is passed
|
83
|
-
next if params[validation.field].is_a?(String)
|
84
|
-
|
85
82
|
params[validation.field] ||= {}
|
86
83
|
apply_default_values(params[validation.field], sub_validation)
|
87
84
|
else
|
@@ -108,9 +105,6 @@ module ValidateParams
|
|
108
105
|
|
109
106
|
validation.children.each do |sub_validation|
|
110
107
|
if validation.type == Hash
|
111
|
-
# Skip in case hash is configured and string is passed
|
112
|
-
next if params[validation.field].is_a?(String)
|
113
|
-
|
114
108
|
cast_param_values(params[validation.field], sub_validation)
|
115
109
|
elsif validation.type == Array
|
116
110
|
params[validation.field].each do |sub_params|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validate-params
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dcherevatenko
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -124,11 +124,11 @@ files:
|
|
124
124
|
- lib/validate_params/version.rb
|
125
125
|
- sig/validate_params.rbs
|
126
126
|
- validate_params.gemspec
|
127
|
-
homepage:
|
127
|
+
homepage:
|
128
128
|
licenses:
|
129
129
|
- MIT
|
130
130
|
metadata: {}
|
131
|
-
post_install_message:
|
131
|
+
post_install_message:
|
132
132
|
rdoc_options: []
|
133
133
|
require_paths:
|
134
134
|
- lib
|
@@ -143,8 +143,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '0'
|
145
145
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
147
|
-
signing_key:
|
146
|
+
rubygems_version: 3.3.26
|
147
|
+
signing_key:
|
148
148
|
specification_version: 4
|
149
149
|
summary: Gem to validate params in controllers
|
150
150
|
test_files: []
|