JsonApiDotNetCore icon indicating copy to clipboard operation
JsonApiDotNetCore copied to clipboard

SwaggerUI shows the wrong type/discriminator in example for POST /people

Open fdlane opened this issue 2 months ago • 10 comments

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

fdlane avatar Oct 15 '25 20:10 fdlane