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