readmeio/swagger-inline

Add an --out option. And by default, console.log out the swagger file.

gkoberger opened this issue ยท 6 comments

Problem: I keep using swagger.json as my base, and I keep mistakenly overwriting it.

Solution: By default, let's make it just console.log out the Swagger result. Let's also add an --out option for choosing a place to write it to. If the --out value ends with .json, write it as JSON. If it's .yaml, write it as YAML.

Bonus Points: Maybe we can also add a --format option that lets you choose the format (so you can use .yaml as the --base, but output it as JSON). It'll also let you be specific if your --out file doesn't have a proper extension.

Format option already exists ๐Ÿ‘

image

Out option shouldn't be hard. And can also override the format option with any filetype used for --out.

Going to make it so that when you include --out it logs the feedback (eg. "Why do you have 15 swagger.json files?"). If you don't include that, the only thing logged is the result. Then you can pipe the results to other crazy unix commands :).

That sounds great!

Added!

image

Changes:

  • --out is now the final say on the output filetype
  • Including --out for the Cli or the module will cause the file to be written to the provided path.
  • Including --out will cause the Cli to log progress messages and such.
  • Omitting --out will disable all logging. The output will either be the final swagger or an error message if things really blow up.

(And I was overly excited and made all the changes on master! New branch for future features ๐Ÿ‘ )

Re-open if it gives you problems, otherwise closing this downnn ๐Ÿ‘‡

This looks great! :)