How to always generate yaml/json with the same element order?
rodrigo-rufino opened this issue · comments
Rodrigo Rufino Ribeiro commented
I need to generate the yaml
file for my application, but I need it to be the same every time I generate it in order to compare it the current generated yaml
with the current state of my API.
But I'm having trouble making this comparison deterministic.
Is there any way I can make swagger to:
- Generate the
yaml
file with the same element order? - Generate the same
yaml
file if no changes to the endpoint codes are made?
I know springdoc has some configurations to do that, but my project does not use spring.
Notes
- I'm using
io.swagger.core.v3:swagger-jaxrs2:2.0.1
.
Andreas Höhmann commented
Just a hint .. the swagger maven plugin supports "sortOutput" and "prettyPrint".
- io.swagger.v3.oas.integration.SwaggerConfiguration.setSortOutput(Boolean)
- io.swagger.v3.oas.integration.GenericOpenApiContext.init()
Rodrigo Rufino Ribeiro commented
It was noy available on the version I'm using. I sorted it manually.