Currently, it is possible to define, for example, the validation of a form through Dry::Validation.Params
. It will pre-process given input (symbolizing keys and coercing values) and later it will apply the “expected schema”.
However, I’d like to be able to define just a “core business” schema, and then be able to call it from different interfaces applying an input pre-processor which only makes sense for that interface. For example, for the web interface, something like that:
result = MySchema.(
Dry::Validation::Processors::Params.(my_input)
)
I think it makes more sense because it is decoupling validation rules from input pre-processing. However, if I’m not wrong, it is possible to do that easily. Pre-processors expect the AST, and doing it manually through type_specs
would be very cumbersome.
Is there another way to do that, or is it planned for 1.0?
Thanks in advance.