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