Calling contracts on an array attribute

Hello,
I was tasked with updating an old project (dry-validation 0.12) and I’m quite confused on how to adapt this specific piece of code :

  required(:materials).each do
    schema(Material.validation_schema)
  end

This was quite handy, but now validation_schema is a Contract not a Schema as I tried to preserve the code structure (I do need to rename them), so schema(Material.validation_schema) no longer works and I’m not sure how to achieve this with Contracts.

Thanks!

dry-validation was split into two projects, adding dry-schema as a separate thing. So a validation contract is an enclosing object around a Dry::Schema.

If you do not need the features of a contract, you can use schema objects directly. If you wish to keep them as contracts, you can access the internal schema from the .schema class method.

There was an attempt to make contracts directly composable, but that is not yet supported.