swagger-api / swagger-api/swagger-ui
Filter provided via configUrl does not work
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:
- provide
configUrl - let
configUrlreturn afilter - look for the filter to be applied or the filter "edit box" to appear
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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