CHANGELOG.md in dry-schema-1.4.3 vs CHANGELOG.md in dry-schema-1.5.0
- old
+ new
@@ -1,64 +1,113 @@
-# 1.4.3 2020-01-08
+## 1.5.0 2020-03-11
+
### Added
-* Pattern matching for `Dry::Schema::Result` objects (@flash-gordon)
- ```ruby
- schema = Dry::Schema::Params { required(:name).filled }
- case schema.('name' => 'John')
- in name:
- name # => 'John'
- end
- ```
- Try it with monads!
-* Shortcut for nested schemas in `value` and `maybe` macros (@waiting-for-dev)
- ```ruby
- Dry::Schema.Params do
- required(:address).value(:hash) do
- required(:city).filled
- end
- end
- ```
+- Support for complex sum types ie `value([:integer, array[:integer])` (issue #214) (@solnic)
+- You can now set global config via `Dry::Schema.config` (issue #205) (@robhanlon22)
+- Default error message for `:uuid_v4?` predicate (isssue #230) (@solnic)
+- [experimental] you can compose schemas in the DSL using the standard logic operators (issue #231 closed via #245) (@solnic)
+- Hash schema type can now be used with proper keys and predicates inferring. Constructor
+and default types are explicitly not supported (@flash-gordon)
+ ```ruby
+ UserType = Dry::Types['hash'].schema(
+ name: 'string',
+ email: 'string'
+ )
+ Dry::Schema.define do
+ require(:user).hash(UserType)
+ end
+ ```
+- `:struct` extension which allows using dry-struct classes as source for hash schemas. Note that output will still be presented as plain hashes, returning structs from schemas will require more work, it's planned for next versions (@flash-gordon)
+- `:info` extension which adds #info method to your schemas which produces a simple hash providing information about keys and types (issue #36 closed via #262) (@solnic)
+
### Fixed
-* Some keyword warnings that slipped into the previous release (@flash-gordon)
+- `maybe` macro in JSON schemas no longer converts empty strings to `nil`.
+This was a bug in dry-types but your code may rely on this behavior. If you still
+require this behavior, we recommend using a custom type (see Advanced -> Custom types in the docs) (@flash-gordon)
+- YAML message backend no longer crashes when load_paths are empty (@robhanlon22)
+- Callbacks can now be inherited from multiple parents (@skryukov)
+- Callbacks work with nested schemas (issue #209) (@solnic)
+- Custom type is respected when defining nested schemas (issue #174 closed via 263) (@solnic)
+- Key map is properly inferred for maybe-hashes (issue #266 fixed via #269) (@solnic)
+### Changed
+
+- `:i18n` message backend delegates interpolation and caching to `I18n` (issue #211) (@robhanlon22)
+- Raise ArgumentError in DSL if parent DSL configs differ (@robhanlon22)
+- (internal) `PredicateInferrer` was removed. `Dry::Types::PredicateInferrer` is a drop-in replacement (@flash-gordon)
+
+[Compare v1.4.3...v1.5.0](https://github.com/dry-rb/dry-schema/compare/v1.4.3...v1.5.0)
+
+## 1.4.3 2020-01-08
+
+
+### Added
+
+- Pattern matching for `Dry::Schema::Result` objects (@flash-gordon)
+ ```ruby
+ schema = Dry::Schema::Params { required(:name).filled }
+ case schema.('name' => 'John')
+ in name:
+ name # => 'John'
+ end
+ ```
+ Try it with monads!
+- Shortcut for nested schemas in `value` and `maybe` macros (@waiting-for-dev)
+ ```ruby
+ Dry::Schema.Params do
+ required(:address).value(:hash) do
+ required(:city).filled
+ end
+ end
+ ```
+
+### Fixed
+
+- Some keyword warnings that slipped into the previous release (@flash-gordon)
+
+
[Compare v1.4.2...v1.4.3](https://github.com/dry-rb/dry-schema/compare/v1.4.2...v1.4.3)
-# 1.4.2 2019-12-19
+## 1.4.2 2019-12-19
+
### Fixed
-* `I18n` messages backend supports procs as text properly (issue #208) (@robhanlon22)
-* `I18n` messages backend supports message meta-data (issue #210) (@robhanlon22)
-* Fixed keyword warnings from MRI 2.7.0 (@flash-gordon)
-* Array with a member works correctly with `maybe` (issue #206) (@solnic)
+- `I18n` messages backend supports procs as text properly (issue #208) (@robhanlon22)
+- `I18n` messages backend supports message meta-data (issue #210) (@robhanlon22)
+- Fixed keyword warnings from MRI 2.7.0 (@flash-gordon)
+- Array with a member works correctly with `maybe` (issue #206) (@solnic)
+
[Compare v1.4.1...v1.4.2](https://github.com/dry-rb/dry-schema/compare/v1.4.1...v1.4.2)
-# 1.4.1 2019-10-08
+## 1.4.1 2019-10-08
+
### Fixed
- Child schemas no longer mutate processing steps of their parent classes (@skryukov)
+
[Compare v1.4.0...v1.4.1](https://github.com/dry-rb/dry-schema/compare/v1.4.0...v1.4.1)
-# 1.4.0 2019-10-08
+## 1.4.0 2019-10-08
+
### Added
- Support for passing multiple parent schemas. They are inherited from left to right (@ianwhite)
- ```ruby
- Dry::Schema.define(parent: [parent_a, parent_b, parent_c]) do
- ...
- end
- ```
-
+ ```ruby
+ Dry::Schema.define(parent: [parent_a, parent_b, parent_c]) do
+ ...
+ end
+ ```
- Improved error messages about missing translations (@skryukov)
- [experimental] before/after callbacks for schema steps (@skryukov)
```ruby
Dry::Schema.Params do
@@ -73,91 +122,102 @@
### Fixed
- Added/fixed support for custom optional types (@flash-gordon)
+
[Compare v1.3.4...v1.4.0](https://github.com/dry-rb/dry-schema/compare/v1.3.4...v1.4.0)
-# 1.3.4 2019-09-11
+## 1.3.4 2019-09-11
+
### Fixed
- Fixed regression where using `array?` predicate within a block would crach (issue #186) (@skryukov)
+
[Compare v1.3.3...v1.3.4](https://github.com/dry-rb/dry-schema/compare/v1.3.3...v1.3.4)
-# 1.3.3 2019-08-14
+## 1.3.3 2019-08-14
+
### Fixed
- Reject attempts to build a nested schema for array types built on `Dry::Types::Nominal` (fixed #171) (@flash-gordon)
- Current `I18n.locale` is now properly handled when caching message templates (@flash-gordon)
- Default processor uses strict types by default, which fixes various cases when `maybe` is used with a constructor type (@flash-gordon)
- Namespaced messages no longer causes a crash when used with nested schemas (fixed #176) (@solnic)
+
[Compare v1.3.2...v1.3.3](https://github.com/dry-rb/dry-schema/compare/v1.3.2...v1.3.3)
-# 1.3.2 2019-08-01
+## 1.3.2 2019-08-01
+
### Added
- Support for new predicates: `bytesize?`, `min_bytesize?` and `max_bytesize?` (@bmalinconico)
+
[Compare v1.3.1...v1.3.2](https://github.com/dry-rb/dry-schema/compare/v1.3.1...v1.3.2)
-# 1.3.1 2019-07-08
+## 1.3.1 2019-07-08
+
### Fixed
- `Result#error?` works correctly with nested hashes and arrays (@solnic)
- `:hints` extension no longer causes a crash where base messages are generated too (issue #165) (@solnic)
+
[Compare v1.3.0...v1.3.1](https://github.com/dry-rb/dry-schema/compare/v1.3.0...v1.3.1)
-# 1.3.0 2019-07-06
+## 1.3.0 2019-07-06
+
### Added
- Automatic predicate inferring for constrained types! (@flash-gordon)
- ```ruby
- Types::Name = Types::String.constrained(min_size: 1)
+ ```ruby
+ Types::Name = Types::String.constrained(min_size: 1)
- schema = Dry::Schema.define do
- required(:name).value(Types::Name)
- end
+ schema = Dry::Schema.define do
+ required(:name).value(Types::Name)
+ end
- schema.(name: '').errors.to_h # => { name: ["size cannot be less than 1"] }
- ```
-
+ schema.(name: '').errors.to_h # => { name: ["size cannot be less than 1"] }
+ ```
- Support for redefining re-used schemas (issue #43) (@skryukov)
### Fixed
- Type container is passed down to nested schemas (@flash-gordon)
+
[Compare v1.2.0...v1.3.0](https://github.com/dry-rb/dry-schema/compare/v1.2.0...v1.3.0)
-# v1.2.0 2019-06-13
+## 1.2.0 2019-06-13
+
### Added
- Ability to configure your own type container (@Morozzzko)
- ```ruby
- types = Dry::Schema::TypeContainer.new
- types.register(
- 'params.trimmed_string',
- Types::String.constructor(&:strip).constructor(&:downcase)
- )
+ ```ruby
+ types = Dry::Schema::TypeContainer.new
+ types.register(
+ 'params.trimmed_string',
+ Types::String.constructor(&:strip).constructor(&:downcase)
+ )
- Dry::Schema.Params do
- config.types = types
+ Dry::Schema.Params do
+ config.types = types
- require(:name).value(:trimmed_string)
- end
- ```
+ require(:name).value(:trimmed_string)
+ end
+ ```
### Fixed
- `filled` macro no longer generates incorrect messages for arrays (issue #151) (@solnic)
- `filled` macro works correctly with constructor types (@solnic)
@@ -171,12 +231,13 @@
- Fixes related to `filled` restored pre-1.1.0 behavior of `:hints` which are again included (@solnic)
- `filled` no longer uses filter rules to handle empty strings in `Params` (@solnic)
[Compare v1.1.0...v1.2.0](https://github.com/dry-rb/dry-schema/compare/v1.1.0...v1.2.0)
-# v1.1.0 2019-05-30
+## 1.1.0 2019-05-30
+
### Added
- `config.messages.default_locale` for setting...default locale (surprise, surprise) (@solnic)
- `Config` exposes `predicates` setting too (@solnic)
@@ -188,97 +249,108 @@
- Inherited type schemas used by coercion are now properly configured as `lax` type (@solnic)
- `Config` is now finalized before instantiating schemas and properly dupped when its inherited (@flash-gordon + @solnic)
- `Config#eql?` works as expected (@solnic)
- Predicates are properly inferred from array with a member type spec, ie `array[:integer]` results in `array? + each(:integer?)` (issue #140) (@solnic)
+
[Compare v1.0.3...v1.1.0](https://github.com/dry-rb/dry-schema/compare/v1.0.3...v1.1.0)
-# v1.0.3 2019-05-21
+## 1.0.3 2019-05-21
+
### Fixed
- `Object#hash` is no longer used to calculate cache keys due to a potential risk of having hash collisions (@solnic)
- Predicate arguments are used again for template cache keys (@solnic)
- `I18n` messages backend no longer evaluates templates twice (@solnic)
+
[Compare v1.0.2...v1.0.3](https://github.com/dry-rb/dry-schema/compare/v1.0.2...v1.0.3)
-# v1.0.2 2019-05-12
+## 1.0.2 2019-05-12
+
### Fixed
- Caching message templates uses restricted set of known keys to calculate cache keys (issue #132) (@solnic)
+
[Compare v1.0.1...v1.0.2](https://github.com/dry-rb/dry-schema/compare/v1.0.1...v1.0.2)
-# 1.0.1 2019-05-08
+## 1.0.1 2019-05-08
+
### Fixed
- Applying `key?` predicate no longer causes recursive calls to `Result#errors` (issue #130) (@solnic)
+
[Compare v1.0.0...v1.0.1](https://github.com/dry-rb/dry-schema/compare/v1.0.0...v1.0.1)
-# 1.0.0 2019-05-03
+## 1.0.0 2019-05-03
-### Changed
-- [BREAKING] `Result#to_hash` was removed (@solnic)
-
### Fixed
- Setting `:any` as the type spec no longer crashes (@solnic)
- `Result#error?` handles paths to array elements correctly (@solnic)
+### Changed
+
+- [BREAKING] `Result#to_hash` was removed (@solnic)
+
[Compare v0.6.0...v1.0.0](https://github.com/dry-rb/dry-schema/compare/v0.6.0...v1.0.0)
-# 0.6.0 2019-04-24
+## 0.6.0 2019-04-24
+
### Changed
- Dependency on `dry-types` was bumped to `~> 1.0` (@solnic)
- Dependency on `dry-logic` was bumped to `~> 1.0` (@solnic)
- Dependency on `dry-initializer` was bumped to `~> 3.0` (@solnic)
[Compare v0.5.1...v0.6.0](https://github.com/dry-rb/dry-schema/compare/v0.5.1...v0.6.0)
-# 0.5.1 2019-04-17
+## 0.5.1 2019-04-17
+
### Fixed
- Key map no longer crashes on unexpected input (issue #118) (@solnic)
+
[Compare v0.5.0...v0.5.1](https://github.com/dry-rb/dry-schema/compare/v0.5.0...v0.5.1)
-# 0.5.0 2019-04-04
+## 0.5.0 2019-04-04
+
### Added
- Support for arbitrary meta-data in messages, ie:
- ```yaml
- en:
- dry_schema:
- errors:
- filled?:
- text: "cannot be blank"
- code: 123
- ```
+ ```yaml
+ en:
+ dry_schema:
+ errors:
+ filled?:
+ text: "cannot be blank"
+ code: 123
+ ```
- Now your error hash will include `{ foo: [{ text: 'cannot be blank', code: 123 }] }` (@solnic + @flash-gordon)
-
+ Now your error hash will include `{ foo: [{ text: 'cannot be blank', code: 123 }] }` (@solnic + @flash-gordon)
- Support for type specs in `array` macro, ie `required(:tags).array(:integer)` (@solnic)
- Support for type specs in `each` macro, ie `required(:tags).each(:integer)` (@solnic)
- Shortcut for defining an array with hash as its member, ie:
- ```ruby
- Dry::Schema.Params do
- required(:tags).array(:hash) do
- required(:name).filled(:string)
- end
- end
- ```
+ ```ruby
+ Dry::Schema.Params do
+ required(:tags).array(:hash) do
+ required(:name).filled(:string)
+ end
+ end
+ ```
### Fixed
- Inferring predicates doesn't crash when `Any` type is used (@flash-gordon)
- Inferring type specs when type is already set works correctly (@solnic)
@@ -288,12 +360,13 @@
- [BREAKING] `:monads` extension wraps entire result objects in `Success` or `Failure` (@flash-gordon)
- When `:hints` are disabled, result AST will not include hint nodes (@solnic)
[Compare v0.4.0...v0.5.0](https://github.com/dry-rb/dry-schema/compare/v0.4.0...v0.5.0)
-# 0.4.0 2019-03-26
+## 0.4.0 2019-03-26
+
### Added
- Schemas are now compatible with procs via `#to_proc` (issue #53) (@solnic)
- Support for configuring `top_namespace` for localized messages (@solnic)
- Support for configuring more than one load path for localized messages (@solnic)
@@ -310,21 +383,22 @@
- [BREAKING] Updated to work with `dry-types 0.15.0` (@flash-gordon)
- [BREAKING] `Result#{errors,messages,hints}` returns `MessageSet` object now which is an enumerable coercible to a hash (@solnic)
- [BREAKING] `Messages` backend classes no longer use global configuration (@solnic)
- [BREAKING] Passing a non-symbol key name in the DSL will raise `ArgumentError` (issue #29) (@solnic)
- [BREAKING] Configuration for message backends is now nested under `messages` key with following settings:
- - `messages.backend` - previously `messages`
- - `messages.load_paths` - previously `messages_path`
- - `messages.namespace` - previously `namespace`
- - `messages.top_namespace` - **new setting** see above
+ - `messages.backend` - previously `messages`
+ - `messages.load_paths` - previously `messages_path`
+ - `messages.namespace` - previously `namespace`
+ - `messages.top_namespace` - **new setting** see above
- [BREAKING] `Messages::I18n` uses `I18.store_translations` instead of messing with `I18n.load_path` (@solnic)
- Schemas (`Params` and `JSON`) have nicer inspect (@solnic)
[Compare v0.3.0...v0.4.0](https://github.com/dry-rb/dry-schema/compare/v0.3.0...v0.4.0)
-# 0.3.0 2018-03-04
+## 0.3.0 2018-03-04
+
### Fixed
- Configuration is properly inherited from a parent schema (@skryukov)
- `Result#error?` returns `true` when a preceding key has errors (@solnic)
- Predicate inferrer no longer chokes on sum, constructor and enum types (@solnic)
@@ -336,12 +410,13 @@
- Required ruby version was removed from gemspec for people who are stuck on MRI 2.3.x (@solnic)
[Compare v0.2.0...v0.3.0](https://github.com/dry-rb/dry-schema/compare/v0.2.0...v0.3.0)
-# 0.2.0 2019-02-26
+## 0.2.0 2019-02-26
+
### Added
- New `hash` macro which prepends `hash?` type-check and allows nested schema definition (@solnic)
- New `array` macro which works like `each` but prepends `array?` type-check (@solnic)
@@ -365,25 +440,23 @@
- [BREAKING] `schema` macro no longer prepends `hash?` check, for this behavior use the new `hash` macro (see #31) (@solnic)
- [BREAKING] Support for MRI < 2.4 was dropped (@solnic)
[Compare v0.1.1...v0.2.0](https://github.com/dry-rb/dry-schema/compare/v0.1.1...v0.2.0)
-# 0.1.1 2019-02-17
+## 0.1.1 2019-02-17
+
### Added
- `Result#error?` supports checking nested errors too ie`result.error?('user.address')` (@solnic)
### Fixed
- Fix issues with templates and invalid tokens (issue #27) (@solnic)
- Fix Ruby warnings (@flash-gordon)
-### Internal
-- Key and value coercers are now equalizable (@flash-gordon)
-
[Compare v0.1.0...v0.1.1](https://github.com/dry-rb/dry-schema/compare/v0.1.0...v0.1.1)
-# 0.1.0 2019-01-30
+## 0.1.0 2019-01-30
Initial release.