Reusing Dry::Validation.Form

Is there a way to reuse or inherit Dry::Validation.Form?
With Schema I can do something like:

ParentSchema = Dry::Validation.Schema do
  required(:order_description) { filled? & str? }
  required(:commission_payer) { filled? & str? }
  required(:cost) { (float? | int?) & gt?(0) }
  required(:verify_days) { filled? & int? }
  required(:verify_days) { is_a_number? }
  optional(:title) { str? }
  optional(:consumer_id).maybe(:int?)
end

Dry::Validation.Schema(ParentSchema) do
  required(:contragent_email) { str? & email? }
  optional(:supplier_billing_info_id) { int? }
end

Is something like this possible for Dry::Validation.Form?

1 Like

Yep, this should be possible. Does this spec help you work it out? https://github.com/dry-rb/dry-validation/blob/master/spec/integration/schema/inheriting_schema_spec.rb