hanami-validations 2.1.0 → 2.2.0.beta2

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: bf16625f47c3fcb6d37f16d7a75403171b05a1c120eef33f5db5dc7bdab0cf99
4
- data.tar.gz: e112e405f8db82253d77861a0e8a94e45ad92541b536764c92e4d8e877764c2f
3
+ metadata.gz: f2562e95bb02433bb4b915d900694e888a52d7097b40e10a3337e830d3daf98c
4
+ data.tar.gz: 54bcb1b523f4966bfa961bd58c9196bafd36e1e9a9d1f57558a8d5f29de5e3cd
5
5
  SHA512:
6
- metadata.gz: 872245828bec185fd132d17ec64099905e9a6af65736e6f55148f8984620063ba783fcfb72471f264e72da55799e813f34973fa4e693bfabf6dc8a2927b0af95
7
- data.tar.gz: fb07e0e939c375814c07844a5609ab4faebded86c6e8a882f9b786af7fc4eb087ca75cbdee4d976989e68c74056a7ccb98220fa3ff814e741bb06f3b18a333f9
6
+ metadata.gz: d6e377b7e05589b647d0b51e69d101dfff14a1aa043da684c7166c7e04890c9b5e33a819cdb8f7b83f24bbd5e3b147df1b9179d1236176219f48a0dccf982c7c
7
+ data.tar.gz: 33157d4d4c3c5bec1b57f5184c710a5e6b4ee89695554354dd4e0f43999eee4effc3a9a3741c7a86485e658860ac310785c96153924400894955c90eb03ec3b1
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  Validations mixin for Ruby objects
4
4
 
5
+ ## v2.2.0.beta2 - 2024-09-25
6
+
7
+ ### Changed
8
+
9
+ - [Tim Riley] Remove all Ruby code from the gem. This gem now exists only to manage the dependency on dry-validation. (#230)
10
+
11
+ ## v2.2.0.beta1 - 2024-07-16
12
+
13
+ ### Changed
14
+
15
+ - Drop support for Ruby 3.0
16
+
5
17
  ## v2.1.0 - 2024-02-27
6
18
 
7
19
  ## v2.1.0.rc3 - 2024-02-16
data/README.md CHANGED
@@ -5,14 +5,9 @@ Internal support gem for `Hanami::Action` params validation.
5
5
  ## Status
6
6
 
7
7
  [![Gem Version](https://badge.fury.io/rb/hanami-validations.svg)](https://badge.fury.io/rb/hanami-validations)
8
- [![CI](https://github.com/hanami/validations/workflows/ci/badge.svg?branch=main)](https://github.com/hanami/validations/actions?query=workflow%3Aci+branch%3Amain)
8
+ [![CI](https://github.com/hanami/validations/actions/workflows/ci.yml/badge.svg)](https://github.com/hanami/validations/actions?query=workflow%3Aci+branch%3Amain)
9
9
  [![Test Coverage](https://codecov.io/gh/hanami/validations/branch/main/graph/badge.svg)](https://codecov.io/gh/hanami/validations)
10
10
  [![Depfu](https://badges.depfu.com/badges/af6c6be539d9d587c7541ae7a013c9ff/overview.svg)](https://depfu.com/github/hanami/validations?project=Bundler)
11
- [![Inline Docs](http://inch-ci.org/github/hanami/validations.svg)](http://inch-ci.org/github/hanami/validations)
12
-
13
- ## Version
14
-
15
- **This branch contains the code for `hanami-validations` 2.x.**
16
11
 
17
12
  ## Contact
18
13
 
@@ -20,17 +15,14 @@ Internal support gem for `Hanami::Action` params validation.
20
15
  * Community: http://hanamirb.org/community
21
16
  * Guides: https://guides.hanamirb.org
22
17
  * Mailing List: http://hanamirb.org/mailing-list
23
- * API Doc: http://rdoc.info/gems/hanami-validations
18
+ * API Doc: http://rubydoc.info/gems/hanami-validations
24
19
  * Bugs/Issues: https://github.com/hanami/validations/issues
25
- * Support: http://stackoverflow.com/questions/tagged/hanami
26
20
  * Chat: http://chat.hanamirb.org
27
21
 
28
- ## Rubies
29
-
30
- __Hanami::Validations__ supports Ruby (MRI) 3.0+
31
-
32
22
  ## Installation
33
23
 
24
+ __Hanami::Validations__ supports Ruby (MRI) 3.1+
25
+
34
26
  Add this line to your application's Gemfile:
35
27
 
36
28
  ```ruby
@@ -86,4 +78,4 @@ See [hanami-controller][controller] for more detail on params validation.
86
78
 
87
79
  ## Copyright
88
80
 
89
- Copyright © 2014 Hanami Team – Released under MIT License
81
+ Copyright © 2014–2024 Hanami Team – Released under MIT License
@@ -18,10 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
  spec.metadata["rubygems_mfa_required"] = "true"
21
- spec.required_ruby_version = ">= 3.0"
21
+ spec.required_ruby_version = ">= 3.1"
22
22
 
23
23
  spec.add_dependency "dry-validation", ">= 1.10", "< 2"
24
- spec.add_dependency "zeitwerk", "~> 2.6.0"
25
24
 
26
25
  spec.add_development_dependency "bundler", ">= 1.6", "< 3"
27
26
  spec.add_development_dependency "rake", "~> 13"
@@ -6,6 +6,6 @@ module Hanami
6
6
  #
7
7
  # @since 0.1.0
8
8
  # @api public
9
- VERSION = "2.1.0"
9
+ VERSION = "2.2.0.beta2"
10
10
  end
11
11
  end
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "dry/validation"
4
- require "delegate"
5
- require "zeitwerk"
6
4
 
7
5
  # @see Hanami::Validations
8
6
  # @since 0.1.0
@@ -10,100 +8,6 @@ module Hanami
10
8
  # @since 0.1.0
11
9
  # @api private
12
10
  module Validations
13
- # @since 2.0.0
14
- # @api private
15
- def self.gem_loader
16
- @gem_loader ||= Zeitwerk::Loader.new.tap do |loader|
17
- root = File.expand_path("..", __dir__)
18
- loader.tag = "hanami-validations"
19
- loader.inflector = Zeitwerk::GemInflector.new("#{root}/hanami-validations.rb")
20
- loader.push_dir(root)
21
- loader.ignore(
22
- "#{root}/hanami-validations.rb",
23
- "#{root}/hanami/validations/version.rb"
24
- )
25
- end
26
- end
27
-
28
- gem_loader.setup
29
11
  require_relative "validations/version"
30
-
31
- # @since 0.1.0
32
- # @api private
33
- def self.included(klass)
34
- super
35
- klass.extend(ClassMethods)
36
- end
37
-
38
- # @since 2.0.0
39
- # @api private
40
- class Result < SimpleDelegator
41
- # @since 2.0.0
42
- # @api private
43
- def output
44
- __getobj__.to_h
45
- end
46
-
47
- # @since 2.0.0
48
- # @api private
49
- def messages
50
- __getobj__.errors.to_h
51
- end
52
- end
53
-
54
- # Validations DSL
55
- #
56
- # @since 0.1.0
57
- # @api private
58
- module ClassMethods
59
- # Define validation rules from the given block.
60
- #
61
- # @param blk [Proc] validation rules
62
- #
63
- # @since 0.6.0
64
- # @api private
65
- def validations(&blk)
66
- @_validator = Dry::Validation::Contract.build { schema(&blk) }
67
- end
68
-
69
- # @since 2.0.0
70
- # @api private
71
- def _validator
72
- @_validator
73
- end
74
- end
75
-
76
- # Initialize a new instance of a validator
77
- #
78
- # @param input [#to_h] a set of input data
79
- #
80
- # @since 0.6.0
81
- # @api private
82
- def initialize(input)
83
- @input = input
84
- end
85
-
86
- # Validates the object.
87
- #
88
- # @return [Hanami::Validations::Result]
89
- #
90
- # @since 0.2.4
91
- # @api private
92
- def validate
93
- Result.new(
94
- self.class._validator.call(@input)
95
- )
96
- end
97
-
98
- # Returns a Hash with the defined attributes as symbolized keys, and their
99
- # relative values.
100
- #
101
- # @return [Hash]
102
- #
103
- # @since 0.1.0
104
- # @api private
105
- def to_h
106
- validate.to_h
107
- end
108
12
  end
109
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-27 00:00:00.000000000 Z
11
+ date: 2024-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-validation
@@ -30,20 +30,6 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '2'
33
- - !ruby/object:Gem::Dependency
34
- name: zeitwerk
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: 2.6.0
40
- type: :runtime
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: 2.6.0
47
33
  - !ruby/object:Gem::Dependency
48
34
  name: bundler
49
35
  requirement: !ruby/object:Gem::Requirement
@@ -119,9 +105,7 @@ files:
119
105
  - hanami-validations.gemspec
120
106
  - lib/hanami-validations.rb
121
107
  - lib/hanami/validations.rb
122
- - lib/hanami/validations/form.rb
123
108
  - lib/hanami/validations/version.rb
124
- - lib/hanami/validator.rb
125
109
  homepage: http://hanamirb.org
126
110
  licenses:
127
111
  - MIT
@@ -135,14 +119,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
119
  requirements:
136
120
  - - ">="
137
121
  - !ruby/object:Gem::Version
138
- version: '3.0'
122
+ version: '3.1'
139
123
  required_rubygems_version: !ruby/object:Gem::Requirement
140
124
  requirements:
141
125
  - - ">="
142
126
  - !ruby/object:Gem::Version
143
127
  version: '0'
144
128
  requirements: []
145
- rubygems_version: 3.5.6
129
+ rubygems_version: 3.5.16
146
130
  signing_key:
147
131
  specification_version: 4
148
132
  summary: Validations mixin for Ruby objects
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Hanami
4
- module Validations
5
- # Validations mixin for forms/HTTP params.
6
- #
7
- # @since 0.6.0
8
- # @api private
9
- module Form
10
- # @since 2.0.0
11
- # @api private
12
- class BaseValidator < Dry::Validation::Contract
13
- params do
14
- optional(:_csrf_token).filled(:string)
15
- end
16
- end
17
-
18
- # @since 0.6.0
19
- # @api private
20
- def self.included(klass)
21
- super
22
-
23
- klass.class_eval do
24
- include ::Hanami::Validations
25
- extend ClassMethods
26
- end
27
- end
28
-
29
- # @since 0.6.0
30
- # @api private
31
- module ClassMethods
32
- # @since 2.0.0
33
- # @api private
34
- def validations(&blk)
35
- @_validator = Class.new(BaseValidator) { params(&blk) }.new
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "dry/validation"
4
-
5
- module Hanami
6
- # @since 2.0.0
7
- # @api private
8
- class Validator < Dry::Validation::Contract
9
- end
10
- end