definition 1.1.2 → 1.1.3

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: 9d395d2c71aea47ece41fdb8904a8c2135b4b18ae35f602e262d38778a56bdfb
4
- data.tar.gz: ae7f24b7b01f040f0df1acc375834ac880c4299368b2ac0c8721ab26fbff1866
3
+ metadata.gz: 1d470c4571e1a6f9c4219e749fc16185a5b5064bd663e38505bcad0396f14643
4
+ data.tar.gz: 9f53529e9420d2b4346dfa7edb2d5540ed5771682e86dd9bd55ed143c97b8230
5
5
  SHA512:
6
- metadata.gz: ec02230f3a42281334841075805b205ca5455d8034835e5da363b32a6905ad9c1cdf47f7b3f036c4696e0ac845cc049cd44dfaa65f0fb9a1c724e7cce991519d
7
- data.tar.gz: 29b6f124f85ec5925bb4319053efa505fabb45fe130897faa43dd036f3542fe44ef791df543c2e5a2bce36c7706d516f9c8170437981fa8ffdc52dfa8d4fa07e
6
+ metadata.gz: e35a9cf9a7d0a171f655b6e637b850af4c8b81db15e01761cea554ca9d25150e2fcdcfae90b74e96af9aa771aef5223aa0defc12ce806286976c3bae9b7e9146
7
+ data.tar.gz: 75f9314d97647f14079ae7d476d7f1d7ec1fd9f0ab859adc67b6aca84ac27bdf22ee00f5dfa1d397e8c8548f0e6f95dc69787d9b036103f89a3fc1ea79958cc4
@@ -3,9 +3,9 @@ name: actions
3
3
 
4
4
  on:
5
5
  push:
6
- branches: [ main, master ]
6
+ branches: [main, master]
7
7
  pull_request:
8
- branches: [ main, master ]
8
+ branches: [main, master]
9
9
 
10
10
  permissions:
11
11
  contents: read
@@ -16,7 +16,7 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby-version: ["2.7", "3.0", "3.1", "3.2", "3.3", "jruby-9.3", "jruby-9.4"]
19
+ ruby-version: ["2.7", "3.0", "3.1", "3.2", "3.3", "jruby-9.4"]
20
20
  steps:
21
21
  - uses: actions/checkout@v3
22
22
  - uses: ruby/setup-ruby@v1
@@ -25,4 +25,4 @@ jobs:
25
25
  bundler-cache: false
26
26
  - run: bundle install
27
27
  - run: bundle exec rspec
28
- - run: bundle exec rubocop
28
+ - run: bundle exec rubocop
data/Changelog.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Changelog
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
 
4
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
@@ -6,95 +7,147 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
7
 
7
8
  ## Unreleased
8
9
 
10
+ ## [1.1.3] - 2025-10-27
11
+
12
+ ### Fixed
13
+
14
+ - Fixed TypeError when using Definition.CoercibleType with certain non coercible values
15
+
9
16
  ## [1.1.2] - 2024-08-22
17
+
10
18
  ### Fixed
11
- - Fixed "TypeError: no _dump_data is defined for class Proc" error that ocurred when a definition model inherits from another model that uses lambda based definitions
19
+
20
+ - Fixed "TypeError: no \_dump_data is defined for class Proc" error that ocurred when a definition model inherits from another model that uses lambda based definitions
12
21
 
13
22
  ## [1.1.1] - 2024-05-21
23
+
14
24
  ### Fixed
25
+
15
26
  - Fixed Definition::Model inheritance
16
27
 
17
28
  ## [1.1.0] - 2023-11-22
29
+
18
30
  ### Changes
31
+
19
32
  - Improved performance
20
33
 
21
34
  ## [1.0.0] - 2023-02-14
35
+
22
36
  ### Removed
37
+
23
38
  - Removed deprecated version of `GreaterThanEqual` definition that had a typo in it (GreaterThenEqual)
24
39
  - Removed deprecated version of `GreaterThan` definition that had a typo in it (GreaterThen)
25
40
  - Removed deprecated version of `LessThanEqual` definition that had a typo in it (LessThenEqual)
26
41
  - Removed deprecated version of `LessThan` definition that had a typo in it (LessThen)
27
42
 
28
43
  ## [0.8.1] - 2022-10-05
44
+
29
45
  ### Fixed
46
+
30
47
  - Definition::Model#eql? returns true when comparing two models with the same content
31
48
 
32
49
  ## [0.8.0] - 2022-10-05
50
+
33
51
  ### Added
52
+
34
53
  - A Definition::Initializer mixin that can be used to validate keyword arguments of a class constructor
35
54
 
36
55
  ### Changes
56
+
37
57
  - Include more information in the internal non-translated error messages. E.g. the max size of a LessThenEqual definition
38
58
  - Renamed GreaterThen, GreaterThenEqual, LessThen and LessThenEqual to fix typo (Then VS Than) Backwards compatibility is ensured
39
59
 
40
60
  ### Breaking changes
61
+
41
62
  - The Definition::ValueObject was removed and replaced by Definition:Model which has a nicer DSL and only works with hash data structures. See [upgrade notes](./UpgradeNotes.md)
42
63
 
43
64
  ## [0.7.1] - 2022-03-04
65
+
44
66
  ### Fixed
67
+
45
68
  - Float coercion: check for nil before coercion
46
69
 
47
70
  ## [0.7.0] - 2022-02-25
71
+
48
72
  ### Added
73
+
49
74
  - Lambda definitions can now be failed with custom error messages
50
75
  - Compatibility with Ruby 3.0
76
+
51
77
  ### Fixed
78
+
52
79
  - In some cases errors from nested `Keys` definitions inside `Or` definitions got lost when listing the validation errors via the `error_hash` method on the conform result object.
80
+
53
81
  ### Changed
82
+
54
83
  - When no sub-definition of an `Or` conforms, then only the errors of the last definition of the `Or` are collected. Previously the errors of all sub-definitions were collected.
55
84
  - Translated error messages have been improved to be more suitable to be used as end user error messages
56
85
 
57
86
  ## [0.6.1] - 2021-12-14
87
+
58
88
  ### Fixed
89
+
59
90
  - The `Keys` definition crashed with an error if the input was not a Hash
60
91
 
61
92
  ## [0.6.0] - 2020-03-21
93
+
62
94
  ### Added
95
+
63
96
  - Added include method to Keys Definition that allows to inline other `Keys` Definitions into each other
64
97
 
65
98
  ## [0.5.2] - 2019-06-03
99
+
66
100
  ### Fixed
101
+
67
102
  - added missing require for "pathname"
68
103
 
69
104
  ## [0.5.1] - 2019-04-27
105
+
70
106
  ### Fixed
107
+
71
108
  - Typo in error debug output
72
109
 
73
110
  ## [0.5.0] - 2019-03-28
111
+
74
112
  ### Added
113
+
75
114
  - CoercibleValueObject Definition for better nesting of ValueObjects
76
115
  - Nilable Definition as shortcut for nil OR some other definition
77
116
  - Option for Keys Definition to ignore unexpected keys
117
+
78
118
  ### Fixed
119
+
79
120
  - Error hash was missing some errors in a few cases
80
121
  - `ConformResult.error_hash` was empty for Definitions without any `Keys` Definition
122
+
81
123
  ### Changed
124
+
82
125
  - And Definition stops processing after the first failure
83
126
 
84
127
  ## [0.4.0] - 2019-03-22
128
+
85
129
  ### Added
130
+
86
131
  - Added support for default values to Keys Definition
132
+
87
133
  ### Changed
134
+
88
135
  - Errors returned from ConformResult were restructured for better debugging and usage
89
136
 
90
137
  ## [0.3.0] - 2019-02-03
138
+
91
139
  ### Added
140
+
92
141
  - Added I18n translation support for errors
93
142
 
94
143
  ## [0.2.0] - 2019-01-13
144
+
95
145
  ### Added
146
+
96
147
  - Added built in definitions for common usecases (e.g. string length validation)
97
148
 
98
149
  ## [0.1.0] - 2019-01-12
150
+
99
151
  ### Added
152
+
100
153
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- definition (1.1.2)
4
+ definition (1.1.3)
5
5
  activesupport
6
6
  i18n
7
7
 
@@ -64,9 +64,9 @@ GEM
64
64
  minitest (5.21.2)
65
65
  mutex_m (0.2.0)
66
66
  nenv (0.3.0)
67
- nokogiri (1.16.5-arm64-darwin)
67
+ nokogiri (1.18.4-arm64-darwin)
68
68
  racc (~> 1.4)
69
- nokogiri (1.16.5-x86_64-linux)
69
+ nokogiri (1.18.4-x86_64-linux-gnu)
70
70
  racc (~> 1.4)
71
71
  notiffany (0.1.3)
72
72
  nenv (~> 0.1)
@@ -80,7 +80,7 @@ GEM
80
80
  method_source (~> 1.0)
81
81
  psych (5.1.2)
82
82
  stringio
83
- racc (1.8.0)
83
+ racc (1.8.1)
84
84
  rainbow (3.1.1)
85
85
  rake (13.1.0)
86
86
  rb-fsevent (0.11.2)
@@ -42,7 +42,7 @@ module Definition
42
42
  end
43
43
  Types::Type.new(:type, klass) do |value|
44
44
  method(klass.name).call(value)
45
- rescue ArgumentError
45
+ rescue ArgumentError, TypeError
46
46
  value
47
47
  end
48
48
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Definition
4
- VERSION = "1.1.2"
4
+ VERSION = "1.1.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: definition
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Goltermann
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-08-22 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -248,7 +247,6 @@ dependencies:
248
247
  - - ">="
249
248
  - !ruby/object:Gem::Version
250
249
  version: '0'
251
- description:
252
250
  email:
253
251
  - dominik@goltermann.cc
254
252
  executables: []
@@ -306,7 +304,6 @@ homepage: https://github.com/Goltergaul/definition
306
304
  licenses:
307
305
  - MIT
308
306
  metadata: {}
309
- post_install_message:
310
307
  rdoc_options: []
311
308
  require_paths:
312
309
  - lib
@@ -321,8 +318,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
321
318
  - !ruby/object:Gem::Version
322
319
  version: '0'
323
320
  requirements: []
324
- rubygems_version: 3.5.3
325
- signing_key:
321
+ rubygems_version: 3.6.9
326
322
  specification_version: 4
327
323
  summary: Simple and composable validation and coercion of data structures inspired
328
324
  by clojure specs