Skip to content

Swagger-Models: Make definitions use a sorted Map instead of HashMap #2400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
domdorn opened this issue Aug 25, 2017 · 2 comments
Open

Swagger-Models: Make definitions use a sorted Map instead of HashMap #2400

domdorn opened this issue Aug 25, 2017 · 2 comments

Comments

@domdorn
Copy link

domdorn commented Aug 25, 2017

io.swagger.models.Swagger#definitions is using a HashMap as its implementation. This leads to unstable results when serializing the spec to json.

I'd like to change the implementation to use a TreeMap<String, Model> instead. This makes sure, that the map is always sorted the same way.

I'm happy to provide a pull request.

@ChristianLutz
Copy link

Currently this PR has been applied to oas3. It uses an LinkedHashMap instead of a TreeMap. I would also prefer the later.

@hiddewie
Copy link
Contributor

hiddewie commented Jul 1, 2020

The maven plugin from OpenAPI tools has to sort the output manually now. This is a problem for projects where the OpenAPI specification is committed. Also see openapi-tools/swagger-maven-plugin#49.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants