Closed ghost closed 4 years ago
5.0.0-rc4 generates schemas according to the behavior of the Newtonsoft serializer whereas the official 5.0.0 bases schemas on the behavior of the System.Text.Json (STJ) serializer.
Which serializer are you using? If it’s STJ, have you confirmed it behaves the way you’d expect. That is, independently of Swashbuckle does it spit out the interface inherited properties when you call the op (e.g. via curl, postman etc)?
If the answer to the above is YES, then this is indeed a bug in swagger as it should reflect the serializer behavior exactly
If you’re using Newtonsoft, then you need to explicitly tell Swashbuckle to honor its behavior as described here https://github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/master/README.md#systemtextjson-stj-vs-newtonsoft
Yes, I'm still using Newtonsoft indeed - and this fixed my issue. Thank you very much!
Since 5.0.0-rc5 (rc4 is the latest version with a different behavior) inherited properties are not generated in the model any more:
I've taken the default DotNetCore 3.1 WebAPI example and inherited with an extra property "ASD" from an interface. With 5.0.0-rc4 the model has the property, with later versions it is missing. Is this an intended behavior? And if: how to enable inheritance?
Here are the generated models:
5.0.0-rc4: