Created by: jmini
Until https://github.com/swagger-api/swagger-core/issues/2828 is solved, I propose to solve this in our project.
Instead of using Yaml.mapper().writeValueAsString(openAPI) directly, I have introduced a small utility: SerializerUtils that call the same method, but with additional configuration:
- The properties are now sorted alphabetically (
MapperFeature.SORT_PROPERTIES_ALPHABETICALLYfeature of Jackson) - Because this default configuration was not very user friendly for the root object (
OpenAPIinstance), I have registered aOpenAPISerializerthat order the elements of the root object.
To test it, I have added some Unit Test.
I also have updated the java-inflector sample with bin/java-inflector-petstore-server.sh