dry-schema
dry-schema copied to clipboard
Coercion and validation for data structures
As noted in [this forum discussion](https://discourse.dry-rb.org/t/matching-optional-params-schema-against-a-nested-schema/1069), using a nested params object that also allows nil doesn't validate correctly. ``` inner_schema = Dry::Schema.Params do required(:path).filled(:string) end outer_schema = Dry::Schema.Params do required(:foo).maybe(inner_schema)...
I'm trying to use this lib for schema validation, and there is this use case where a key needs to be filled with a default, when nothing is passed. I...
https://dry-rb.org/gems/dry-schema/1.5/basics/type-specs/#using-custom-types This is not enough information related to custom types and coercions. It should cover the following topics: 1) When coercion is applied 2) How hash keys are handled and...
**Describe the bug** I need a Contract that is valid for hashes where the `:data` key is either a `Hash` with defined structure or an `Array` of such `Hash`es: ```ruby...
The JSON standard defines the following data types - number (WRT ruby both float and integer shall be supported) - string - boolean - array - object (represented as Hash...
Method `Dry::Schema::Result#errors` raises an error when using `array(...)` with XOR predicate. ```ruby schema = Dry::Schema.Params do required(:ids) do array(:integer) ^ eql?(['']) end end schema.call(ids: 'asdf').errors Traceback (most recent call last):...
When I add a schema like: ```ruby optional = Dry::Schema.JSON do required(:a).maybe do hash do required(:b).filled.type(:string) required(:c).filled.type(:integer) end end end ``` When I try to validate with: ```ruby optional.call({a: {b:...
**Summary:** Type hints for primitive, nested values are not displayed if the parent hash is missing. **Steps to reproduce:** ```ruby Dry::Schema.load_extensions(:hints) class Schema < Dry::Schema::Params define do required(:transaction).hash do required(:currency).filled(:string,...
**Describe the bug** In the case of an array of schemas, all entries are ignored by `KeyMap`. **To Reproduce** ```rb require 'dry/schema' MySchema = Dry::Schema.Params do required(:list).each do schema do...
Hi, i'm using v 0.11.0 in hanami framework. I have following params: ``` { "body": { "type": "doc", "content": [ { "type": "paragraph", "content": [ { "type": "paragraph", "content": [...