RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.69k stars 1.24k forks source link

NWAGStudio - Duplicate class created when oneOf is defined in the model #4693

Open TaniaDianne opened 8 months ago

TaniaDianne commented 8 months ago

Hello,

We are having code gen issues when using oneOf in a recent schema and finding duplicate classes are being generated by nSwagstudio when the oneOf is part of the schema instead of the query.

Example: Here the query references the schema

image

and the schema is defined using oneof:

image

We were able to resolve this by moving the mapping to the query but I wanted to check if both scenarios were valid and if it is a codeGen issue rather than a schema issue

image

But we should be able to use the original definition as it is correct per openAPI specifications.