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
const{error, value}=schema.validate({a: '1'});error// => nullvalue// => {a: 1} the string '1' is converted to 1
As you can see, thanks to type coercion there is no error and the value has the correct types.
However, on Seneca only the error is taken in account, and if the validation passes then the original msg is provided to the handler. This is a big problem because the original message may not be 100% correct (ej: the a was a string)
Not sure if this should be fixed on seneca-joi or on seneca itself, but it is stopping us from using seneca-joi.
Regards
The text was updated successfully, but these errors were encountered:
great feature idea - but this belongs in a separate category of plugins that modify the original message - adding an issue in the seneca repo
leaving open as reminder
Hello,
One of the nicest (and importants) features of Joi is that it performs types coercion when possible.
For example, with the following Joi definition
You get the following validation :
As you can see, thanks to type coercion there is no error and the value has the correct types.
However, on Seneca only the error is taken in account, and if the validation passes then the original msg is provided to the handler. This is a big problem because the original message may not be 100% correct (ej: the
a
was a string)Not sure if this should be fixed on seneca-joi or on seneca itself, but it is stopping us from using seneca-joi.
Regards
The text was updated successfully, but these errors were encountered: