Skip to content

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

Closed as not planned
@scottohara

Description

@scottohara

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions