typed_params 1.2.3 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/typed_params/schema.rb +7 -6
- data/lib/typed_params/validations/length.rb +3 -0
- data/lib/typed_params/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93817bebe3143e4a3114ee89f5c58c955fd4d4a23867be62ef20f93dd92ebd87
|
4
|
+
data.tar.gz: b14419375705f406a269ba2e0867b3e055c2a2ab01a239a54d9b74584c161b8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e48186a002e8d9ddca748706cf6efad6728e498f46d7b818980305644b6d7f2d61f2fdb873c38680f5ddcbb812b99ac0b0655da97ee2533e4908bea0e66b661b
|
7
|
+
data.tar.gz: 0a9162c973fc0ec300fb5d4b6e95eb444469dab45ac338715e25622278febf62b378d0f71a11d917792763d291c552290799764f80912c8c27cbf075bc52d2c7
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.2.5
|
4
|
+
|
5
|
+
- Fix issue where a `minimum` and `maximum` constraint combo was not asserted by the `length:` validator.
|
6
|
+
|
7
|
+
## 1.2.4
|
8
|
+
|
9
|
+
- Fix issue where both `minimum` and `maximum` constraints could not be added to a `length:` validator.
|
10
|
+
|
3
11
|
## 1.2.3
|
4
12
|
|
5
13
|
- Remove `alias` from child lookup criteria in JSONAPI serializer.
|
data/lib/typed_params/schema.rb
CHANGED
@@ -66,13 +66,14 @@ module TypedParams
|
|
66
66
|
format.key?(:without)
|
67
67
|
)
|
68
68
|
|
69
|
-
raise ArgumentError, 'length must be a hash with :minimum, :maximum, :within, :in, or :is keys (but not multiple)' unless
|
69
|
+
raise ArgumentError, 'length must be a hash with :minimum, :maximum, :within, :in, or :is keys (but not multiple except for :minimum and :maximum)' unless
|
70
70
|
length.nil? || length.is_a?(Hash) && (
|
71
|
-
length.key?(:minimum)
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
71
|
+
length.key?(:minimum) && length.key?(:maximum) && length.size == 2 ||
|
72
|
+
length.key?(:minimum) ^
|
73
|
+
length.key?(:maximum) ^
|
74
|
+
length.key?(:within) ^
|
75
|
+
length.key?(:in) ^
|
76
|
+
length.key?(:is)
|
76
77
|
)
|
77
78
|
|
78
79
|
@controller = controller
|
@@ -7,6 +7,9 @@ module TypedParams
|
|
7
7
|
class Length < Validation
|
8
8
|
def call(value)
|
9
9
|
case options
|
10
|
+
in minimum: Numeric => min, maximum: Numeric => max
|
11
|
+
raise ValidationError, "length must be between #{min} and #{max} (inclusive)" unless
|
12
|
+
value.length >= min && value.length <= max
|
10
13
|
in minimum: Numeric => n
|
11
14
|
raise ValidationError, "length must be greater than or equal to #{n}" unless
|
12
15
|
value.length >= n
|
data/lib/typed_params/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typed_params
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zeke Gabrielse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
|
-
rubygems_version: 3.4.
|
121
|
+
rubygems_version: 3.4.19
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: Define structured and strongly-typed parameter schemas for your Rails controllers.
|