Hello,
I’m wonder how can I customise the error message against the type value in this example?
class SaveValidation < Dry::Validation::Contract
config.configure do |c|
c.messages.load_paths << File.join(__dir__, 'save_validation_messages.yml')
end
module T
include Dry.Types()
TimeOfDay = Constructor(Tod::TimeOfDay) { |str| Tod::TimeOfDay.parse(str) } # tod gem
end
params do
required(:pickup_time).value(T::TimeOfDay)
end
end
The error message against pickup_time
is ["must be Tod::TimeOfDay"]
.
Is it possible to provide a more useful message in this case and if so I would appreciate any pointers
Cheers,
D.