Skip to content

Query parameter filter=true instead of just showing the empty filter field is filtering the endpoints by the value "true" #6276

Closed
@gjorgievskivlatko

Description

@gjorgievskivlatko

Q&A (please complete the following information)

  • OS: macOS
  • Browser: chrome

Content & configuration

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

Swagger-UI configuration options:

SwaggerUI({
  filter: true
})
?filter=true

Describe the bug you're encountering

When the query parameter filter=true is used, then the filter field should be shown with all of the endpoints.
But in src/core/components/operations.jsx the result of the code:

let filter = layoutSelectors.currentFilter()

is that the filter field will contain a string with value "true".
Since this value is a string and not a boolean, the following condition:

if (filter !== true)

is true (it should be false), and the filtering is applied.

To reproduce...

Steps to reproduce the behavior:

  1. Go to https://petstore.swagger.io/?filter=true

Expected behavior

The swagger-ui with a filter field and all of the endpoint is shown.

Actual behavior

The swagger-ui with a filter field and no endpoints is shown. The endpoints are filtered by the text "true".

Screenshots

Screen Shot 2020-07-30 at 19 05 18
Screen Shot 2020-07-30 at 19 07 15

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions