swagger-api / swagger-api/swagger-codegen

[SWAGGER] No longer generates JSON that is alphabetically sorted from YAML

Open
#4,903 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug Swagger-Parser
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

We used to get alphabetical ordering for our endpoints before the 2.2.2 Release we took.

Swagger-codegen version

v2.2.2

Swagger declaration file content or url

https://wind.ibmcloud.com/api/v2/swagger/swagger.yaml
Was generating:
https://wind.ibmcloud.com/api/v2/swagger/swagger.json
But now generates the json with the endpoints appearing as they do in the yaml. We would prefer not to manually sort these.

Command line used for generation
docker run -it \
-v $WORKINGDIR/container:/swagger-api/out \
-v $WORKINGDIR/container:/swagger-api/yaml \
jimschubert/swagger-codegen-cli \
generate \
-i /swagger-api/yaml/swagger.yaml \
-l swagger \
-o /swagger-api/out
Steps to reproduce

Running the docker command above using the yaml found at the uri provided.

Related issues

https://github.com/jimschubert/swagger-codegen-cli.docker/issues/2#issuecomment-283811706

Suggest a Fix

Only thing I saw related to ordering:
https://github.com/swagger-api/swagger-codegen/pull/4191 and https://github.com/swagger-api/swagger-codegen/pull/4191/commits/c386da6ded5df709d714f538656a44ceb39b8bad

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided Docker command with the Swagger YAML at the linked URL and compare its JSON endpoint order with the YAML. Trace the Swagger generation path responsible for YAML-to-JSON conversion; done means the generated JSON endpoints are alphabetically sorted without manual reordering.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, json, yaml
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.