dry-schema
dry-schema copied to clipboard
Coercion and validation for data structures
Following issue #245, I tried to implement a similar situation inside a `dry-validators` contract, but the following code fails when there is at least one rule involved, see example below...
## Describe the bug When using a custom type for example: `ExpirationDate = Types::DateTime.constructor { |value| value.to_time.round.to_datetime }` The constructor does not apply to nested hashes in a schema: ```ruby...
Hi, Are there any options to describe schema with dynamic keys? Let's say I have a hash where keys are string numbers: ```ruby { foo: { '1' => { name:...
Currently specifying types in the DSL is not mandatory and by default, whenever you specify a key via `required` or `optional` methods, [a default `Types::Any` is set](https://github.com/dry-rb/dry-schema/blob/master/lib/dry/schema/dsl.rb#L180). This was done...
``` SchemaA = Dry::Schema.JSON do config.types = Types::TypeContainer required(:type).value(eql?: "typeA") required(:attributes).value(:hash) do required(:foo).filled(:string) end end SchemaB = Dry::Schema.JSON do config.types = Types::TypeContainer required(:type).value(eql?: "typeB") required(:attributes).value(:hash) do required(:bar).filled(:string) end end class...
## Describe the bug If you validate a nested schema inside an `array` and use an OR, type coercion doesn't work for the inner schema. ## To Reproduce ```ruby it...
## Describe the bug Problem during schema validation: On the prerequisites field of the example I want validate that this array contain only hash describe by the previous schemas. Every...
## Describe the bug `Object doesn't support #inspect` error is raised when validating an object shown in the example below. ## To Reproduce ``` require 'dry/schema' module Types include Dry::Types()...
## Describe the bug Upgraded from version 1.6.1 to 1.7.1 and detected error in my app's tests. Basically, when an empty block is passed, key validation is wrongly validated. I...
## Describe the bug `Types.Interface` only returns an error, if the second method in the list is missing, while not in case of first method missing. Let's say, I have...