swagger-api / swagger-api/swagger-ui

Filter provided via configUrl does not work

Open
#7,714 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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: Microsoft Edge
  • Version: 96.0.1054.43
  • Method of installation: webjars/swagger-ui
  • Swagger-UI version: 4.1.3
  • Swagger/OpenAPI version: OpenAPI 3.0

Swagger-UI configuration options:

// Begin Swagger UI call region
const ui = SwaggerUIBundle({
  configUrl: "swagger-resources/configuration/ui",
  dom_id: '#swagger-ui',
  deepLinking: true,
  presets: [
    SwaggerUIBundle.presets.apis,
    SwaggerUIStandalonePreset
  ],
  plugins: [
    SwaggerUIBundle.plugins.DownloadUrl
  ],
  layout: "StandaloneLayout"
});
// End Swagger UI call region
Describe the bug you're encountering

Swagger-UI is able to load configuration from configUrl just fine, but seems to ignore the filter provided there. Below is an example of what is returned from my configUrl:

{
   "url":"/documentation/swagger.json",
   "deepLinking":true,
   "displayOperationId":false,
   "defaultModelsExpandDepth":-1,
   "defaultModelExpandDepth":10,
   "defaultModelRendering":"example",
   "displayRequestDuration":false,
   "docExpansion":"none",
   "filter":"test",
   "operationsSorter":"alpha",
   "showExtensions":false,
   "showCommonExtensions":false,
   "tagsSorter":"alpha",
   "tryItOutEnabled":true,
   "supportedSubmitMethods":[
      "get",
      "put",
      "post",
      "delete",
      "options",
      "head",
      "patch",
      "trace"
   ],
   "validatorUrl":"none",
   "withCredentials":false
}
To reproduce...

Steps to reproduce the behavior:

  1. provide configUrl
  2. let configUrl return a filter
  3. look for the filter to be applied or the filter "edit box" to appear
  4. it does not
Expected behavior

If I provide a filter directly in the Swagger-UI configuration (i.e. not via a configUrl) it works as expected.

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

No source file or test is named in the issue. Start by tracing how configUrl responses are loaded and merged with the Swagger UI configuration, then follow the filter option to the filter control. Done means a filter returned by configUrl is applied and the filter edit box appears, matching the behavior of a directly supplied filter.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
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.