Closed aretsof closed 4 years ago
Great catch, I've been wondering why that wasn't working! I'll get it merged in later today and released.
I've deployed v0.4.0 with these changes. I also noticed that the issue occurs also with c# enums if you want to take a stab at it. Redoc seems to display both correctly, but Swagger UI has issues with the complex type enums in the example display.
NSwag.FluentValidation
When a class has a complex type as a property and a validator sets it as
NotNull()
orNotEmpty()
, currently a schema property such as below is created:Due to the fact that "oneOf" is used, the "Example Value" shown by Swagger UI doesn't include the property.
With the changes in this PR, the generated swagger.json schema property now looks like this:
Which no longer uses "oneOf", and therefore results in a correct "Example Value" in Swagger UI and more closely represents the swagger.json that is generated when the
[Required]
attribute is used.