RicoSuter / NSwag

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

Classes with GetEnumerator method is generated as array #4751

Open anderssontobias opened 6 months ago

anderssontobias commented 6 months ago

I just updated one of our API projects from .NET 6 to .NET 8 and while doing so we also updated Nswag to the lastest version. After this a number of generic Hateoas classes that we have changed from objects to arrays in the swagger definition.
The problem with this is that the original class contained additional properties that we want to keep in the swagger definition. If i remove the GetEnumerator methods from the classes and generate a new swagger definition i get the old behaviour. With the old behaviour the object generated is "ResourceCollectionOf{GenericType}Resource" but with the new behaviour instead i get an "array of {GenericType}Resource".

Is there any way to get the old behaviour without having to remove the GetEnumerator methods from all our classes?