You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In dry-validations and hanami-validations we can define arbitrary rules, which are particularly handy when defining a validation that acts on multiple attributes, e.g.:
classEventContract < Dry::Validation::Contractparamsdorequired(:start_date).value(:date)required(:end_date).value(:date)endrule(:end_date,:start_date)dokey.failure('must be after start date')ifvalues[:end_date] < values[:start_date]endend
On hanami-controller, I see that we have support for a params block within actions, so we can wrap our request params within a hanami-validations params block and validate accordingly.
...But I don't see any way to use arbitrary rules on hanami-controller. Is it possible on Hanami 2?
In Hanami 2 however, I'm currently simply using concrete classes inheriting from Dry::Validations::Contract and manually instantiating and validating the parameters, but I would like to see a more supported way if possible 🤔
The text was updated successfully, but these errors were encountered:
In
dry-validations
andhanami-validations
we can define arbitrary rules, which are particularly handy when defining a validation that acts on multiple attributes, e.g.:On
hanami-controller
, I see that we have support for aparams
block within actions, so we can wrap our request params within a hanami-validationsparams
block and validate accordingly....But I don't see any way to use arbitrary rules on hanami-controller. Is it possible on Hanami 2?
I know it was possible in Hanami 1, e.g.:
In Hanami 2 however, I'm currently simply using concrete classes inheriting from Dry::Validations::Contract and manually instantiating and validating the parameters, but I would like to see a more supported way if possible 🤔
The text was updated successfully, but these errors were encountered: