github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/docs/usage/flatten.md (about)

     1  # Flatten a swagger spec
     2  
     3  The toolkit has a command to flatten a swagger specification.
     4  
     5  Flattening a specification bundles all remote `$ref` in the main spec document.
     6  
     7  Depending on the selected flattening options, additional preprocessing may take place:
     8  
     9  - full flattening: replacing all inline complex constructs by a named entry in #/definitions
    10  - expand: replace all $ref's in the document by their expanded content
    11  - remove-unused: remove unused definitions from the spec
    12  - keep-names: does not attempt to jsonify names in definitions and keep them as-is. Generally not suited to use with "full".
    13  
    14  The default behavior of flatten is to bundles remote refs into definitions and
    15  normalize JSON pointers to definitions.
    16  
    17  ### Usage
    18  
    19  To flatten a specification:
    20  
    21  ```
    22  Usage:
    23    swagger [OPTIONS] flatten [flatten-OPTIONS]
    24  
    25  expand the remote references in a spec and move inline schemas to definitions, after flattening there are no complex inlined anymore
    26  
    27  Application Options:
    28    -q, --quiet                                                                                silence logs
    29        --log-output=LOG-FILE                                                                  redirect logs to file
    30  
    31  Help Options:
    32    -h, --help                                                                                 Show this help message
    33  
    34  [flatten command options]
    35            --compact                                                                          applies to JSON formatted specs. When present, doesn't prettify the json
    36        -o, --output=                                                                          the file to write to
    37            --format=[yaml|json]                                                               the format for the spec document (default: json)
    38            --with-expand                                                                      expands all $ref's in spec prior to generation (shorthand to --with-flatten=expand)
    39            --with-flatten=[minimal|full|expand|verbose|noverbose|remove-unused|keep-names]    flattens all $ref's in spec prior to generation (default: minimal, verbose)
    40  ```