swagger-api / swagger-api/swagger-ui

Feature: whole word filter option

Open
#6,648 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

cat: user experience type: feature
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q&A (please complete the following information)
  • OS: Windows 10
  • Browser: Firefox mozilla
  • Version: 82.0.3
  • Method of installation: npm swagger-ui-dist
  • Swagger-UI version: 3.36.2
  • Swagger/OpenAPI version: Swagger 2.9.2
Content & configuration

Using SwaggerUIBundle with filter, which is using tags. I've noticed if I have a tag that the value contains in other tags (case-sensitive), e.g. tag "street" and tag "streetNumber", when I use filter: "street", it will display all operations for "street" tag as well as "streetNumber" tag. I want to only display operations for "street" tag.

Currently my workaround is adding an extra space: "street " tag, but this is not ideal because that means everytime we update or add new tags, we need to check all other tags to make sure no tag value contains other tag value.

To reproduce...

Steps to reproduce the behavior:

  1. Go to Rest Controller, create 2 methods, and add below @ApiOperation with tags on method1 and method2:
for method1: @ApiOperation(value = "Display street", tags = "street")
for method2: @ApiOperation(value = "Display street number", tags = "streetNumber")
  1. Get swagger-ui-dist and add SwaggerUIBundle with filter: "street" to a html page
  2. Scroll down to where you add to display the operations
  3. You will see both method1 ("street" tag) and method2 ("streetNumber") tag are displayed
Expected behavior

My expectation is only operations for that exact tag value will be displayed, e.g. using the above example, only method1 should be displayed, not both method1 and method2.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in a page using SwaggerUIBundle with filter: "street" and the two tags from the report. Start by tracing the filter behavior in the Swagger UI frontend, then verify that an exact "street" match excludes "streetNumber" while matching operations remain visible.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.