dry-rb / dry-schema

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

Improve error message for attr? predicate #332

Closed tylerhunt closed 4 years ago

tylerhunt commented 4 years ago

Changes the error message for the attr? predicate from:

"is missing"

to:

"must respond to %{name}"
esparta commented 4 years ago

Even though the message is more accurate, IMO it's a breaking change because the users may be expecting this previous specific error message on their own tests.

solnic commented 4 years ago

actually, this predicate shouldn't exist anymore. I forgot to remove it prior 1.0.0 release. Geez 🤦

tylerhunt commented 4 years ago

@solnic Hmm, how should this be handled instead? What was the deciding factor in choosing which predicates would be included?

solnic commented 4 years ago

@tylerhunt attr? was added back in dry-validation 0.x era when we still thought that validating objects could be a use case that dry-validation should support. This has changed and now both dry-validation and dry-schema are meant to validate data only, that is, objects that represent data. The interface for accessing the values is #[], checking method names, aka attributes, is not a feature we want to support because it's against the philosophy both libraries promote.

I'm sorry for this but I'll close this PR and make a note that this predicate and everything related should be removed in 2.0.0.