Skip to content

Conversation

bobvanderlinden
Copy link
Contributor

@bobvanderlinden bobvanderlinden commented Jan 31, 2022

Currently swagger-converter sorts all keys to make sure the output is
deterministic. In some cases, the order of properties matters.

For instance a model that understandably mentions id and name first. For
code generation and example generation it helps to keep these properties
first.

preserveOrder: true may help in these cases.

The current setup for tests was not really made for potentially non-deterministic outputs (which preserveOrder could result in). I left out the test for now, let me know what the best course of action is for this, or whether it should be left ignored.

Currently swagger-converter sorts all keys to make sure the output is
deterministic. In some cases, the order of properties matters.

For instance a model that understandably mentions id and name first. For
code generation and example generation it helps to keep these properties
first.

`preserveOrder: true` may help in these cases.
@IvanGoncharov
Copy link
Collaborator

@bobvanderlinden Sorry for the super late response.
But can we just add code that always puts id and name first?
I think it universally useful feature so why hide it behind the flag?
More properties can be added in the future.

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

Successfully merging this pull request may close these issues.

2 participants