github.com/jamescostian/go-swagger@v0.30.4-0.20221130163922-68364d6b567b/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        --log-output=LOG-FILE                                                       redirect logs to file
    13  
    14  Help Options:
    15    -h, --help                                                                      Show this help message
    16  
    17  [model command options]
    18        -n, --name=                                                                 the model to generate, repeat for multiple (defaults to all). Same as --models
    19            --accept-definitions-only                                               accepts a partial swagger spec wih only the definitions key
    20  
    21      Options common to all code generation commands:
    22        -f, --spec=                                                                 the spec file to use (default swagger.{json,yml,yaml})
    23        -t, --target=                                                               the base directory for generating the files (default: ./)
    24            --template=[stratoscale]                                                load contributed templates
    25        -T, --template-dir=                                                         alternative template override directory
    26        -C, --config-file=                                                          configuration file to use for overriding template options
    27        -r, --copyright-file=                                                       copyright file used to add copyright header
    28            --additional-initialism=                                                consecutive capitals that should be considered intialisms
    29            --allow-template-override                                               allows overriding protected templates
    30            --skip-validation                                                       skips validation of spec prior to generation
    31            --dump-data                                                             when present dumps the json for the template generator instead of generating files
    32            --strict-responders                                                     Use strict type for the handler return value
    33            --with-expand                                                           expands all $ref's in spec prior to generation (shorthand to --with-flatten=expand)
    34            --with-flatten=[minimal|full|expand|verbose|noverbose|remove-unused]    flattens all $ref's in spec prior to generation (default: minimal, verbose)
    35  
    36      Options for model generation:
    37        -m, --model-package=                                                        the package to save the models (default: models)
    38        -M, --model=                                                                specify a model to include in generation, repeat for multiple (defaults to all)
    39            --existing-models=                                                      use pre-generated models e.g. github.com/foobar/model
    40            --strict-additional-properties                                          disallow extra properties when additionalProperties is set to false
    41            --keep-spec-order                                                       keep schema properties order identical to spec file
    42            --struct-tags=                                                          the struct tags to generate, repeat for multiple (defaults to json)
    43  ```
    44  
    45  Schema generation rules are detailed [here](../use/model.md).