-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generating examples for abstract request type #236
Comments
Hello I've never used IMultipleExamplesProvider myself. According to my changelog, they were contributed by @tomkludy and @pozy. Sorry for the delay in responding - I thought I would have time to have a play myself and see if I could figure it out, but I haven't had a chance to play yet, and I can't make any promises. |
Hi, |
@pozy @mattfrear Look at the schema - it has the discriminator in the schema It seems its related to the oneOf is at the root of the actual request like If the oneOf is nested with another object it does it correctly. Examples basically just returning the types of OneOf like |
I closed this issue because of the lack of reply from OP. I'm not convinced that @svha1977's issue is the same issue which OP has. I'm not gonna be able to fix either issue, so someone else will have to provide a PR. |
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 theIMultipleExamplesProvider
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.The text was updated successfully, but these errors were encountered: