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

Regression between v5.15.2 and v5.16.0 when the configuration contains filter: undefined #9873

Closed
scottohara opened this issue Apr 25, 2024 · 1 comment

Comments

@scottohara
Copy link
Contributor

scottohara commented Apr 25, 2024

Q&A (please complete the following information)

  • OS: macOS
  • Browser: chrome
  • Version: 123
  • Method of installation: npm
  • Swagger-UI version: 5.15.2, 5.16.0
  • Swagger/OpenAPI version: Swagger 2.0

Content & configuration

Example Swagger/OpenAPI definition:
https://petstore.swagger.io/v2/swagger.json

Swagger-UI configuration options:

SwaggerUI({
  url: "https://petstore.swagger.io/v2/swagger.json,
  filter: undefined
})

Describe the bug you're encountering

As per the screenshots below, the same OAS 2.0 definition renders correctly in v5.15.2, but fails to render in v5.16.0 (and later versions, all the way up to the current latest v5.17.1).

The only change between the screenshots was updating the SwaggerUI version.

It appears that v5.16.0 treats filter: undefined differently, by forcing it to be the string value "undefined" (which results in the "No operations defined in spec!" message, as nothing matches that filter.

In v5.15.2 and earlier, an undefined filter was treated as an empty string.

To reproduce...

  1. In v5.15.2, configure SwaggerUI as shown above and render.
  2. Update to v5.16.0, and note the difference as per the screenshots.

Expected behavior

Setting filter to undefined should be treated as though no filter is set (empty string), as it was in previous versions.

Screenshots

Note the main visual differences are:

  1. In v5.15.2, the filter input is blank and shows the placeholder text "Filter by tag", but in v5.16.0 it is populated with "undefined"
  2. In v5.15.2, the tags & operations render as expected, but in in v5.16.0 the "No operations defined in spec!" message appears in it's place (but note that the models still render OK)

v5.15.2

v5_15_2

v5.16.0

v5_16_0

@scottohara scottohara changed the title Possible regression between v5.15.2 and v5.16.0 ("No operations defined in spec!") Regression between v5.15.2 and v5.16.0 when the configuration contains filter: undefined Apr 25, 2024
@scottohara
Copy link
Contributor Author

scottohara commented Apr 25, 2024

Presumably related to #9829

On review, it would seem that setting filter: undefined is not allowed (should be either Boolean or String value), and the fact that it previously worked was accidental rather than intentional.

Happy to close this, and I'll change my usage to cast undefined to false.

@scottohara scottohara closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2024
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