Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxHighlight always enabled with latest swaggerapi/swagger-ui #8304

Open
PriyadarshiniGopalS opened this issue Nov 23, 2022 · 2 comments
Open

Comments

@PriyadarshiniGopalS
Copy link

PriyadarshiniGopalS commented Nov 23, 2022

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:

  1. use docker-compose.yaml with QUERY_CONFIG_ENABLED: "true"
  2. 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:

  1. use docker file
  2. build own image using the command docker build -t <image-name> .
  3. 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.

@PriyadarshiniGopalS PriyadarshiniGopalS changed the title SyntaxHighlight not working with latest swagger-ui SyntaxHighlight not working with latest swaggerapi/swagger-ui Nov 23, 2022
@char0n
Copy link
Member

char0n commented Nov 24, 2022

Hi @PriyadarshiniGopalS,

I not sure I understand. The title of the issue suggest that the syntax highlighting is not working.

After spinning up the container, I tried accessing the url http://localhost:8080/?syntaxHighlight=false , but still syntaxHighlight was enabled.

Then this sentence suggest that you want to disable the highlighting but it's always enabled.

Can you please maybe elaborate?

@PriyadarshiniGopalS PriyadarshiniGopalS changed the title SyntaxHighlight not working with latest swaggerapi/swagger-ui SyntaxHighlight always enabled with latest swaggerapi/swagger-ui Nov 24, 2022
@PriyadarshiniGopalS
Copy link
Author

Hi @PriyadarshiniGopalS,

I not sure I understand. The title of the issue suggest that the syntax highlighting is not working.

After spinning up the container, I tried accessing the url http://localhost:8080/?syntaxHighlight=false , but still syntaxHighlight was enabled.

Then this sentence suggest that you want to disable the highlighting but it's always enabled.

Can you please maybe elaborate?

Hi @char0n ,
I am seeing syntaxHighlight always enabled behavior and trying to disable that, but I was not successful.

I updated the title and description for better clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants