I’d like to use an existing schema class as the schema for a contract. Something like:
class MySchema < Dry::Schema::Params
define do
...
end
end
class MyContract < Dry::Validation::Contract
params(&MySchema)
end
I’d like to use an existing schema class as the schema for a contract. Something like:
class MySchema < Dry::Schema::Params
define do
...
end
end
class MyContract < Dry::Validation::Contract
params(&MySchema)
end
Looks like I can do
class MyContract < Dry::Validation::Contract
@__schema__ = MySchema.new
end
Yes BUT this is not public API. We’ll add the official support for setting schemas eventually. Feel free to report an issue about it.