Currently by default property name is included in the message for each decorator. Is there a way to disable this behaviour? It kinda doesn't make sense to make it default because this should be a business message that something went wrong. Do you really want to display non meaningful field name there?
Example:
userAge cannot be empty
How would you describe the error then? This error message is for programmers, you need to build your own layer above it. Eg we transform form error messages to a format how angular expects form errors.
I really thought it's a message that you should be able to display directly. I'm using redux-forms in react and I have my own layer that converts validation errors into error object however a message is something that I display to users under every field so there is no need for displaying a field name. Currently for every attribute I use I have to create my own wrapper which basically overrides a 'message' into something meaningful like for IsNonEmpty attribute I have Required. It would be nice to have like a global setting to include/exclude property names from the default message.
I second this request.
In a lot of cases, the errors returned will be used on the frontend, especially for an MVP.
I have a workaround as I transform the errors and can easily trim the start if it is the property name but that's not always feasible.
Most helpful comment
I really thought it's a message that you should be able to display directly. I'm using redux-forms in react and I have my own layer that converts validation errors into error object however a
messageis something that I display to users under every field so there is no need for displaying a field name. Currently for every attribute I use I have to create my own wrapper which basically overrides a 'message' into something meaningful like forIsNonEmptyattribute I haveRequired. It would be nice to have like a global setting to include/exclude property names from the default message.