go-swagger: couldn't find a swagger spec
Problem statement
Getting couldn't find a swagger spec when doing swagger generate server -A todo-list -f ./swagger.yml.
I am following https://goswagger.io/tutorial/todo-list.html.
Steps to reproduce
- Go to https://goswagger.io/tutorial/todo-list.html and copy the complete spec to a file called
swagger.yml. - Run
swagger generate server -A todo-list -f ./swagger.ymlfrom the directory of the file.
Environment
swagger version: version: v0.27.0 go version: go1.15.8 OS: Amazon Linux 2
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 20 (8 by maintainers)
try with:
i think the init path is not right alias swagger=“docker run --rm -it --user $(id -u)😒(id -g) -e GOPATH=$HOME/go:/go -v $HOME:$HOME -w $(pwd) quay.io/goswagger/swagger” swagger version
swagger validate ./swagger/swagger.yml
open ./swagger/swagger.yml: no such file or directory
Hi @santosh,
I feel like this might have something to do with running
swaggerfrom the Docker container, as volumes need to be mounted for the files to be read in the container. Are you runningswaggerfrom Docker?You could try using the static binary https://goswagger.io/install.html#static-binary and see if it resolves the issue.
Same problem