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

swagger-ui operations-sorter function not working #15642

Closed
fxrobin opened this issue Mar 11, 2021 · 5 comments · Fixed by #15769
Closed

swagger-ui operations-sorter function not working #15642

fxrobin opened this issue Mar 11, 2021 · 5 comments · Fixed by #15769
Labels
area/swagger-ui kind/bug Something isn't working
Milestone

Comments

@fxrobin
Copy link

fxrobin commented Mar 11, 2021

Describe the bug
the javascript function defined in the property quarkus.swagger-ui.operations-sorter is not working.

Expected behavior
When defined, the JavaScript function should be called.

Actual behavior
Only "alpha" and "method" parameters are working.

Configuration

quarkus.swagger-ui.operations-sorter=function (a, b) { var order = { "get": "0", "post": "1", "put": "2", "delete": "3" }; return order[a.method].localeCompare(order[b.method]); }

Environment (please complete the following information):

  • Quarkus version : 1.10.3 to 1.12.1 (and maybe before)

Possible cause

Single quotes are generated around the the property "operationsSorter" :

window.onload = function() {
                const ui = SwaggerUIBundle({
                url: '/v1/openapi',
                    dom_id: '#swagger-ui',
                    deepLinking: true,
                    operationsSorter: 'function (a, b) { var order = { "get": "0", "post": "1", "put": "2", "delete": "3" }; return order[a.method].localeCompare(order[b.method]); }',
                    validatorUrl: 'none',
                    presets: [SwaggerUIBundle.presets.apis,SwaggerUIStandalonePreset],
                    plugins: [SwaggerUIBundle.plugins.DownloadUrl],
                    layout: 'StandaloneLayout',
                })

See https://stackoverflow.com/questions/24951268/sort-api-methods-in-swagger-ui

@fxrobin fxrobin added the kind/bug Something isn't working label Mar 11, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Mar 11, 2021

/cc @phillip-kruger

@phillip-kruger
Copy link
Member

Thanks, I'll fix this a.s.a.p

@phillip-kruger
Copy link
Member

This will be fixed here: smallrye/smallrye-open-api#742

Once SmallRye is released and pulled into Quarkus, I'll close this issue.

@fxrobin
Copy link
Author

fxrobin commented Mar 17, 2021

This will be fixed here: smallrye/smallrye-open-api#742

Once SmallRye is released and pulled into Quarkus, I'll close this issue.

Thanx, that was a fast fix!

@JBartscher
Copy link

JBartscher commented May 24, 2024

@phillip-kruger How could I escape this if I use an application.yaml instead of an application.properties?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/swagger-ui kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants