Skip to content

Generating examples for abstract request type #236

Open
@michaeljon

Description

@michaeljon

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions