AddProblemDetailsConventions changes HTTP 400 to 422See original GitHub issue
- Created a year ago
- Comments:17 (9 by maintainers)
Top GitHub Comments
You can set
ValidationProblemStatusCode back to 400 of you want:
There’s a domain-specific language layered on top of the JSON. The syntax of that language is expressed in the semantic content of the JSON. Model binding and validation are responsible for validating that syntax. Model binding and validation are in absolutely no way concerned with the semantic content of that language. From the perspective of the controller and service layers, as well as the client, any error that occurs during model binding and validation is a syntax error. This is the sense in which “syntax” should be understood in RFC4918. Logically, this inevitably follows from recognizing that the schema is a language. Pragmatically, it creates an elegant separation of concerns that is neatly reflected in the response codes.
Normalizing returning 422 for errors in model binding and validation will harm the Internet.