dry-types 1.1.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +378 -206
- data/LICENSE +17 -17
- data/README.md +14 -13
- data/dry-types.gemspec +27 -31
- data/lib/dry/types.rb +7 -11
- data/lib/dry/types/any.rb +2 -2
- data/lib/dry/types/array/member.rb +3 -3
- data/lib/dry/types/builder.rb +5 -1
- data/lib/dry/types/builder_methods.rb +22 -8
- data/lib/dry/types/coercions.rb +6 -0
- data/lib/dry/types/coercions/params.rb +1 -1
- data/lib/dry/types/compiler.rb +2 -2
- data/lib/dry/types/constrained.rb +2 -2
- data/lib/dry/types/constructor.rb +7 -34
- data/lib/dry/types/constructor/function.rb +17 -31
- data/lib/dry/types/core.rb +3 -1
- data/lib/dry/types/decorator.rb +3 -9
- data/lib/dry/types/default.rb +2 -2
- data/lib/dry/types/enum.rb +2 -2
- data/lib/dry/types/errors.rb +5 -5
- data/lib/dry/types/extensions.rb +4 -0
- data/lib/dry/types/extensions/maybe.rb +14 -14
- data/lib/dry/types/extensions/monads.rb +29 -0
- data/lib/dry/types/hash.rb +3 -2
- data/lib/dry/types/lax.rb +2 -5
- data/lib/dry/types/meta.rb +3 -3
- data/lib/dry/types/module.rb +3 -3
- data/lib/dry/types/nominal.rb +1 -1
- data/lib/dry/types/params.rb +6 -0
- data/lib/dry/types/predicate_inferrer.rb +197 -0
- data/lib/dry/types/predicate_registry.rb +34 -0
- data/lib/dry/types/primitive_inferrer.rb +97 -0
- data/lib/dry/types/printer.rb +7 -3
- data/lib/dry/types/result.rb +2 -2
- data/lib/dry/types/schema.rb +23 -2
- data/lib/dry/types/schema/key.rb +16 -3
- data/lib/dry/types/spec/types.rb +14 -1
- data/lib/dry/types/sum.rb +5 -5
- data/lib/dry/types/version.rb +1 -1
- metadata +26 -45
- data/.codeclimate.yml +0 -15
- data/.gitignore +0 -11
- data/.rspec +0 -2
- data/.travis.yml +0 -27
- data/.yardopts +0 -9
- data/CONTRIBUTING.md +0 -29
- data/Gemfile +0 -27
- data/Rakefile +0 -22
- data/benchmarks/hash_schemas.rb +0 -55
- data/benchmarks/lax_schema.rb +0 -15
- data/benchmarks/profile_invalid_input.rb +0 -15
- data/benchmarks/profile_lax_schema_valid.rb +0 -16
- data/benchmarks/profile_valid_input.rb +0 -15
- data/benchmarks/schema_valid_vs_invalid.rb +0 -21
- data/benchmarks/setup.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d7b15ca8ad5ac777c21b3911c2f28cc01b5ec3b44b8d9d8b9c3d099a349b688
|
4
|
+
data.tar.gz: c77acb5cfa7d0af802bd29b934336c361757b77cd6a4b2983a2501aac024d87d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47d4acd8c163f1515e74a1a8b7c7133df9bd484d4c8b972dece8cb9555f26f357d84d280fdac8cf917661d771eea08c8c86d84c60a5f3bfbccbaa3061af5be18
|
7
|
+
data.tar.gz: c55776bb5acb2879788967d0dfd1f86a8b5379c048e5e2c0dca265ab2fb4a73149889674be2333a8b3b90c3f06e5fed09bd5ed005f75f9270bb4a5d12f07213f
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,126 @@
|
|
1
|
-
|
1
|
+
## 1.3.0 2020-02-10
|
2
2
|
|
3
|
-
|
3
|
+
|
4
|
+
### Added
|
5
|
+
|
6
|
+
- `Schema#merge` for merging two hash schemas (@waiting-for-dev)
|
7
|
+
- Aliases for `.constructor` to non-constructor types. Now you can call `.prepend`/`.append` without silly checks for the type being a constructor (flash-gordon)
|
8
|
+
```ruby
|
9
|
+
(Dry::Types['integer'].prepend(-> { _1 + 1 })).(1) # => 2
|
10
|
+
(Dry::Types['coercible.integer'] >> -> { _1 * 2 }).('99') # => 198
|
11
|
+
```
|
12
|
+
- `Hash::Schema#clear` returns a schema with the same options but without keys
|
13
|
+
- Optional namespace now includes strict types by default (@flash-gordon) strings already (@flash-gordon)"
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
|
17
|
+
- `Schema::Key#optional` returns an instance of `Schema::Key` as it should have done
|
18
|
+
- Composition with function handling exceptions. This could occasionally lead to unexpected exceptions (@flash-gordon)
|
19
|
+
|
20
|
+
|
21
|
+
[Compare v1.2.2...v1.3.0](https://github.com/dry-rb/dry-types/compare/v1.2.2...v1.3.0)
|
22
|
+
|
23
|
+
## 1.2.2 2019-12-14
|
24
|
+
|
25
|
+
|
26
|
+
### Fixed
|
27
|
+
|
28
|
+
- `Types.Contructor` doesn't re-wrap class instances implementing type interface, this fixes some quirks in dry-struct (@flash-gordon)
|
29
|
+
|
30
|
+
### Changed
|
31
|
+
|
32
|
+
- Types now use immutable equalizers. This should improve performance in certain cases e.g. in ROM (flash-gordon)
|
33
|
+
- Attempting to use non-symbol keys in hash schemas raises an error. We always supported only symbols as keys but there was no check, now it'll throw an argument error. If you want to convert strings to symbols, use `Hash#with_key_transform` (flash-gordon)
|
34
|
+
- Params and JSON types accept Time/Date/Datetime instances and boolean values. This can be useful in tests but we discourage you from relying on this behavior in production code. For example, building structs with `Params` types is considered a smell. There are dedicated tools for coercion, namely dry-schema and dry-validation. Be responsible user of dry-types! ❤ (flash-gordon)
|
35
|
+
|
36
|
+
[Compare v1.2.1...v1.2.2](https://github.com/dry-rb/dry-types/compare/v1.2.1...v1.2.2)
|
37
|
+
|
38
|
+
## 1.2.1 2019-11-07
|
39
|
+
|
40
|
+
|
41
|
+
### Fixed
|
42
|
+
|
43
|
+
- Fix keyword warnings reported by Ruby 2.7 (flash-gordon)
|
44
|
+
- Error type in failing case in `Array::Member` (esparta)
|
45
|
+
|
46
|
+
|
47
|
+
[Compare v1.2.0...v1.2.1](https://github.com/dry-rb/dry-types/compare/v1.2.0...v1.2.1)
|
48
|
+
|
49
|
+
## 1.2.0 2019-10-06
|
50
|
+
|
51
|
+
|
52
|
+
### Added
|
53
|
+
|
54
|
+
- `Optional::Params` types that coerce empty strings to `nil` (flash-gordon)
|
55
|
+
```ruby
|
56
|
+
Dry::Types['optional.params.integer'].('') # => nil
|
57
|
+
Dry::Types['optional.params.integer'].('140') # => 140
|
58
|
+
Dry::Types['optional.params.integer'].('asd') # => exception!
|
59
|
+
```
|
60
|
+
Keep in mind, `Dry::Types['optional.params.integer']` and `Dry::Types['params.integer'].optional` are not the same, the latter doesn't handle empty strings.
|
61
|
+
- Predicate inferrer was ported from dry-schema (authored by solnic)
|
62
|
+
```ruby
|
63
|
+
require 'dry/types/predicate_inferrer'
|
64
|
+
Dry::Types::PredicateInferrer.new[Types::String]
|
65
|
+
# => [:str?]
|
66
|
+
Dry::Types::PredicateInferrer.new[Types::String | Types::Integer]
|
67
|
+
# => [[[:str?], [:int?]]]
|
68
|
+
```
|
69
|
+
Note that the API of the predicate inferrer can change in the stable version, it's dictated by the needs of dry-schema so it should be considered as semi-stable. If you depend on it, write specs covering the desired behavior. Another option is copy-and-paste the whole thing to your project.
|
70
|
+
- Primitive inferrer was ported from dry-schema (authored by solnic)
|
71
|
+
```ruby
|
72
|
+
require 'dry/types/primitive_inferrer'
|
73
|
+
Dry::Types::PrimitiveInferrer.new[Types::String]
|
74
|
+
# => [String]
|
75
|
+
Dry::Types::PrimitiveInferrer.new[Types::String | Types::Integer]
|
76
|
+
# => [String, Integer]
|
77
|
+
Dry::Types::PrimitiveInferrer.new[Types::String.optional]
|
78
|
+
# => [NilClass, String]
|
79
|
+
```
|
80
|
+
The primitive inferrer should be stable by now, you can rely on it.
|
81
|
+
- The `monads` extension adds `Dry::Types::Result#to_monad`. This makes it compatible with do notation from dry-monads. Load it with `Dry::Types.load_extensions(:monads)` (skryukov)
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
Types = Dry.Types
|
85
|
+
Dry::Types.load_extensions(:monads)
|
86
|
+
|
87
|
+
class AddTen
|
88
|
+
include Dry::Monads[:result, :do]
|
89
|
+
|
90
|
+
def call(input)
|
91
|
+
integer = yield Types::Coercible::Integer.try(input)
|
92
|
+
|
93
|
+
Success(integer + 10)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
```
|
97
|
+
|
98
|
+
### Fixed
|
99
|
+
|
100
|
+
- Bug with using a `Bool`-named struct as a schema key (flash-gordon)
|
101
|
+
- A bunch of issues related to using `meta` on complex types (flash-gordon)
|
102
|
+
- `Types.Constructor(...)` returns a `Types::Array` as it should (flash-gordon)
|
103
|
+
|
104
|
+
### Changed
|
105
|
+
|
106
|
+
- `Dry::Types.[]` used to work with classes, now it's deprecated (flash-gordon)
|
107
|
+
|
108
|
+
[Compare v1.1.1...v1.2.0](https://github.com/dry-rb/dry-types/compare/v1.1.1...v1.2.0)
|
109
|
+
|
110
|
+
## 1.1.1 2019-07-26
|
111
|
+
|
112
|
+
|
113
|
+
### Fixed
|
114
|
+
|
115
|
+
- A bug where meta was lost for lax array types (flash-gordon)
|
116
|
+
|
117
|
+
|
118
|
+
[Compare v1.1.0...v1.1.1](https://github.com/dry-rb/dry-types/compare/v1.1.0...v1.1.1)
|
119
|
+
|
120
|
+
## 1.1.0 2019-07-02
|
121
|
+
|
122
|
+
|
123
|
+
### Added
|
4
124
|
|
5
125
|
- New builder method `Interface` constructs a type which accepts objects that respond to the given methods (waiting-for-dev)
|
6
126
|
```ruby
|
@@ -11,18 +131,20 @@
|
|
11
131
|
```
|
12
132
|
- New types: `coercible.symbol`, `params.symbol`, and `json.symbol`, all use `.to_sym` for coercion (waiting-for-dev)
|
13
133
|
|
14
|
-
|
134
|
+
### Fixed
|
15
135
|
|
16
136
|
- Converting schema keys to maybe types (flash-gordon)
|
17
137
|
- Using `Schema#key` and `Array#member` on constuctors (flash-gordon)
|
18
138
|
- Using `meta(omittable: true)` within `transform_types` works again but produces a warning, please migrate to `.omittable` or `.required(false)` (flash-gordon)
|
19
139
|
- Bug with a constructror defined on top of enum (flash-gordon)
|
20
140
|
|
141
|
+
|
21
142
|
[Compare v1.0.1...v1.1.0](https://github.com/dry-rb/dry-types/compare/v1.0.1...v1.1.0)
|
22
143
|
|
23
|
-
|
144
|
+
## 1.0.1 2019-06-04
|
145
|
+
|
24
146
|
|
25
|
-
|
147
|
+
### Added
|
26
148
|
|
27
149
|
- In a case of failure the constructor block can now pass a different value (flash-gordon)
|
28
150
|
```ruby
|
@@ -35,42 +157,13 @@
|
|
35
157
|
```
|
36
158
|
- `Schema#strict` now accepts an boolean argument. If `fales` is passed this will turn a strict schema into a non-strict one (flash-gordon)
|
37
159
|
|
38
|
-
[Compare v1.0.0...v1.0.1](https://github.com/dry-rb/dry-types/compare/v1.0.0...v1.0.1)
|
39
|
-
|
40
|
-
# 1.0.0 2019-04-23
|
41
|
-
|
42
|
-
## Changed
|
43
|
-
|
44
|
-
- [BREAKING] Behavior of built-in constructor types was changed to be more strict. They will always raise an error on failed coercion (flash-gordon)
|
45
|
-
Compare:
|
46
160
|
|
47
|
-
|
48
|
-
# 0.15.0
|
49
|
-
Types::Params::Integer.('foo')
|
50
|
-
# => "foo"
|
51
|
-
|
52
|
-
# 1.0.0
|
53
|
-
Types::Params::Integer.('foo')
|
54
|
-
# => Dry::Types::CoercionError: invalid value for Integer(): "foo"
|
55
|
-
```
|
56
|
-
|
57
|
-
To handle coercion errors `Type#call` now yields a block:
|
58
|
-
|
59
|
-
```ruby
|
60
|
-
Types::Params::Integer.('foo') { :invalid } # => :invalid
|
61
|
-
```
|
62
|
-
|
63
|
-
This makes work with coercions more straightforward and way faster.
|
64
|
-
|
65
|
-
- [BREAKING] Safe types were renamed to Lax, this name better serves their purpose. The previous name is available but prints a warning (flash-gordon)
|
66
|
-
- [BREAKING] Metadata is now pushed down to the decorated type. It is not likely you will notice a difference but this a breaking change that enables some use cases in rom related to the usage of default types in relations (flash-gordon)
|
67
|
-
- Nominal types are now completely unconstrained. This fixes some inconsistencies when using them with constraints. `Nominal#try` will always return a successful result, for the previous behavior use `Nominal#try_coerce` or switch to strict types with passing a block to `#call` (flash-gordon)
|
161
|
+
[Compare v1.0.0...v1.0.1](https://github.com/dry-rb/dry-types/compare/v1.0.0...v1.0.1)
|
68
162
|
|
69
|
-
##
|
163
|
+
## 1.0.0 2019-04-23
|
70
164
|
|
71
|
-
- During the work on this release, a lot of performance improvements were made. dry-types 1.0 combined with dry-logic 1.0 are multiple times faster than dry-types 0.15 and dry-logic 0.5 for common cases including constraints checking and coercion (flash-gordon)
|
72
165
|
|
73
|
-
|
166
|
+
### Added
|
74
167
|
|
75
168
|
- API for custom constructor types was enhanced. If you pass your own callable to `.constructor` it can have a block in its signature. If a block is passed, you must call it on failed coercion, otherwise raise a type coercion error (flash-gordon)
|
76
169
|
Example:
|
@@ -99,44 +192,40 @@
|
|
99
192
|
# => [1, 2, 3]
|
100
193
|
```
|
101
194
|
|
102
|
-
|
103
|
-
|
104
|
-
# 0.15.0 2019-03-22
|
195
|
+
### Changed
|
105
196
|
|
106
|
-
|
197
|
+
- [BREAKING] Behavior of built-in constructor types was changed to be more strict. They will always raise an error on failed coercion (flash-gordon)
|
198
|
+
Compare:
|
107
199
|
|
108
|
-
- [BREAKING] Internal representation of hash schemas was changed to be a simple list of key types (flash-gordon)
|
109
|
-
`Dry::Types::Hash#with_type_transform` now yields a key type instead of type + name:
|
110
|
-
```ruby
|
111
|
-
Dry::Types['strict.hash'].with_type_transform { |key| key.name == :age ? key.required(false) : key }
|
112
|
-
```
|
113
|
-
- [BREAKING] Definition types were renamed to nominal (flash-gordon)
|
114
|
-
- [BREAKING] Top-level types returned by `Dry::Types.[]` are now strict (flash-gordon)
|
115
200
|
```ruby
|
116
|
-
#
|
117
|
-
|
118
|
-
# =>
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
#
|
123
|
-
Dry::Types['nominal.integer']
|
124
|
-
# => #<Dry::Types[Nominal<Integer>]>
|
201
|
+
# 0.15.0
|
202
|
+
Types::Params::Integer.('foo')
|
203
|
+
# => "foo"
|
204
|
+
|
205
|
+
# 1.0.0
|
206
|
+
Types::Params::Integer.('foo')
|
207
|
+
# => Dry::Types::CoercionError: invalid value for Integer(): "foo"
|
125
208
|
```
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
Keep in mind `Dry.Types` uses strict types for top-level names, that is after
|
209
|
+
|
210
|
+
To handle coercion errors `Type#call` now yields a block:
|
211
|
+
|
130
212
|
```ruby
|
131
|
-
|
132
|
-
include Dry.Types
|
133
|
-
end
|
213
|
+
Types::Params::Integer.('foo') { :invalid } # => :invalid
|
134
214
|
```
|
135
|
-
`Types::Integer` is a strict type. If you want it to be nominal, use `include Dry.Types(default: :nominal)`. See other options below.
|
136
|
-
- `params.integer` now always converts strings to decimal numbers, this means `09` will be coerced to `9` (threw an error before) (skryukov)
|
137
|
-
- Ruby 2.3 is EOL and not officially supported. It may work but we don't test it.
|
138
215
|
|
139
|
-
|
216
|
+
This makes work with coercions more straightforward and way faster.
|
217
|
+
- [BREAKING] Safe types were renamed to Lax, this name better serves their purpose. The previous name is available but prints a warning (flash-gordon)
|
218
|
+
- [BREAKING] Metadata is now pushed down to the decorated type. It is not likely you will notice a difference but this a breaking change that enables some use cases in rom related to the usage of default types in relations (flash-gordon)
|
219
|
+
- Nominal types are now completely unconstrained. This fixes some inconsistencies when using them with constraints. `Nominal#try` will always return a successful result, for the previous behavior use `Nominal#try_coerce` or switch to strict types with passing a block to `#call` (flash-gordon)
|
220
|
+
- ## Performance improvements
|
221
|
+
- During the work on this release, a lot of performance improvements were made. dry-types 1.0 combined with dry-logic 1.0 are multiple times faster than dry-types 0.15 and dry-logic 0.5 for common cases including constraints checking and coercion (flash-gordon)
|
222
|
+
|
223
|
+
[Compare v0.15.0...v1.0.0](https://github.com/dry-rb/dry-types/compare/v0.15.0...v1.0.0)
|
224
|
+
|
225
|
+
## 0.15.0 2019-03-22
|
226
|
+
|
227
|
+
|
228
|
+
### Added
|
140
229
|
|
141
230
|
- Improved string representation of types (flash-gordon)
|
142
231
|
```ruby
|
@@ -194,7 +283,6 @@
|
|
194
283
|
# keys in user_schema are not required
|
195
284
|
user_schema = lax_hash.schema(name: 'string', age: 'integer')
|
196
285
|
```
|
197
|
-
|
198
286
|
- `Type#optional?` now recognizes more cases where `nil` is an allowed value (flash-gordon)
|
199
287
|
- `Constructor#{prepend,append}` with `<<` and `>>` as aliases. `Constructor#append` works the same way `Constructor#constrcutor` does. `Constuctor#prepend` chains functions in the reverse order, see examples (flash-gordon)
|
200
288
|
|
@@ -206,7 +294,6 @@
|
|
206
294
|
inc = to_int.prepend { |x| x + "2" }
|
207
295
|
inc.("1") # => "1" -> "12" -> 12
|
208
296
|
```
|
209
|
-
|
210
297
|
- Partial schema application for cases when you want to validate only a subset of keys (flash-gordon)
|
211
298
|
This is useful when you want to update a key or two in an already-validated hash. A perfect example is `Dry::Struct#new` where this feature is now used.
|
212
299
|
```ruby
|
@@ -216,87 +303,120 @@
|
|
216
303
|
value.merge(update)
|
217
304
|
```
|
218
305
|
|
219
|
-
|
306
|
+
### Fixed
|
220
307
|
|
221
308
|
- `Hash::Map` now behaves as a constrained type if its values are constrained (flash-gordon)
|
222
309
|
- `coercible.integer` now doesn't blow up on invalid strings (exterm)
|
223
310
|
|
224
|
-
|
311
|
+
### Changed
|
225
312
|
|
226
|
-
|
313
|
+
- [BREAKING] Internal representation of hash schemas was changed to be a simple list of key types (flash-gordon)
|
314
|
+
`Dry::Types::Hash#with_type_transform` now yields a key type instead of type + name:
|
315
|
+
```ruby
|
316
|
+
Dry::Types['strict.hash'].with_type_transform { |key| key.name == :age ? key.required(false) : key }
|
317
|
+
```
|
318
|
+
- [BREAKING] Definition types were renamed to nominal (flash-gordon)
|
319
|
+
- [BREAKING] Top-level types returned by `Dry::Types.[]` are now strict (flash-gordon)
|
320
|
+
```ruby
|
321
|
+
# before
|
322
|
+
Dry::Types['integer']
|
323
|
+
# => #<Dry::Types[Nominal<Integer>]>
|
324
|
+
# now
|
325
|
+
Dry::Types['integer']
|
326
|
+
# => <Dry::Types[Constrained<Nominal<Integer> rule=[type?(Integer)]>]>
|
327
|
+
# you can still access nominal types using namespace
|
328
|
+
Dry::Types['nominal.integer']
|
329
|
+
# => #<Dry::Types[Nominal<Integer>]>
|
330
|
+
```
|
331
|
+
- [BREAKING] Default values are not evaluated if the decorated type returns `nil`. They are triggered on `Undefined` instead (GustavoCaso + flash-gordon)
|
332
|
+
- [BREAKING] Support for old hash schemas was fully removed. This makes dry-types not compatible with dry-validation < 1.0 (flash-gordon)
|
333
|
+
- `Dry::Types.module` is deprecated in favor of `Dry.Types` (flash-gordon)
|
334
|
+
Keep in mind `Dry.Types` uses strict types for top-level names, that is after
|
335
|
+
```ruby
|
336
|
+
module Types
|
337
|
+
include Dry.Types
|
338
|
+
end
|
339
|
+
```
|
340
|
+
`Types::Integer` is a strict type. If you want it to be nominal, use `include Dry.Types(default: :nominal)`. See other options below.
|
341
|
+
- `params.integer` now always converts strings to decimal numbers, this means `09` will be coerced to `9` (threw an error before) (skryukov)
|
342
|
+
- Ruby 2.3 is EOL and not officially supported. It may work but we don't test it.
|
343
|
+
|
344
|
+
[Compare v0.14.1...v0.15.0](https://github.com/dry-rb/dry-types/compare/v0.14.1...v0.15.0)
|
227
345
|
|
228
|
-
##
|
346
|
+
## 0.14.1 2019-03-25
|
347
|
+
|
348
|
+
|
349
|
+
### Fixed
|
229
350
|
|
230
351
|
- `coercible.integer` now doesn't blow up on invalid strings (exterm)
|
231
352
|
|
353
|
+
|
232
354
|
[Compare v0.14.0...v0.14.1](https://github.com/dry-rb/dry-types/compare/v0.14.0...v0.14.1)
|
233
355
|
|
234
|
-
|
356
|
+
## 0.14.0 2019-01-29
|
235
357
|
|
236
|
-
## Changed
|
237
358
|
|
238
|
-
|
239
|
-
- `dry-logic` was updated to `~> 0.5` (solnic)
|
240
|
-
|
241
|
-
## Fixed
|
359
|
+
### Fixed
|
242
360
|
|
243
361
|
- `valid?` works correctly with constructors now (cgeorgii)
|
244
362
|
|
363
|
+
### Changed
|
364
|
+
|
365
|
+
- [BREAKING] Support for Ruby 2.2 was dropped. It reached EOL on March 31, 2018.
|
366
|
+
- `dry-logic` was updated to `~> 0.5` (solnic)
|
367
|
+
|
245
368
|
[Compare v0.13.4...v0.14.0](https://github.com/dry-rb/dry-types/compare/v0.13.4...v0.14.0)
|
246
369
|
|
247
|
-
|
370
|
+
## 0.13.4 2018-12-21
|
371
|
+
|
248
372
|
|
249
|
-
|
373
|
+
### Fixed
|
250
374
|
|
251
375
|
- Fixed warnings about keyword arguments from Ruby 2.6. See https://bugs.ruby-lang.org/issues/14183 for all the details (flash-gordon)
|
252
376
|
|
253
|
-
# v0.13.3 2018-11-25
|
254
377
|
|
255
|
-
|
378
|
+
[Compare v0.13.3...v0.13.4](https://github.com/dry-rb/dry-types/compare/v0.13.3...v0.13.4)
|
379
|
+
|
380
|
+
## 0.13.3 2018-11-25
|
381
|
+
|
382
|
+
|
383
|
+
### Fixed
|
256
384
|
|
257
385
|
- `Dry::Types::Hash#try` returns `Failure` instead of throwing an exception on missing keys (GustavoCaso)
|
258
386
|
|
387
|
+
|
259
388
|
[Compare v0.13.2...v0.13.3](https://github.com/dry-rb/dry-types/compare/v0.13.2...v0.13.3)
|
260
389
|
|
261
|
-
|
390
|
+
## 0.13.2 2018-05-30
|
262
391
|
|
263
|
-
|
392
|
+
|
393
|
+
### Fixed
|
264
394
|
|
265
395
|
- `Defaults#valid?` now works fine when passing `Dry::Core::Constans::Undefined` as value (GustavoCaso)
|
266
396
|
- `valid?` for constructor types wrapping `Sum`s (GustavoCaso)
|
267
397
|
|
398
|
+
|
268
399
|
[Compare v0.13.1...v0.13.2](https://github.com/dry-rb/dry-types/compare/v0.13.1...v0.13.2)
|
269
400
|
|
270
|
-
|
401
|
+
## 0.13.1 2018-05-28
|
402
|
+
|
403
|
+
|
404
|
+
### Added
|
405
|
+
|
406
|
+
- `params.int` was added to make the upgrade process in dry-validation smoother (available after you `require 'dry/types/compat/int'`) (flash-gordon)
|
271
407
|
|
272
|
-
|
408
|
+
### Fixed
|
273
409
|
|
274
410
|
- Defaults now works fine with meta (GustavoCaso)
|
275
411
|
- Defaults are now re-decorated properly (flash-gordon)
|
276
412
|
|
277
|
-
## Added
|
278
|
-
|
279
|
-
- `params.int` was added to make the upgrade process in dry-validation smoother (available after you `require 'dry/types/compat/int'`) (flash-gordon)
|
280
413
|
|
281
414
|
[Compare v0.13.0...v0.13.1](https://github.com/dry-rb/dry-types/compare/v0.13.0...v0.13.1)
|
282
415
|
|
283
|
-
|
416
|
+
## 0.13.0 2018-05-03
|
284
417
|
|
285
|
-
## Changed
|
286
418
|
|
287
|
-
|
288
|
-
- [BREAKING] The `Int` types was renamed to `Integer`, this was the only type named differently from the standard Ruby classes so it has been made consistent. The former name is available with `require 'dry/types/compat/int'` (GustavoCaso + flash-gordon)
|
289
|
-
- [BREAKING] Default types are not evaluated on `nil`. Default values are evaluated _only_ if no value were given.
|
290
|
-
```ruby
|
291
|
-
type = Types::Strict::String.default("hello")
|
292
|
-
type[nil] # => constraint error
|
293
|
-
type[] # => "hello"
|
294
|
-
```
|
295
|
-
This change allowed to greatly simplify hash schemas, make them a lot more flexible yet predictable (see below).
|
296
|
-
- [BREAKING] `Dry::Types.register_class` was removed, `Dry::Types.register` was made private API, do not register your types in the global `dry-types` container, use a module instead, e.g. `Types` (flash-gordon)
|
297
|
-
- [BREAKING] Enum types don't accept value index anymore. Instead, explicit mapping is supported, see below (flash-gordon)
|
298
|
-
|
299
|
-
## Added
|
419
|
+
### Added
|
300
420
|
|
301
421
|
- Hash schemas were rewritten. The old API is still around but is going to be deprecated and removed before 1.0. The new API is simpler and more flexible. Instead of having a bunch of predefined schemas you can build your own by combining the following methods:
|
302
422
|
|
@@ -334,7 +454,6 @@
|
|
334
454
|
```
|
335
455
|
|
336
456
|
(flash-gordon)
|
337
|
-
|
338
457
|
- `Types.Strict` is an alias for `Types.Instance` (flash-gordon)
|
339
458
|
```ruby
|
340
459
|
strict_range = Types.Strict(Range)
|
@@ -364,175 +483,208 @@
|
|
364
483
|
dict[10] # => 'published'
|
365
484
|
```
|
366
485
|
|
367
|
-
|
486
|
+
### Fixed
|
368
487
|
|
369
488
|
- Fixed applying constraints to optional type, i.e. `.optional.constrained` works correctly (flash-gordon)
|
370
489
|
- Fixed enum working with optionals (flash-gordon)
|
371
|
-
|
372
|
-
## Internal
|
373
|
-
|
490
|
+
- ## Internal
|
374
491
|
- Dropped the `dry-configurable` dependency (GustavoCaso)
|
375
492
|
- The gem now uses `dry-inflector` for inflections instead of `inflecto` (GustavoCaso)
|
376
493
|
|
494
|
+
### Changed
|
495
|
+
|
496
|
+
- [BREAKING] Renamed `Types::Form` to `Types::Params`. You can opt-in the former name with `require 'dry/types/compat/form_types'`. It will be dropped in the next release (ndrluis)
|
497
|
+
- [BREAKING] The `Int` types was renamed to `Integer`, this was the only type named differently from the standard Ruby classes so it has been made consistent. The former name is available with `require 'dry/types/compat/int'` (GustavoCaso + flash-gordon)
|
498
|
+
- [BREAKING] Default types are not evaluated on `nil`. Default values are evaluated _only_ if no value were given.
|
499
|
+
```ruby
|
500
|
+
type = Types::Strict::String.default("hello")
|
501
|
+
type[nil] # => constraint error
|
502
|
+
type[] # => "hello"
|
503
|
+
```
|
504
|
+
This change allowed to greatly simplify hash schemas, make them a lot more flexible yet predictable (see below).
|
505
|
+
- [BREAKING] `Dry::Types.register_class` was removed, `Dry::Types.register` was made private API, do not register your types in the global `dry-types` container, use a module instead, e.g. `Types` (flash-gordon)
|
506
|
+
- [BREAKING] Enum types don't accept value index anymore. Instead, explicit mapping is supported, see below (flash-gordon)
|
507
|
+
|
377
508
|
[Compare v0.12.2...v0.13.0](https://github.com/dry-rb/dry-types/compare/v0.12.2...v0.13.0)
|
378
509
|
|
379
|
-
|
510
|
+
## 0.12.2 2017-11-04
|
380
511
|
|
381
|
-
|
512
|
+
|
513
|
+
### Fixed
|
382
514
|
|
383
515
|
- The type compiler was fixed for simple rules such as used for strict type checks (flash-gordon)
|
384
516
|
- Fixed an error on `Dry::Types['json.decimal'].try(nil)` (nesaulov)
|
385
517
|
- Fixed an error on calling `try` on an array type built of constrained types (flash-gordon)
|
386
518
|
- Implemented `===` for enum types (GustavoCaso)
|
387
519
|
|
520
|
+
|
388
521
|
[Compare v0.12.1...v0.12.2](https://github.com/dry-rb/dry-types/compare/v0.12.1...v0.12.2)
|
389
522
|
|
390
|
-
|
523
|
+
## 0.12.1 2017-10-11
|
391
524
|
|
392
|
-
|
525
|
+
|
526
|
+
### Fixed
|
393
527
|
|
394
528
|
- `Constructor#try` rescues `ArgumentError` (raised in cases like `Integer('foo')`) (flash-gordon)
|
395
529
|
- `#constructor` works correctly for default and enum types (solnic)
|
396
530
|
- Optional sum types work correctly in `safe` mode (GustavoCaso)
|
397
531
|
- The equalizer of constrained types respects meta (flash-gordon)
|
398
532
|
|
399
|
-
[Compare v0.12.0...v0.12.1](https://github.com/dry-rb/dry-types/compare/v0.12.0...v0.12.1)
|
400
533
|
|
401
|
-
|
534
|
+
[Compare v0.12.0...v0.12.1](https://github.com/dry-rb/dry-types/compare/v0.12.0...v0.12.1)
|
402
535
|
|
403
|
-
##
|
536
|
+
## 0.12.0 2017-09-15
|
404
537
|
|
405
|
-
- A bunch of shortcut methods for constructing types to the autogenerated module, e.g. `Types.Constructor(String, &:to_s)` (flash-gordon)
|
406
538
|
|
407
|
-
|
539
|
+
### Added
|
408
540
|
|
541
|
+
- A bunch of shortcut methods for constructing types to the autogenerated module, e.g. `Types.Constructor(String, &:to_s)` (flash-gordon)
|
542
|
+
- ## Deprecated
|
409
543
|
- `Types::Array#member` was deprecated in favor of `Types::Array#of` (flash-gordon)
|
410
544
|
|
545
|
+
|
411
546
|
[Compare v0.11.1...v0.12.0](https://github.com/dry-rb/dry-types/compare/v0.11.1...v0.12.0)
|
412
547
|
|
413
|
-
|
548
|
+
## 0.11.1 2017-08-14
|
414
549
|
|
415
|
-
## Changed
|
416
550
|
|
417
|
-
|
418
|
-
|
419
|
-
## Fixed
|
551
|
+
### Fixed
|
420
552
|
|
421
553
|
- Fixed `Constructor#name` with `Sum`-types (flash-gordon)
|
422
554
|
|
555
|
+
### Changed
|
556
|
+
|
557
|
+
- Constructors are now equalized using `fn` and `meta` too (flash-gordon)
|
558
|
+
|
423
559
|
[Compare v0.11.0...v0.11.1](https://github.com/dry-rb/dry-types/compare/v0.11.0...v0.11.1)
|
424
560
|
|
425
|
-
|
561
|
+
## 0.11.0 2017-06-30
|
426
562
|
|
427
|
-
|
563
|
+
|
564
|
+
### Added
|
428
565
|
|
429
566
|
- `#to_ast` available for all type objects (GustavoCaso)
|
430
567
|
- `Types::Array#of` as an alias for `#member` (maliqq)
|
431
568
|
- Detailed failure objects are passed to results which improves constraint violation messages (GustavoCaso)
|
432
569
|
|
570
|
+
|
433
571
|
[Compare v0.10.3...v0.11.0](https://github.com/dry-rb/dry-types/compare/v0.10.3...v0.11.0)
|
434
572
|
|
435
|
-
|
573
|
+
## 0.10.3 2017-05-06
|
436
574
|
|
437
|
-
|
575
|
+
|
576
|
+
### Added
|
438
577
|
|
439
578
|
- Callable defaults accept the underlying type (v-kolesnikov)
|
440
579
|
|
580
|
+
|
441
581
|
[Compare v0.10.2...v0.10.3](https://github.com/dry-rb/dry-types/compare/v0.10.2...v0.10.3)
|
442
582
|
|
443
|
-
|
583
|
+
## 0.10.2 2017-04-28
|
444
584
|
|
445
|
-
|
585
|
+
|
586
|
+
### Fixed
|
446
587
|
|
447
588
|
- Fixed `Type#optional?` for sum types (flash-gordon)
|
448
589
|
|
590
|
+
|
449
591
|
[Compare v0.10.1...v0.10.2](https://github.com/dry-rb/dry-types/compare/v0.10.1...v0.10.2)
|
450
592
|
|
451
|
-
|
593
|
+
## 0.10.1 2017-04-28
|
452
594
|
|
453
|
-
|
595
|
+
|
596
|
+
### Added
|
454
597
|
|
455
598
|
- `Type#optional?` returns true if type is Sum and left is nil (GustavoCaso)
|
456
599
|
- `Type#pristine` returns a type without `meta` (flash-gordon)
|
457
600
|
|
458
|
-
|
601
|
+
### Fixed
|
459
602
|
|
460
603
|
- `meta` is used in type equality again (solnic)
|
461
604
|
- `Any` works correctly with meta again (flash-gordon)
|
462
605
|
|
606
|
+
|
463
607
|
[Compare v0.10.0...v0.10.1](https://github.com/dry-rb/dry-types/compare/v0.10.0...v0.10.1)
|
464
608
|
|
465
|
-
|
609
|
+
## 0.10.0 2017-04-26
|
466
610
|
|
467
|
-
|
611
|
+
|
612
|
+
### Added
|
468
613
|
|
469
614
|
- Types can be used in `case` statements now (GustavoCaso)
|
470
615
|
|
471
|
-
|
616
|
+
### Fixed
|
472
617
|
|
473
618
|
- Return original value when Date.parse raises a RangeError (jviney)
|
474
619
|
|
475
|
-
|
620
|
+
### Changed
|
476
621
|
|
477
622
|
- Meta data are now stored separately from options (flash-gordon)
|
478
623
|
- `Types::Object` was renamed to `Types::Any` (flash-gordon)
|
479
624
|
|
480
625
|
[Compare v0.9.4...v0.10.0](https://github.com/dry-rb/dry-types/compare/v0.9.4...v0.10.0)
|
481
626
|
|
482
|
-
|
627
|
+
## 0.9.4 2017-01-24
|
628
|
+
|
483
629
|
|
484
|
-
|
630
|
+
### Added
|
485
631
|
|
486
632
|
- Added `Types::Object` which passes an object of any type (flash-gordon)
|
487
633
|
|
634
|
+
|
488
635
|
[Compare v0.9.3...v0.9.4](https://github.com/dry-rb/dry-types/compare/v0.9.3...v0.9.4)
|
489
636
|
|
490
|
-
|
637
|
+
## 0.9.3 2016-12-03
|
491
638
|
|
492
|
-
|
639
|
+
|
640
|
+
### Fixed
|
493
641
|
|
494
642
|
- Updated to dry-core >= 0.2.1 (ruby warnings are gone) (flash-gordon)
|
495
643
|
|
644
|
+
|
496
645
|
[Compare v0.9.2...v0.9.3](https://github.com/dry-rb/dry-types/compare/v0.9.2...v0.9.3)
|
497
646
|
|
498
|
-
|
647
|
+
## 0.9.2 2016-11-13
|
499
648
|
|
500
|
-
|
649
|
+
|
650
|
+
### Added
|
501
651
|
|
502
652
|
- Support for `"Y"` and `"N"` as `true` and `false` values, respectively (scare21410)
|
503
653
|
|
504
|
-
|
654
|
+
### Changed
|
505
655
|
|
506
656
|
- Optimized object allocation in hash schemas, resulting in up to 25% speed boost (davydovanton)
|
507
657
|
|
508
658
|
[Compare v0.9.1...v0.9.2](https://github.com/dry-rb/dry-types/compare/v0.9.1...v0.9.2)
|
509
659
|
|
510
|
-
|
660
|
+
## 0.9.1 2016-11-04
|
661
|
+
|
511
662
|
|
512
|
-
|
663
|
+
### Fixed
|
513
664
|
|
514
665
|
- `Hash#strict_with_defaults` properly evaluates callable defaults (bolshakov)
|
515
666
|
|
516
|
-
|
667
|
+
### Changed
|
517
668
|
|
518
669
|
- `Hash#weak` accepts Hash-descendants again (solnic)
|
519
670
|
|
520
671
|
[Compare v0.9.0...v0.9.1](https://github.com/dry-rb/dry-types/compare/v0.9.0...v0.9.1)
|
521
672
|
|
522
|
-
|
673
|
+
## 0.9.0 2016-09-21
|
523
674
|
|
524
|
-
|
675
|
+
|
676
|
+
### Added
|
525
677
|
|
526
678
|
- `Hash#strict_with_defaults` which validates presence of all required keys and respects default types for missing _values_ (backus)
|
527
679
|
- `Type#constrained?` method (flash-gordon)
|
528
680
|
|
529
|
-
|
681
|
+
### Fixed
|
530
682
|
|
531
683
|
- Summing two constrained types works correctly (flash-gordon)
|
532
684
|
- `Types::Array::Member#valid?` in cases where member type is a constraint (solnic)
|
533
685
|
- `Hash::Schema#try` handles exceptions properly and returns a failure object (solnic)
|
534
686
|
|
535
|
-
|
687
|
+
### Changed
|
536
688
|
|
537
689
|
- [BREAKING] Renamed `Hash##{schema=>permissive}` (backus)
|
538
690
|
- [BREAKING] `dry-monads` dependency was made optional, Maybe types are available after `Dry::Types.load_extensions(:maybe)` (flash-gordon)
|
@@ -543,43 +695,47 @@
|
|
543
695
|
|
544
696
|
[Compare v0.8.1...v0.9.0](https://github.com/dry-rb/dry-types/compare/v0.8.1...v0.9.0)
|
545
697
|
|
546
|
-
|
698
|
+
## 0.8.1 2016-07-13
|
699
|
+
|
547
700
|
|
548
|
-
|
701
|
+
### Fixed
|
549
702
|
|
550
703
|
- Compiler no longer chokes on type nodes without args (solnic)
|
551
704
|
- Removed `bin/console` from gem package (solnic)
|
552
705
|
|
706
|
+
|
553
707
|
[Compare v0.8.0...v0.8.1](https://github.com/dry-rb/dry-types/compare/v0.8.0...v0.8.1)
|
554
708
|
|
555
|
-
|
709
|
+
## 0.8.0 2016-07-01
|
710
|
+
|
556
711
|
|
557
|
-
|
712
|
+
### Added
|
558
713
|
|
559
714
|
- `Struct` now implements `Type` interface so ie `SomeStruct | String` works now (flash-gordon)
|
560
715
|
- `:weak` Hash constructor which can partially coerce a hash even when it includes invalid values (solnic)
|
561
716
|
- Types include `Dry::Equalizer` now (flash-gordon)
|
562
717
|
|
563
|
-
|
718
|
+
### Fixed
|
564
719
|
|
565
720
|
- `Struct#to_hash` descends into arrays too (nepalez)
|
566
721
|
- `Default#with` works now (flash-gordon)
|
567
722
|
|
568
|
-
|
723
|
+
### Changed
|
569
724
|
|
570
725
|
- `:symbolized` hash schema is now based on `:weak` schema (solnic)
|
571
726
|
- `Struct::Value` instances are now **deeply frozen** via ice_nine (backus)
|
572
727
|
|
573
728
|
[Compare v0.7.2...v0.8.0](https://github.com/dry-rb/dry-types/compare/v0.7.2...v0.8.0)
|
574
729
|
|
575
|
-
|
730
|
+
## 0.7.2 2016-05-11
|
576
731
|
|
577
|
-
|
732
|
+
|
733
|
+
### Fixed
|
578
734
|
|
579
735
|
- `Bool#default` gladly accepts `false` as its value (solnic)
|
580
736
|
- Creating an empty schema with input processor no longer fails (lasseebert)
|
581
737
|
|
582
|
-
|
738
|
+
### Changed
|
583
739
|
|
584
740
|
- Allow multiple calls to meta (solnic)
|
585
741
|
- Allow capitalised versions of true and false values for boolean coercions (nil0bject)
|
@@ -591,24 +747,26 @@
|
|
591
747
|
|
592
748
|
[Compare v0.7.1...v0.7.2](https://github.com/dry-rb/dry-types/compare/v0.7.1...v0.7.2)
|
593
749
|
|
594
|
-
|
750
|
+
## 0.7.1 2016-04-06
|
751
|
+
|
595
752
|
|
596
|
-
|
753
|
+
### Added
|
597
754
|
|
598
755
|
- `JSON::*` types with JSON-specific coercions (coop)
|
599
756
|
|
600
|
-
|
757
|
+
### Fixed
|
601
758
|
|
602
759
|
- Schema is properly inherited in Struct (backus)
|
603
760
|
- `constructor_type` is properly inherited in Struct (fbernier)
|
604
761
|
|
762
|
+
|
605
763
|
[Compare v0.7.0...v0.7.1](https://github.com/dry-rb/dry-types/compare/v0.7.0...v0.7.1)
|
606
764
|
|
607
|
-
|
765
|
+
## 0.7.0 2016-03-30
|
608
766
|
|
609
767
|
Major focus of this release is to make complex type composition possible and improving constraint errors to be more meaningful.
|
610
768
|
|
611
|
-
|
769
|
+
### Added
|
612
770
|
|
613
771
|
- `Type#try` interface that tries to process the input and return a result object which can be either a success or failure (solnic)
|
614
772
|
- `#meta` interface for setting arbitrary meta data on types (solnic)
|
@@ -618,12 +776,12 @@ Major focus of this release is to make complex type composition possible and imp
|
|
618
776
|
- Compiler supports `[:constructor, [primitive, fn_proc]]` nodes (solnic)
|
619
777
|
- Compiler supports building schema-less `form.hash` types (solnic)
|
620
778
|
|
621
|
-
|
779
|
+
### Fixed
|
622
780
|
|
623
781
|
- `Sum` now supports complex types like `Array` or `Hash` with member types and/or constraints (solnic)
|
624
782
|
- `Default#constrained` will properly wrap a new constrained type (solnic)
|
625
783
|
|
626
|
-
|
784
|
+
### Changed
|
627
785
|
|
628
786
|
- [BREAKING] Renamed `Type#{optional=>maybe}` (AMHOL)
|
629
787
|
- [BREAKING] `Type#optional(other)` builds a sum: `Strict::Nil | other` (AMHOL)
|
@@ -638,11 +796,11 @@ Major focus of this release is to make complex type composition possible and imp
|
|
638
796
|
|
639
797
|
[Compare v0.6.0...v0.7.0](https://github.com/dry-rb/dry-types/compare/v0.6.0...v0.7.0)
|
640
798
|
|
641
|
-
|
799
|
+
## 0.6.0 2016-03-16
|
642
800
|
|
643
801
|
Renamed from `dry-data` to `dry-types` and:
|
644
802
|
|
645
|
-
|
803
|
+
### Added
|
646
804
|
|
647
805
|
- `Dry::Types.module` which returns a namespace for inclusion which has all
|
648
806
|
built-in types defined as constants (solnic)
|
@@ -654,7 +812,7 @@ Renamed from `dry-data` to `dry-types` and:
|
|
654
812
|
- `Types.register_class` accepts a second arg which is the name of the class'
|
655
813
|
constructor method, defaults to `:new` (solnic)
|
656
814
|
|
657
|
-
|
815
|
+
### Fixed
|
658
816
|
|
659
817
|
- `Struct` will simply pass-through the input if it is already a struct (solnic)
|
660
818
|
- `default` will raise if a value violates constraints (solnic)
|
@@ -666,30 +824,37 @@ Renamed from `dry-data` to `dry-types` and:
|
|
666
824
|
no single primitive for an optional value (solnic)
|
667
825
|
- `Optional` passes-through a value which is already a maybe (solnic)
|
668
826
|
|
669
|
-
|
827
|
+
### Changed
|
670
828
|
|
671
829
|
- `Dry::Types::Definition` is now the base type definition object (solnic)
|
672
830
|
- `Dry::Types::Constructor` is now a type definition with a constructor function (solnic)
|
673
831
|
|
674
832
|
[Compare v0.5.1...v0.6.0](https://github.com/dry-rb/dry-types/compare/v0.5.1...v0.6.0)
|
675
833
|
|
676
|
-
|
834
|
+
## 0.5.1 2016-01-11
|
835
|
+
|
677
836
|
|
678
|
-
|
837
|
+
### Added
|
679
838
|
|
680
839
|
- `Dry::Data::Type#safe` for types which can skip constructor when primitive does
|
681
840
|
not match input's class (solnic)
|
682
841
|
- `form.array` and `form.hash` safe types (solnic)
|
683
842
|
|
843
|
+
|
684
844
|
[Compare v0.5.0...v0.5.1](https://github.com/dry-rb/dry-types/compare/v0.5.0...v0.5.1)
|
685
845
|
|
686
|
-
|
846
|
+
## 0.5.0 2016-01-11
|
847
|
+
|
687
848
|
|
688
|
-
|
849
|
+
### Added
|
689
850
|
|
690
851
|
- `Type#default` interface for defining a type with a default value (solnic)
|
691
852
|
|
692
|
-
|
853
|
+
### Fixed
|
854
|
+
|
855
|
+
- `attribute` raises proper error when type definition is missing (solnic)
|
856
|
+
|
857
|
+
### Changed
|
693
858
|
|
694
859
|
- [BREAKING] `Dry::Data::Type.new` accepts constructor and _options_ now (solnic)
|
695
860
|
- Renamed `Dry::Data::Type::{Enum,Constrained}` => `Dry::Data::{Enum,Constrained}` (solnic)
|
@@ -698,60 +863,62 @@ Renamed from `dry-data` to `dry-types` and:
|
|
698
863
|
- `strict.*` category uses constrained types with `:type?` predicate (solnic)
|
699
864
|
- `SumType#call` no longer needs to rescue from `TypeError` (solnic)
|
700
865
|
|
701
|
-
## Fixed
|
702
|
-
|
703
|
-
- `attribute` raises proper error when type definition is missing (solnic)
|
704
|
-
|
705
866
|
[Compare v0.4.2...v0.5.0](https://github.com/dry-rb/dry-types/compare/v0.4.2...v0.5.0)
|
706
867
|
|
707
|
-
|
868
|
+
## 0.4.2 2015-12-27
|
869
|
+
|
708
870
|
|
709
|
-
|
871
|
+
### Added
|
710
872
|
|
711
873
|
- Support for arrays in type compiler (solnic)
|
712
874
|
|
713
|
-
|
875
|
+
### Changed
|
714
876
|
|
715
877
|
- Array member uses type objects now rather than just their constructors (solnic)
|
716
878
|
|
717
|
-
[Compare v0.4.
|
879
|
+
[Compare v0.4.0...v0.4.2](https://github.com/dry-rb/dry-types/compare/v0.4.0...v0.4.2)
|
718
880
|
|
719
|
-
|
881
|
+
## 0.4.0 2015-12-11
|
720
882
|
|
721
|
-
|
883
|
+
|
884
|
+
### Added
|
722
885
|
|
723
886
|
- Support for sum-types with constraint type (solnic)
|
724
887
|
- `Dry::Data::Type#optional` for defining optional types (solnic)
|
725
888
|
|
726
|
-
|
889
|
+
### Changed
|
727
890
|
|
728
891
|
- `Dry::Data['optional']` was **removed** in favor of `Dry::Data::Type#optional` (solnic)
|
729
892
|
|
730
893
|
[Compare v0.3.2...v0.4.0](https://github.com/dry-rb/dry-types/compare/v0.3.2...v0.4.0)
|
731
894
|
|
732
|
-
|
895
|
+
## 0.3.2 2015-12-10
|
896
|
+
|
733
897
|
|
734
|
-
|
898
|
+
### Added
|
735
899
|
|
736
900
|
- `Dry::Data::Value` which works like a struct but is a value object with equalizer (solnic)
|
737
901
|
|
738
|
-
|
902
|
+
### Fixed
|
739
903
|
|
740
904
|
- Added missing require for `dry-equalizer` (solnic)
|
741
905
|
|
906
|
+
|
742
907
|
[Compare v0.3.1...v0.3.2](https://github.com/dry-rb/dry-types/compare/v0.3.1...v0.3.2)
|
743
908
|
|
744
|
-
|
909
|
+
## 0.3.1 2015-12-09
|
910
|
+
|
745
911
|
|
746
|
-
|
912
|
+
### Changed
|
747
913
|
|
748
914
|
- Removed require of constrained type and make it optional (solnic)
|
749
915
|
|
750
916
|
[Compare v0.3.0...v0.3.1](https://github.com/dry-rb/dry-types/compare/v0.3.0...v0.3.1)
|
751
917
|
|
752
|
-
|
918
|
+
## 0.3.0 2015-12-09
|
753
919
|
|
754
|
-
|
920
|
+
|
921
|
+
### Added
|
755
922
|
|
756
923
|
- `Type#constrained` interface for defining constrained types (solnic)
|
757
924
|
- `Dry::Data` can be configured with a type namespace (solnic)
|
@@ -759,41 +926,45 @@ Renamed from `dry-data` to `dry-types` and:
|
|
759
926
|
- `Dry::Data::Type#enum` for defining an enum from a specific type (solnic)
|
760
927
|
- New types: `symbol` and `class` along with their `strict` versions (solnic)
|
761
928
|
|
929
|
+
|
762
930
|
[Compare v0.2.1...v0.3.0](https://github.com/dry-rb/dry-types/compare/v0.2.1...v0.3.0)
|
763
931
|
|
764
|
-
|
932
|
+
## 0.2.1 2015-11-30
|
765
933
|
|
766
|
-
|
934
|
+
|
935
|
+
### Added
|
767
936
|
|
768
937
|
- Type compiler supports nested hashes now (solnic)
|
769
938
|
|
770
|
-
|
939
|
+
### Fixed
|
771
940
|
|
772
941
|
- `form.bool` sum is using correct right-side `form.false` type (solnic)
|
773
942
|
|
774
|
-
|
943
|
+
### Changed
|
775
944
|
|
776
945
|
- Improved structure of the ast (solnic)
|
777
946
|
|
778
947
|
[Compare v0.2.0...v0.2.1](https://github.com/dry-rb/dry-types/compare/v0.2.0...v0.2.1)
|
779
948
|
|
780
|
-
|
949
|
+
## 0.2.0 2015-11-29
|
950
|
+
|
781
951
|
|
782
|
-
|
952
|
+
### Added
|
783
953
|
|
784
954
|
- `form.nil` which coerces empty strings to `nil` (solnic)
|
785
955
|
- `bool` sum-type (true | false) (solnic)
|
786
956
|
- Type compiler supports sum-types now (solnic)
|
787
957
|
|
788
|
-
|
958
|
+
### Changed
|
789
959
|
|
790
960
|
- Constructing optional types uses the new `Dry::Data["optional"]` built-in type (solnic)
|
791
961
|
|
792
962
|
[Compare v0.1.0...v0.2.0](https://github.com/dry-rb/dry-types/compare/v0.1.0...v0.2.0)
|
793
963
|
|
794
|
-
|
964
|
+
## 0.1.0 2015-11-27
|
795
965
|
|
796
|
-
|
966
|
+
|
967
|
+
### Added
|
797
968
|
|
798
969
|
- `form.*` coercible types (solnic)
|
799
970
|
- `Type::Hash#strict` for defining hashes with a strict schema (solnic)
|
@@ -802,8 +973,9 @@ Renamed from `dry-data` to `dry-types` and:
|
|
802
973
|
setting its `.new` method as the constructor (solnic)
|
803
974
|
- `Dry::Data::Compiler` for building a type from a simple ast (solnic)
|
804
975
|
|
805
|
-
[Compare v0.0.1...HEAD](https://github.com/dry-rb/dry-types/compare/v0.0.1...HEAD)
|
806
976
|
|
807
|
-
|
977
|
+
[Compare v0.0.1...v0.1.0](https://github.com/dry-rb/dry-types/compare/v0.0.1...v0.1.0)
|
978
|
+
|
979
|
+
## 0.0.1 2015-10-05
|
808
980
|
|
809
981
|
First public release
|