swagger-api / swagger-api/swagger-ui
SyntaxHighlight always enabled with latest swaggerapi/swagger-ui
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
- Browser: chrome
- Version: 104.0.xxxxxxx
- Method of installation: war
- Swagger-UI version: 4.15.5 and latest
- Swagger/OpenAPI version: NA
Describe the bug you're encountering
I am running swaggerapi/swagger-ui using docker in my local and syntaxHighlighting is not working as expected with syntaxHighlight=false query-parameter. I tried various approaches to disable syntaxHighlighting.
After each approach, I accessed this url http://localhost:8080/?syntaxHighlight=falseand expected syntaxHighlighting to be disabled for all the request & response body. But all are enabled by default.
Approach 1:
- use docker-compose.yaml with QUERY_CONFIG_ENABLED: "true"
- spin up the container using the command
docker compose up.
docker-compose.yaml
version: '3'
services:
swagger-ui:
ports:
- 8080:8080
image: swaggerapi/swagger-ui:v4.15.5
restart: always
environment:
QUERY_CONFIG_ENABLED: "true"
URLS: "[
{ url: 'https://petstore.swagger.io/v2/swagger.json', name: 'Petstore' }
]"
Approach 2:
- use docker file
- build own image using the command
docker build -t <image-name> . - run the docker image
docker run -p 8080 <image-name>
Dockerfile
FROM swaggerapi/swagger-ui
ENV QUERY_CONFIG_ENABLED="true"
ENV URLS="[ { url: 'https://petstore.swagger.io/v2/swagger.json', name: 'Petstore' } ]"
Approach 3: (same as approach #2 with swagger-config.json)
Followed steps mentioned in Approach2, but query configuration itself is not enabled.
Dockerfile
FROM swaggerapi/swagger-ui
`ENV CONFIG_URL="file:///D:/Argon/Repo/Skyline/SwaggerAPI/swagger-config.json"`
ENV URLS="[ { url: 'https://petstore.swagger.io/v2/swagger.json', name: 'Petstore' } ]"
swagger-config.json
{
"queryConfigEnabled": true,
"syntaxHighlight": false,
"syntaxHighlight.activate": false,
"displayOperationId": true
}
Please let me know whether I am missing something here.
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
Reproduce the issue with Swagger UI v4.15.5 or latest using the documented Docker environment variables, the ?syntaxHighlight=false URL, and the provided swagger-config.json. Start by tracing how query configuration and syntaxHighlight are applied, then verify that request and response bodies render without syntax highlighting when the setting is false.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, javascript
- Domain
- devops, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100