In web api there are 2 kinds of errors
- Errors resulting from type mismatch e.g.
- Invalid date in datefield.
- string in int parameter.
These input errors result executes default Model binder validation which has the different schema than the fluent validation errors

- Busines errors e.g. required field etc.
If FluentValidation is used client might be expecting errors message only in one format, however since binding errors are returned and formatted by .net framework it leads to inconsistencies between validation errors returned when datatypes cannot be mapped vs business validation (e.g. Required validation).
Reformat binding errors messages same format as FluentValidation error messages.
- Clone repository
- RUN
dotnet build - RUN
dotnet run
Sample curl
curl --location --request POST 'http://localhost:5000/api/Person' \
--header 'Content-Type: application/json' \
--data-raw '{
"DateOfBirth":"2018-09-09"
}'
Model Binding Errors
