github.com/go-swagger/go-swagger@v0.31.0/docs/generate-spec/_index.md (about) 1 --- 2 title: Generate spec 3 date: 2023-01-01T01:01:01-08:00 4 draft: true 5 bookCollapseSection: true 6 weight: 70 7 --- 8 # Generate a spec from source code 9 10 ``` 11 Usage: 12 swagger [OPTIONS] generate spec [spec-OPTIONS] 13 14 generate a swagger spec document from a go application 15 16 Application Options: 17 -q, --quiet silence logs 18 --log-output=LOG-FILE redirect logs to file 19 20 Help Options: 21 -h, --help Show this help message 22 23 [spec command options] 24 -w, --work-dir= the base path to use (default: .) 25 -t, --tags= build tags 26 -m, --scan-models includes models that were annotated with 'swagger:model' 27 --compact when present, doesn't prettify the json 28 -o, --output= the file to write to 29 -i, --input= an input swagger file with which to merge 30 -c, --include= include packages matching pattern 31 -x, --exclude= exclude packages matching pattern 32 --include-tag= include routes having specified tags (can be specified many times) 33 --exclude-tag= exclude routes having specified tags (can be specified many times) 34 --exclude-deps exclude all dependencies of project 35 ``` 36 37 See code annotation rules [here](../reference/annotations)