swagger-converter icon indicating copy to clipboard operation
swagger-converter copied to clipboard

add preserveOrder option to avoid sorting keys

Open bobvanderlinden opened this issue 3 years ago • 1 comments

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.

bobvanderlinden avatar Jan 31 '22 09:01 bobvanderlinden

@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.

IvanGoncharov avatar Aug 04 '23 20:08 IvanGoncharov