swagger-api / swagger-api/swagger-codegen
[JavaScript] 2.4.9 removes @ and : characters from model field names
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Model fields which have names containing @ or : lose those characters (e.g. @id becomes id).
For an example of the regression in the generated code, see e.g.:
https://github.com/LD4P/sinopia_server/pull/117/files#diff-7a74aae6e7d7c150c0733f6507271ee8L51
the client code with the regression was generated using the following command:
java -jar swagger-codegen-cli-2.4.9.jar generate -i swagger.yaml -l javascript --additional-properties usePromises=true -o sinopia_client/
Swagger-codegen version
2.4.9 introduces a regression compared to 2.4.8 (the replaced code in above linked diff was generated by version 2.4.2, but i confirmed in https://github.com/LD4P/sinopia_server/pull/119 that 2.4.8 still produces the desired client output)
Swagger declaration file content or url
https://github.com/LD4P/sinopia_server/blob/master/swagger.yaml#L1152-L1156
Command line used for generation
java -jar swagger-codegen-cli-2.4.9.jar generate -i swagger.yaml -l javascript --additional-properties usePromises=true -o sinopia_client/
Steps to reproduce
use the aforementioned command line invocation on the linked swagger spec. note that the generated model code does not use the specified field names.
Related issues/PRs
Suggest a fix/enhancement
revert to the behavior seen in version 2.4.8 and prior
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
Run the documented Java command with the linked swagger.yaml and compare the generated JavaScript model fields between versions 2.4.8 and 2.4.9. Trace where the generator transforms field names, then verify that names containing @ and : are preserved as in the earlier output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100