swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
Using aspnetcore code gen on the Swagger API specified below assigns wrong value to exampleJson in DefaultApi.cs. This is cut down as far as I can to show just the problem. This is a problem because I was planning to use this value in testing / demo code. (Yes, it can be hand-edited but that defeats the purpose of code gen and the real version is much larger.)
Here is the Example Value / Model output, which is correct:
Description
Using aspnetcore code gen on the Swagger API specified below assigns wrong value to exampleJson in DefaultApi.cs. This is cut down as far as I can to show just the problem. This is a problem because I was planning to use this value in testing / demo code. (Yes, it can be hand-edited but that defeats the purpose of code gen and the real version is much larger.)
Here is the Example Value / Model output, which is correct:
{ "aa_list": [ { "list": [ { "aa_position": 0 }, { "aa_position": 1 } ] } ] }
Here is the corresponding JSON example in the aspnetcore code:
The aspnetcore code has the "list" member and its entire contents duplicated.
Swagger-codegen version
SwaggerHub (app.swaggerhub.com)
Swagger declaration file content or url
https://app.swaggerhub.com/apis/JohnBoncek/ArrayProblemRepro/1
Command line used for generation
No command line.
Steps to reproduce
In SwaggerHub at the above URL, choose Export > Server Stub > aspnetcore and examine the generated code in src\IO.Swagger\Controllers\DefaultApi.cs.
Related issues/PRs
None known.
Suggest a fix/enhancement
Generate the correct code.