typed_params 1.2.4 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f9d9f861e13643b5a7a2b838a044b57b21d278fc675f73b0fbbef6796c45570
4
- data.tar.gz: 90f1efd567af8306b47dc45966eb4b7aa60604a4a4fe3b6a7f131623f3a098c2
3
+ metadata.gz: 2b621fc5ea6362816239e4c5090b7fb9879d74fc7857b14a35f38f238f4152ac
4
+ data.tar.gz: ad6356fcd549587faa23baa5fd27a1d2dc515a49ef332aa2b10fb2eba025cbff
5
5
  SHA512:
6
- metadata.gz: c13b18a4cbe8053b7257d1e48b69e91079ceb64ebc726593efc1b42824b140f9142376a92ba85c87e6e9f6a8e3906b8aa49b025e6d8a9a03c7bcca111acc7c92
7
- data.tar.gz: fde46708d885ef36fa4c18deebb7da4f374236ca6d72b15916bcd88a77b8a29ceb7d79ab8ab2a8a861c8bcde7c203076c88e02d51ab6be9c097f18389a82bd7f
6
+ metadata.gz: 83cc91b95282b83e264fcd085c2269eb090106ae8769231e2af36c4738fb950df57a4e08e4b6e922a157858e8850847df1952d8091882d4578edc453c22741cd
7
+ data.tar.gz: 8ebdf734c19540796192f1d87cf8088cf53e1d3abb4b25e9d51da7db20753fbce71ed1e997aae622493f763c3e739402ab45eb3a7545d6fc9d5237d17344538b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.6
4
+
5
+ - Fix issue where an empty param of type `hash` or `array` would not raise when a required but `allow_nil` child param was missing.
6
+
7
+ ## 1.2.5
8
+
9
+ - Fix issue where a `minimum` and `maximum` constraint combo was not asserted by the `length:` validator.
10
+
3
11
  ## 1.2.4
4
12
 
5
13
  - Fix issue where both `minimum` and `maximum` constraints could not be added to a `length:` validator.
data/README.md CHANGED
@@ -44,7 +44,7 @@ Sponsored by:
44
44
  </div>
45
45
  </a>
46
46
 
47
- _An open, source-available software licensing and distribution API._
47
+ _A fair source software licensing and distribution API._
48
48
 
49
49
  __
50
50
 
@@ -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
@@ -6,7 +6,7 @@ module TypedParams
6
6
  class Validator < Mapper
7
7
  def call(params)
8
8
  raise InvalidParameterError.new('is missing', path: schema.path, source: schema.source) if
9
- params.nil? && schema.required? && !schema.allow_nil?
9
+ params.nil? && schema.required?
10
10
 
11
11
  depth_first_map(params) do |param|
12
12
  schema = param.schema
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TypedParams
4
- VERSION = '1.2.4'
4
+ VERSION = '1.2.6'
5
5
  end
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
4
+ version: 1.2.6
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-04-26 00:00:00.000000000 Z
11
+ date: 2025-02-05 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.13
121
+ rubygems_version: 3.5.11
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Define structured and strongly-typed parameter schemas for your Rails controllers.