Skip to content

SwaggerUI shows the wrong type/discriminator for POST /people #1812

@fdlane

Description

@fdlane

SUMMARY

When generating OpenAPI with JADNC, the Swagger UI request example for creating a Person shows the JSON:API type (and nested discriminators) as "bars" instead of "people". This happens in the POST /people request body example. See attached screenshot.

DETAILS

Example Repo: https://github.com/fdlane/ExampleJsonApi

  1. Steps to reproduce
  2. Clone the repo above and run the API.
  3. Open Swagger UI.
  4. Expand POST /people.
  5. Inspect the generated example request body.

Expected
data.type (and any discriminator fields) should reflect the concrete resource being created, i.e. "people" for Person.

Actual
data.type appears as "bars" in the example, and the nested discriminator properties inside attributes and relationships also show "bars" (see attached image).

Image

VERSIONS USED

  • JsonApiDotNetCore version: 5.8.1 and 5.8.1-preview.4
  • ASP.NET Core version: net9
  • Entity Framework Core version:
  • Database provider: sqllite

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions