swagger-api / swagger-api/swagger-codegen
JavaScript: Errornous generation of param types in JSDoc for enum and array typed parameters
Open
Nobody has claimed this yet.
Client: JavaScript/Node.js
Feature: Documentation
help wanted
Issue: Bug
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
This is generated
/**
* Массовые операции над объектами клиентов
* @param {Array.<module:model/Integer>} objectsList Список идентификаторов объектов для массовой операции
* @param {module:model/String} operation Тип операции
* data is of type: {Array.<module:model/BatchResults>}
*/
But should be something like this:
/**
* Массовые операции над объектами клиентов
* @param {Number[]} objectsList Список идентификаторов объектов для массовой операции
* @param {String} operation Тип операции
* data is of type: {Array.<module:model/BatchResults>}
*/
Source spec for this part is:
/batch/clients/{operation}:
put:
summary: "Массовые операции над объектами клиентов"
operationId: "batch_clients"
parameters:
- name: "objects_list"
description: "Список идентификаторов объектов для массовой операции"
required: true
schema:
type: "array"
items:
type: "integer"
format: "int64"
description: "Идентификатор объекта"
in: "body"
- name: "operation"
description: "Тип операции"
required: true
type: "string"
enum:
- 'reload'
- 'reboot'
- 'shutdown'
in: "path"
responses:
200:
description: ""
schema:
type: "array"
items:
$ref: BatchResults
Swagger-codegen version
Latest master.
Swagger declaration file content or url
https://gist.github.com/arikon/2f078fcf15aae07984c7e1d35def90bf
Command line used for generation
SWAGGER_JSON=swagger-new.json
SWAGGER_OUTPUT=sandbox-json-api
export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
export PATH=${JAVA_HOME}/bin:$PATH
java -jar swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
-i ${SWAGGER_JSON} \
-l javascript \
-o ${SWAGGER_OUTPUT} \
--additional-properties usePromises=true
Steps to reproduce
Related issues
Suggest a Fix
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
Reproduce the JavaScript generation using the linked Swagger declaration, the shown command, and the batch endpoint schema. Compare the generated JSDoc for the array and enum parameters with the expected Number[] and String forms; done means the incorrect param types are corrected without regressing the response type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100