Description
When creating Typescript code of the EVE Online API (https://esi.evetech.net/_latest/swagger.json) the generated code contains Set objects that are treated like Array objects. The code attempts to use Set<>.join() on Sets and tries to JSON.stringify(Set<>) them. Those are things that would only work on Arrays.
openapi-generator version
5.0.0 Beta
Command line used for generation
java -jar openapi-generator-cli-5.0.0-beta.jar generate -i https://esi.evetech.net/_latest/swagger.json -g typescript-axios -o api
Steps to reproduce
Execute the command and the resulting api.ts file will contain the broken code.
The code to look for is labels.join(COLLECTION_FORMATS.csv) and JSON.stringify(itemIds !== undefined ? itemIds : {}).
Suggest a fix/enhancement
I fixed these bugs by wrapping all Set objects into Array.from(Set<>).
For example:
Array.from(labels).join(COLLECTION_FORMATS.csv);
JSON.stringify(itemIds !== undefined ? Array.from(itemIds) : {})
The generated code should either use Arrays to begin with or (if the elements need to be unique) the Set needs to be turned back into an Array, before Array methods are called on it.
Description
When creating Typescript code of the EVE Online API (https://esi.evetech.net/_latest/swagger.json) the generated code contains Set objects that are treated like Array objects. The code attempts to use Set<>.join() on Sets and tries to JSON.stringify(Set<>) them. Those are things that would only work on Arrays.
openapi-generator version
5.0.0 Beta
Command line used for generation
java -jar openapi-generator-cli-5.0.0-beta.jar generate -i https://esi.evetech.net/_latest/swagger.json -g typescript-axios -o api
Steps to reproduce
Execute the command and the resulting api.ts file will contain the broken code.
The code to look for is
labels.join(COLLECTION_FORMATS.csv)andJSON.stringify(itemIds !== undefined ? itemIds : {}).Suggest a fix/enhancement
I fixed these bugs by wrapping all Set objects into Array.from(Set<>).
For example:
Array.from(labels).join(COLLECTION_FORMATS.csv);JSON.stringify(itemIds !== undefined ? Array.from(itemIds) : {})The generated code should either use Arrays to begin with or (if the elements need to be unique) the Set needs to be turned back into an Array, before Array methods are called on it.