swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

How to stop exploring json code in browser

Open Dhina-test opened this issue 3 years ago • 3 comments

Hi , I am trying to run swagger docker container with custom json file with help of https://swagger.io/docs/open-source-tools/swagger-ui/usage/installation/ by docker run -p 80:8080 -e SWAGGER_JSON=/foo/swagger.json -v /bar:/foo swaggerapi/swagger-ui

Here container works and site gets up .but my json file appears in swagger site like

image

when i click custom.json it's displaying my json code .

image

So how to stop display json code ? Can you help

Dhina-test avatar Jun 28 '23 10:06 Dhina-test

How to hide custom.json file here

Dhina-test avatar Jun 28 '23 13:06 Dhina-test

@Dhina-test to hide the custom.json file you need to update the docker command:- docker run -p 80:8080 -e SWAGGER_JSON=/foo/swagger.json -e CONFIG_URL=/foo/config.json -v /bar:/foo swaggerapi/swagger-ui and also update ypur config.json file ;- { "displayOperationId": false, "displayRequestDuration": false, "docExpansion": "none", "defaultModelExpandDepth": 0, "defaultModelsExpandDepth": 0 }

Aditay2002 avatar Jul 05 '23 08:07 Aditay2002

Hi @Aditay2002 I placed my custom.json and config.json file under bar folder image

In config.json file i placed the code which you provided

image

And then here is my docker run command for swagger api

docker run -p 80:8080 -e SWAGGER_JSON=/foo/custom.json -e CONFIG_URL=/foo/config.json -v /home/dhina/swagger/bar:/foo swaggerapi/swagger-ui

and now swagger site is below image

Can you help

Dhina-test avatar Jul 05 '23 08:07 Dhina-test