dry-rb / dry-schema

Coercion and validation for data structures
https://dry-rb.org/gems/dry-schema
MIT License
415 stars 108 forks source link

MessageMissingError when using uri? predicate #476

Open timjnh opened 6 months ago

timjnh commented 6 months ago

Describe the bug

With 1.13.3 I receive a Dry::Schema::MissingMessageError if I try to generate errors for the uri? predicate

To Reproduce

require 'dry/schema'
require 'uri'

contract = Dry::Schema.Params do
  required(:uri) { str? & uri?(:https) & filled? }
end

result = contract.call(uri: "nope")

puts result.errors.inspect

Expected behavior

I should get a reasonable error message such as must be a valid URI

My environment

timjnh commented 6 months ago

Happy to put in a PR to fix this one. Seems very similar to https://github.com/dry-rb/dry-schema/issues/470 and https://github.com/dry-rb/dry-schema/pull/244/files