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
Is your feature request related to a problem? Please describe.
It would be great to not have to write a message for each schema, especially when the error message is not used in the client side.
Describe the solution you'd like
Make every schema's message property optional, enabling the library to provide its own message (in english).
import*asKryptonianfrom"kryptonian";// ThisKryptonian.Kalel.string({rules: []});// Instead of thisKryptonian.Kalel.string({message: "",rules: []});
import*asKryptonianfrom"kryptonian";// ThisKryptonian.Kalel.string({rules: [Kryptonian.Kalel.String.email()]});// Instead of thisKryptonian.Kalel.string({rules: [Kryptonian.Kalel.String.email({message: "This should be a valid email"})]});
Describe alternatives you've considered
None.
Additional context
This does not prevent the library from being type safe! This only make the property optional, with a default message that can still be relevant for most purposes.
Also, the library will still check for the schema to be in accordance with the data, and if this is not the case, a BadRequestError will still be raised (and would still require to be accounted for).
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
It would be great to not have to write a message for each schema, especially when the error message is not used in the client side.
Describe the solution you'd like
Make every schema's
message
property optional, enabling the library to provide its own message (in english).Describe alternatives you've considered
None.
Additional context
This does not prevent the library from being type safe! This only make the property optional, with a default message that can still be relevant for most purposes.
Also, the library will still check for the schema to be in accordance with the data, and if this is not the case, a
BadRequestError
will still be raised (and would still require to be accounted for).The text was updated successfully, but these errors were encountered: