JsonApiDotNetCore
JsonApiDotNetCore copied to clipboard
SwaggerUI shows the wrong type/discriminator in example for POST /people
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
- Steps to reproduce
- Clone the repo above and run the API.
- Open Swagger UI.
- Expand POST /people.
- 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).
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