Search code examples
asp.net-coreswagger-uifluentvalidationswashbuckle.aspnetcore

Swagger not showing Fluent validation required fields


I have an ASP.NET Core 7 Web API which uses Newtonsoft JSON.NET for its serialization. I have fluent validations added to my models and added Swagger.

The fluent validations show up on swagger UI when I use Newtonsoft for serialization.

enter image description here

But I recreated the same project and this time using System.Text.Json, then the fluent validations do not show up in the Swagger UI:

enter image description here

Here is the repo using System.Text.Json: https://github.com/tnlthanzeel/Inx.Project.Templates

Any help please?


Solution

  • After going through few github issues and found out i had to update the MicroElements.Swashbuckle.FluentValidation to the latest beta version (which is 6.0.0-beta.3 at the time of writing this answer)