dry-types 1.2.1 → 1.5.0

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