Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output properties order are not consistent. #146

Open
jpuerto opened this issue Nov 16, 2023 · 0 comments
Open

Output properties order are not consistent. #146

jpuerto opened this issue Nov 16, 2023 · 0 comments

Comments

@jpuerto
Copy link

jpuerto commented Nov 16, 2023

I have found an issue while creating an OpenAPI definition with this library.

I define my operation responses as:

               responses {
                    response("204") {
                        description = "..."
                    }
                    responses.putAll(standardResponses)
                }

Where standardResponses is a collection of common responses. The responses method is a builder for ApiResponses class from swagger that implement LinkedHashMap so the order should be preserved.

Everything should work but the output does not keep the same order I used while inserting the responses, the cuprit seems to be the JSONObject used for formatting:

internal fun validatedJson(api: OpenAPI): JSONObject {
val json = Json.mapper().writeValueAsString(api)
OpenAPIV3Parser().read(toFile(json).absolutePath)
return JSONObject(json)
}

Looks like there is a debate about this problem at the moment, see issue

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

No branches or pull requests

1 participant