Let’s say if I have this schema:
Schema = Dry::Validation.Params do
required(:company_id).filled(:int?)
required(:names).filled(:array?)
optional(:company_branch_id).maybe(:int?)
end
Can I embed it into another schema that contains high levels rules?
The result of this embedding would create a schema like this:
NewSchema = Dry::Validation.Params do
required(:company_id).filled(:int?)
required(:names).filled(:array?)
optional(:company_branch_id).maybe(:int?)
validate(..) do
end
rule(...) do
end
end
I could imagine it working something like this:
NewSchema = Dry::Validation.Params do
schema(Schema)
validate(..) do
end
rule(...) do
end
end
I know solniss mentioned that it will be easily possible in the new 1.0 dry-validation/dry-schema, but is there a way to do it now?