RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.79k stars 1.29k forks source link

Swashbuckle.AspNetCore 5.1.0 do not allow null values #2732

Open philipp-ullmann opened 4 years ago

philipp-ullmann commented 4 years ago

See Gist.

With Swashbuckle.AspNetCore 5.1.0

The NSwagStudio Designer generates a Required = Newtonsoft.Json.Required.DisallowNull for the user address => Do not allows null values!

With Swashbuckle.AspNetCore 5.0.0

The NSwagStudio Designer generates a Required = Newtonsoft.Json.Required.Default for the user address => Allows null values => Expected behavior.

Sinhk commented 4 years ago

Try enabling UseAllOfToExtendReferenceSchemas in Swashbuckle. ref: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1488#issuecomment-597661605

RossJayJones commented 4 years ago

Try enabling UseAllOfToExtendReferenceSchemas in Swashbuckle. ref: domaindrivendev/Swashbuckle.AspNetCore#1488 (comment)

This worked for me. Thanks Sinhk.