[go: up one dir, main page]

Swagger UI: passing `displayOperationId=true` in URL not displaying operation IDs anymore

Summary

Since upgrading Swagger UI, passing ?displayOperationId=true doesn't seem to work anymore.

It looks like this is a bug in the Swagger UI dependency, according to their docs it is possible to pass displayOperationId in the URL query string.

We could temporarily patch this in our codebase by reading displayOperationId from the query string and pass it as a config option. Alternatively, we can enable displayOperationIdby default.

Steps to reproduce

  1. Create an OpenAPI file
  2. View the file
  3. Add ?displayOperationId=true in the URL query string

Example Project

https://gitlab.com/jerasmus/jerasmus-test-project/-/blob/master/swagger.json?displayOperationId=true

What is the current bug behavior?

Passing ?displayOperationId=true in the URL does not display the operation names.

Screenshot_2022-04-01_at_09.31.33

What is the expected correct behavior?

Passing ?displayOperationId=true in the URL should display the operation names.

Screenshot_2022-04-01_at_09.32.02

Possible fixes

  1. We could temporarily patch this in our codebase by reading displayOperationId from the query string and pass it as a config option.
  2. Alternatively, we can enable displayOperationIdby default.
  3. Or we can fix the bug in Swagger-ui by contributing upstream.
Edited by Jacques Erasmus