-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JavaScript] Client produces a wrong object for a string enum type that is used with $ref #1429
Comments
@wing328 |
@jfiala could you have a look at this? |
I just posted a $50 bounty on this at: |
@wing328 please claim the bounty at: Thanks! |
Description
Quoting the initial post in swagger-api/swagger-codegen#4819.
I got something like { '0': 'f', '1': 'i', '2': 's', '3': 'h' } for an enum type. It should be "fish".
openapi-generator version
openapi-generator-cli-3.3.3-20181113.090410-41.jar
OpenAPI declaration file content or url
Command line used for generation
$ java -jar modules/swagger-codegen-cli/target/openapi-generator-cli-3.3.3-20181113.090410-41.jar
generate -i test.yaml -l javascript -o output
Steps to reproduce
A reproduction is available at:
https://github.com/advance512/swagger-codegen-issue-4819/tree/openapi-generator-cli-3.3.3-20181113.090410-41.jar
Related issues/PRs
A lot more information available here:
swagger-api/swagger-codegen#4819
Suggest a fix/enhancement
I can fix the issue by modifying
convertToType
method defined inApiClient.mustache
like this:I think
ApiClient.convertToType()
can always calltype.constructFromObject()
for types that haveconstructFromObject
method. But I'm not sure about its side effects.The text was updated successfully, but these errors were encountered: