rails-param-validation 0.5.1 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c134fc7bf927e77c75f9f0ceea3c70b6cd6c41a6f3a92c9c844ef1aa9e9a42cf
4
- data.tar.gz: 175a26a3e77b509fcc78930c4ba1b0bd2610f3d0ef32551caca22aa5166651b9
3
+ metadata.gz: 3d4a510f0de54c4741dd9fb9f1554401754cc5da6ddb5b5636d3b2e8e0b884ff
4
+ data.tar.gz: accad13ee4bdf6ed8d8fddbdc24162e3ef12425357587498096d0948efeae536
5
5
  SHA512:
6
- metadata.gz: b08ebb1ff75d4c796a6e98d5a00a35a5c3ff64627b91f5725624c45458062de70766ddd265bf825bb03109486b6113f11ff9f2801fa75e612bd7f0fa74652f49
7
- data.tar.gz: abc4541ff22b671bba84cd39e5a666fe36af49afed76e3eb509463b42f03970c10b86bb6194252f8f47163bade5a625ef411eab1e67da737038dbcd3b4d95337
6
+ metadata.gz: 5cfea3b5a566e224fd6177e23088e6e8ecacdeb2e32c966d13cce6324a572bfaeb85a653cb0125d3e82c976d5a87a0d52e9dc3f7dce101ab9cead4404209b8b7
7
+ data.tar.gz: cb099d734cdf16b68a377365ae55a3439eb71eee88fbb3835767e1295ae7138e8820e57b9a57f1c476dc80151ac4d7ab02ca3dfec31d7f1e4632797f8c5838b1
@@ -6,6 +6,9 @@ class AlternativesValidator < Validator
6
6
  super schema, collection
7
7
 
8
8
  @inner_validators = schema.map { |value| ValidatorFactory.create(value, collection) }
9
+ if @inner_validators.all? { |v| v.is_a?(ConstantValidator) }
10
+ @inner_validators.sort_by! { |v| v.constant.to_s }
11
+ end
9
12
  end
10
13
 
11
14
  def matches?(path, data)
@@ -1,6 +1,8 @@
1
1
  module RailsParamValidation
2
2
 
3
3
  class ConstantValidator < Validator
4
+ attr_reader :constant
5
+
4
6
  CLASS_MAP = { TrueClass => Boolean, FalseClass => Boolean }
5
7
 
6
8
  def initialize(schema, collection)
@@ -3,6 +3,7 @@ module RailsParamValidation
3
3
  class ObjectValidator < Validator
4
4
  # @param [Hash] schema
5
5
  def initialize(schema, collection)
6
+ schema = schema.map { |k, v| [k.to_s, v] }.sort.to_h
6
7
  super schema, collection
7
8
 
8
9
  @inner_validators = schema.map { |key, value| [key, ValidatorFactory.create(value, collection)] }.to_h
@@ -1,3 +1,3 @@
1
1
  module RailsParamValidation
2
- VERSION = "0.5.1"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-param-validation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oskar Kirmis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-30 00:00:00.000000000 Z
11
+ date: 2023-12-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Declarative parameter definition and validation for Rails
14
14
  email: