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_ALPHABETICALLY
feature of Jackson) - Because this default configuration was not very user friendly for the root object (
OpenAPI
instance), I have registered aOpenAPISerializer
that 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