Replies: 3 comments 3 replies
-
@ahx It looks nice!
I like
In this interface, If I only want to validate, should I reset all converters including default converters, manually? or, can it have an option to opt-out converting, like this? validated_and_converted =
definition.validate_request(rack_request, apply_value_converter: true)
validated_and_not_converted =
definition.validate_request(rack_request, apply_value_converter: false)
# default behavior. apply converters by default.
validated_and_converted = definition.validate_request(rack_request) |
Beta Was this translation helpful? Give feedback.
-
I just reviewed your last commits and it looks really good with the explicit |
Beta Was this translation helpful? Give feedback.
-
This API has been released in 1.3.0. Converters are not implemented, yet. |
Beta Was this translation helpful? Give feedback.
-
This is a follow-up of #207
This is another variant with new a API that could supports converters. I hope that this also simplifies the general API a bit as well.
I like this API overall, except of the "failure" case (see beneath). My question is:
Do we need an extra method that raises an error instead of returning a failure object? Using a bang method (like
validate_request!
) for that is not really idiomatic Ruby, but it's simple to use. Do you have any thoughts about this and the new interface?I would like to support inspecting a failed validation as well as raising a meaningful exception. This could look like:
Beta Was this translation helpful? Give feedback.
All reactions