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

Opens browser but can't connect #4

Open
aka-mj opened this issue Mar 10, 2021 · 9 comments
Open

Opens browser but can't connect #4

aka-mj opened this issue Mar 10, 2021 · 9 comments

Comments

@aka-mj
Copy link

aka-mj commented Mar 10, 2021

With my openapi.yaml file open I press <leader>e and get the browser to launch but it is unable to connect to localhost:8017. Docker is installed, the zsh functions were copied.

zsh 5.8
nvim 0.5.0-dev+919-g08ec36efa
docker 20.10.5, build 55c4c88

Any ideas to troubleshoot this issue?

@xavierchow
Copy link
Owner

make sure port 8017 is availabe to listen on, of course you can change it here.

Could you check if

  • docker is running(docker ps)
  • is port 8017 available(blocked by firewall/proxy etc.)

@aka-mj
Copy link
Author

aka-mj commented Mar 16, 2021

Docker is running and port 8017 is available

>> docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
>> lsof -i -P -n | grep LISTEN
reqrep  2630068 mj    3u  IPv4 8254863      0t0  TCP 127.0.0.1:40899 (LISTEN)

@xavierchow
Copy link
Owner

hmm, there is a directory called vim-swagger-preview under the tmp you can check if there is any error in the validate.log.
I also noticed the container swagger-ui-preview didn't seem to be running from your output of docker ps. @dangerousHobo

 /tmp/vim-swagger-preview  ls
README.md    openapi.json validate.log

 /tmp/vim-swagger-preview  cat validate.log

 /tmp/vim-swagger-preview  docker ps
CONTAINER ID   IMAGE                       COMMAND                  CREATED          STATUS                PORTS                                                                                                                                                                   NAMES
0cffe5ad6c85   swaggerapi/swagger-ui       "/docker-entrypoint.…"   37 seconds ago   Up 36 seconds         80/tcp, 0.0.0.0:8017->8080/tcp                                                                                                                                          swagger-ui-preview

if there is an openapi.json(generated by the vim plugin), or maybe you can check if you can set up the container separately from the command line?
docker run --name swagger-ui-preview -d -p 8017:8080 -e SWAGGER_JSON=/docs/openapi.json -v /tmp:/docs swaggerapi/swagger-ui

@aka-mj
Copy link
Author

aka-mj commented Jul 13, 2021

@xavierchow - Original issue with the docker image was not downloaded. I now have it downloaded and the browser connects to localhost:8017 and opens a webpage but gets an error "Failed to load API definition'. There is nothing under the /tmp/vim-swagger-preview directory.

image

@xavierchow
Copy link
Owner

There is nothing under the /tmp/vim-swagger-preview directory.

There should be something wrong, did you start the docker via the command I list above? if so the swagger.json just didn't get transformed from the original yaml file.

Please try to run leader + e from your vim as described here.

@aka-mj
Copy link
Author

aka-mj commented Jul 14, 2021

The docker container is running:

~> docker ps
CONTAINER ID   IMAGE                   COMMAND                  CREATED       STATUS       PORTS                                               NAMES
94a2075583fe   swaggerapi/swagger-ui   "/docker-entrypoint.…"   3 hours ago   Up 3 hours   80/tcp, 0.0.0.0:8017->8080/tcp, :::8017->8080/tcp   swagger-ui-preview

Running leader + e does open the browser page shown above.
The zsh .zshenv is also installed as described.

@xavierchow
Copy link
Owner

@dangerousHobo can you try to run the following command from your shell? I'd suspect something wrong with the docker download here.

swagger_yaml2json  your-swagger.yaml

please paste the outcome of above command and also check if there is any files created under the /tmp/vim-swagger-preview, thanks.

@WendelHime
Copy link

Hi, I've the same issue reported, my log was:

Validating spec (/docs/my-openapi.yaml)
[main] INFO  o.o.codegen.utils.ModelUtils - [deprecated] inheritance without use of 'discriminator.propertyName' has been deprecated in the 5.x release. Composed schema name: null. Title: null
[main] INFO  o.o.codegen.utils.ModelUtils - [deprecated] inheritance without use of 'discriminator.propertyName' has been deprecated in the 5.x release. Composed schema name: null. Title: null
No validation issues detected.

After looking at this issue, I've changed all references from openapitools/openapi-generator-cli on my .zshenv to: openapitools/openapi-generator-cli:v4.1.3 and it's working!

@dbaber
Copy link

dbaber commented Aug 27, 2022

I have this same issue and I see WendelHime worked around it with a different version of openapitools/openapi-generator-cli but shouldn't this thing check the return code env variable $? instead of looking to see how many log lines are there and assuming that the validation failed? I might have to patch/change this shell script funciton because warnings shouldn't cause the validation to actually fail.

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

4 participants