dry-schema icon indicating copy to clipboard operation
dry-schema copied to clipboard

Make type specs mandatory

Open solnic opened this issue 4 years ago • 0 comments

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.

This was done like that just to make it simpler to upgrade from dry-validation 0.x to 1.0 where dry-schema is used as the schema backend. Unfortunately having optional type specs introduced a lot of complexity in the DSL itself.

In dry-schema 2.0.0 type specs should become mandatory. This means that every DSL method that doesn't have a type predefined should expect a type spec as the first argument.

Examples

# 1.x
required(:name).value
required(:name).filled

# 2.x
required(:name).value(:string)
required(:name).filled(:string)

solnic avatar Mar 12 '20 11:03 solnic