dry-validation
dry-validation copied to clipboard
Validation library with type-safe schemas and rules
Support for executing predicates using `validate` method within `rule` blocks will make it much easier to apply various checks with extra conditions: ```ruby params do optional(:per_page).filled(:integer) end rule(:per_page) do if...
I'd like to be able to specify a macro in the following manner: `rule(foo: :bar).each` where both `foo` and `bar` are arrays. ## Examples As an example please have a...
There's no information on this page about how exactly the `option` DSL works. We could clarify things with a sentence saying it is provided by dry-initializer and linking to its...
In complex rules, it may be useful to know whether the key has any failure message already. ```ruby rule(:foos).each do key.success? # => true key.failure? # => false key.failure('wrong') key.success?...
```ruby class MyContract < Dry::Validation::Contract params do required(:hogwarts_house).hash do required(:head).filled(:string) required(:common_room).hash do required(:name).filled(:string) required(:location).filled(:string) end end end rule('hogwarts_house.head').validate(size?: 1..255) rule('hogwarts_house.head').validate(format?: SOME_REGEX) rule('hogwarts_house.common_room.location').validate(included_in?: ['tower', 'underground']) end ``` For `included_in?` and `size?`...
Update all usages of dry-configurable-provided `config` so that any changes are made inside `configure` blocks. This prepares for the changes in https://github.com/dry-rb/dry-configurable/pull/140.
## Describe the bug When creating a custom type and using with the `array` rule, it appears that the validations applied by the type are not applied always by the...
Hey all, first of all thanks for the great library, we're using this gem a lot (alongside a variety of other tools from the dry-rb ecosystem) and find it super-useful...
## Describe the bug ```ruby result = contract.call(params) # errors(full: false) works fine .. result.errors.to_h.to_json # "{\"items\":{\"0\":{\"weight\":{\"unit\":[\"must be one of: g, kg, lb, oz\"]}}}}" # errors(full: true), for nested input,...
## Describe the bug When `Dry::Validation::Contract` contains `params Dry::Schema::Params(parent: RawSchema)` (where `RawSchema` is defined using `Dry::Schema.define do ... end`), it fails to coerce empty Strings into Integers. However, if I...