Create API in .NET

ASP.NET automatically adds the FluentValidation in ModelValidation pipeline. After model binding in Api Controller, framework automatically resolve validator and add Model State, that’s how automatically your Dto is validated. Flow Configure ApiBehaviorOptions in services to set custom response on fluent validation fail.

RFC 7807

By default .net API returns error in this format RFC 7807. RFC 7807 is a Standard “Problem Details for HTTP APIs”. This is a JSON error format used Asp.net (application/problem+json). 5 standard fields in RFC 7807 There’s no standard format for success APIs. Benefits of RFC 7807