I have a controller that take an abstract base class as the input. I'm using JsonDerivedType to tell System.Text.Json how to turn the inbound data into a concrete type. I'd like to provide examples for the various types but am running into an issue where the IMultipleExamplesProvider has to take the abstract type and then when the example is serialized the type information is lost from the more concrete type. This loses the $type discriminator in the examples. I really don't want to write these as XML examples - the magic strings are going to get way out of date.
Is there something I'm missing? I've tried type-specific examples but can only use on SwaggerRequestExample per method and the last one wins.
I have a controller that take an abstract base class as the input. I'm using
JsonDerivedTypeto tell System.Text.Json how to turn the inbound data into a concrete type. I'd like to provide examples for the various types but am running into an issue where theIMultipleExamplesProviderhas to take the abstract type and then when the example is serialized the type information is lost from the more concrete type. This loses the$typediscriminator in the examples. I really don't want to write these as XML examples - the magic strings are going to get way out of date.Is there something I'm missing? I've tried type-specific examples but can only use on
SwaggerRequestExampleper method and the last one wins.