github.com/rzurga/go-swagger@v0.28.1-0.20211109195225-5d1f453ffa3a/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 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 12 The default behavior of flatten is to bundles remote refs into definitions and 13 normalize JSON pointers to definitions. 14 15 ### Usage 16 17 To flatten a specification: 18 19 ``` 20 Usage: 21 swagger [OPTIONS] flatten [flatten-OPTIONS] 22 23 expand the remote references in a spec and move inline schemas to definitions, after flattening there are no complex inlined anymore 24 25 Application Options: 26 -q, --quiet silence logs 27 --log-output=LOG-FILE redirect logs to file 28 29 Help Options: 30 -h, --help Show this help message 31 32 [flatten command options] 33 --compact applies to JSON formatted specs. When present, doesn't prettify the json 34 -o, --output= the file to write to 35 --format=[yaml|json] the format for the spec document (default: json) 36 --with-expand expands all $ref's in spec prior to generation (equivalent to --with-flatten=expand) 37 --with-flatten=[minimal|full|expand|verbose|noverbose|remove-unused] flattens all $ref's in spec prior to generation (default: minimal, verbose) 38 ```