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

Something happened to the spec options #2000

Open
emosbaugh opened this issue Jul 5, 2019 · 2 comments
Open

Something happened to the spec options #2000

emosbaugh opened this issue Jul 5, 2019 · 2 comments
Labels
generate spec Related to spec generation from code question

Comments

@emosbaugh
Copy link

emosbaugh commented Jul 5, 2019

Problem statement

Swagger generate spec no longer works

$ swagger generate spec -b ./api/v1/ -o ./spec/v1/api.json
unknown flag `b'
$ go run swagger.go generate spec -h
Usage:
  swagger [OPTIONS] generate spec [spec-OPTIONS]

generate a swagger spec document from a go application

Application Options:
  -q, --quiet                  silence logs
      --log-output=LOG-FILE    redirect logs to file

Help Options:
  -h, --help                   Show this help message

[spec command options]
      -w, --work-dir=          the base path to use (default: .)
      -t, --tags=              build tags
      -m, --scan-models        includes models that were annotated with 'swagger:model'
          --compact            when present, doesn't prettify the json
      -o, --output=            the file to write to
      -i, --input=             the file to use as input
      -c, --include=           include packages matching pattern
      -x, --exclude=           exclude packages matching pattern
          --include-tag=       include routes having specified tags (can be specified many times)
          --exclude-tag=       exclude routes having specified tags (can be specified many times)

Steps to reproduce

$ go get -u github.com/go-swagger/go-swagger/cmd/swagger
$ swagger generate spec -b ./api/v1/ -o ./spec/v1/api.json
unknown flag `b'

Environment

swagger version: master
go version: 1.12.5
OS: linux

@casualjim
Copy link
Member

casualjim commented Jul 5, 2019

On master there is a new version of the scanner, which works a little bit differently but supports go modules and running outside of the gopath.

You can just omit -b now or provide it as positional arguments

these should be equivalent:

# most explicit
swagger generate spec -w ./api/v1 -o ./spec/v1/api.json ./...
# set the working directory
swagger generate spec -w ./api/v1 -o ./spec/v1/api.json
# equivalent of original command
swagger generate spec -o ./spec/v1/api.json ./api/v1/...

@emosbaugh
Copy link
Author

thanks

@fredbi fredbi added generate spec Related to spec generation from code question labels Jul 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generate spec Related to spec generation from code question
Projects
None yet
Development

No branches or pull requests

3 participants