swagger-api / swagger-api/swagger-codegen
Javascript client sdk does not show values for enums
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
when I export a javascript client sdk, it doesn't show the enum values. For example, the sexenum shows the following and doesn't include the values for the index 0 and 1 which is "description": "0 = Female, 1 = Male". How do I get the enum values to show along with the indexes?
/**
- Enum class SexEnum.
- @enum {Number}
- @readonly
/
var exports = {
/* - value: 0
- @const
*/
_0: 0,
/**
- value: 1
- @const
*/
_1: 1
};
Swagger-codegen version
I am using SwaggerHub with swagger 2.0
Swagger declaration file content or url
{
"swagger": "2.0",
"info": {
"title": "Test API",
"version": "v1"
},
"paths": {
},
"definitions": {
"sexEnum": {
"format": "int32",
"description": "0 = Female, 1 = Male",
"enum": [
0,
1
],
"type": "integer"
}
}
}
Command line used for generation
javascript
Steps to reproduce
generate javascript client sdk from the json pasted above.
Related issues/PRs
Suggest a fix/enhancement
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the JavaScript client generator with the supplied Swagger 2.0 definition and inspect the generated SexEnum output and the templates responsible for enum comments. Done means the generated enum shows the documented Female and Male values alongside indexes 0 and 1; the issue names no specific files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, openapi
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100