github.com/kaisawind/go-swagger@v0.19.0/docs/generate/model.md (about) 1 # Generate models from a swagger spec 2 3 4 ``` 5 Usage: 6 swagger [OPTIONS] generate model [model-OPTIONS] 7 8 generate one or more models from the swagger spec 9 10 Application Options: 11 -q, --quiet silence logs 12 -o, --output=LOG-FILE redirect logs to file 13 14 Help Options: 15 -h, --help Show this help message 16 17 [model command options] 18 -f, --spec= the spec file to use (default swagger.{json,yml,yaml}) 19 -a, --api-package= the package to save the operations (default: operations) 20 -m, --model-package= the package to save the models (default: models) 21 -s, --server-package= the package to save the server specific code (default: restapi) 22 -c, --client-package= the package to save the client specific code (default: client) 23 -t, --target= the base directory for generating the files (default: ./) 24 -T, --template-dir= alternative template override directory 25 -C, --config-file= configuration file to use for overriding template options 26 -r, --copyright-file= copyright file used to add copyright header 27 --existing-models= use pre-generated models e.g. github.com/foobar/model 28 --additional-initialism= consecutive capitals that should be considered intialisms 29 --with-expand expands all $ref's in spec prior to generation (shorthand to --with-flatten=expand) 30 --with-flatten=[minimal|full|expand|verbose|noverbose|remove-unused] flattens all $ref's in spec prior to generation (default: minimal, verbose) 31 -n, --name= the model to generate 32 --skip-struct when present will not generate the model struct 33 --dump-data when present dumps the json for the template generator instead of generating files 34 --skip-validation skips validation of spec prior to generation 35 ``` 36 37 Schema generation rules are detailed [here](../use/model.md).