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

Docker : Disable validator

Open shrenikjain38 opened this issue 9 years ago • 6 comments

I tried to run swagger ui docker container via: docker run -d -p 80:80 -e VALIDATOR_URL=null swaggerapi/swagger-ui

But this is not able to disable validation. The url points to: http://localhost/None/debug?url=http://petstore.swagger.io/v2/swagger.json

What is the correct way to disable validation for docker image.

shrenikjain38 avatar Jun 05 '17 21:06 shrenikjain38

Hi,

I am having the same problem. We need to use this docker image to document some APIs that are only accessible from our local network. I know I could run the validator locally, but overall that seems like an overkilling. How do I disable the validator altogether?

disimone avatar Dec 29 '17 12:12 disimone

Hello, What is the version of Swagger-ui you are using?

shrenikjain38 avatar Dec 29 '17 12:12 shrenikjain38

Hallo,

thanks a lot for your quick reply. I am using latest. In the meantime I investigated further, and I think I am suffering from a different problem. Firefox reports that CORS policy forbids access to yml file served by another local server.

So I thought I could pass the api specification as a file through the command line. Instead of using -e API_URL=http://localhost:8000/api.yml, I tried -e SWAGGER_JSON=/path/to/api.yml

The api.yml file is in the folder from where I do docker run. I got the name of the environment variable from docker-run.sh, but somehow this does not appear to be running properly, since I keep getting the petstore api.

Any help is much appreciated.

Andrea.

disimone avatar Dec 29 '17 13:12 disimone

Hey,

How are you generating the json spec? There should be a way around for using direct schema. The docker container has env variables as: BASE_URL= SWAGGER_JSON=swagger.json FOLDER=swagger-ui-2.2.10 HOSTNAME=dc3e590f7d60 SHLVL=1 HOME=/root PORT=80 OAUTH_REALM=None OAUTH_CLIENT_ID=None OAUTH_CLIENT_SECRET=None OAUTH_APP_NAME=None VERSION=v2.2.10 OAUTH_ADDITIONAL_PARAMS=None TERM=xterm PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin API_KEY=None PWD=/ API_URL=None I am looking for a documentation so as to direcly use a json file.

shrenikjain38 avatar Dec 29 '17 13:12 shrenikjain38

Hello, Try to use this: docker run -p 80:8080 -v /home/shrenik/bar:/foo -e SWAGGER_JSON=/foo/swagger.json swaggerapi/swagger-ui

shrenikjain38 avatar Dec 29 '17 14:12 shrenikjain38

YES, that solved it. Sorry I was not thinking that I need to mount the folder to make it visible by the image.

Thanks a lot for your help,

Andrea.

disimone avatar Dec 29 '17 14:12 disimone