swagger-api / swagger-api/swagger-codegen
swagger-codegen is messing up the order of the generated json
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Generating a json file using swagger-codegen messes up the order and does not follow the order as in yaml
Swagger-codegen version
2.2.3
Swagger declaration file content or url
Command line used for generation
swagger-codegen generate -i lotr.yaml -l swagger
Steps to reproduce
install swagger-codegen using homebrew
generate a json file from yaml file
the generated json file order of keys does not follow that in the yaml.
Doing a file> download json from http://editor.swagger.io/ preserves the ordering. But running the codegen command locally (on a mac) doesn't.
Related issues/PRs
Suggest a fix/enhancement
Either follow the YAML order or give an option that allows following the YAML order. JSON generated from swagger-codegen locally and from the online editor should not have any diff.
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 reproducing the issue with lotr.yaml and swagger-codegen generate -i lotr.yaml -l swagger, then compare the generated JSON with the YAML and with the Swagger Editor download. Done means the local generated JSON preserves the YAML key order or clearly supports the requested ordering option without differing from the editor output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- json, yaml
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100