Skip to content

Instantly share code, notes, and snippets.

@DaneWeber
Last active October 30, 2018 20:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DaneWeber/c24cc3abd360cc3621b58574fbc6125f to your computer and use it in GitHub Desktop.
Save DaneWeber/c24cc3abd360cc3621b58574fbc6125f to your computer and use it in GitHub Desktop.
Makefile command to use docker images for swagger2markdown piped to asciidoctor
# swagger2markup output fed to asciidoctor-pdf - all via published docker images
# The following is a Makefile command in the root of a web service repo with the following assumptions:
# ./swagger/v1/swagger.json is the swagger definition (created by rswag in my case)
# ./_docs/ is where we want the PDF and intermediate ADOC to live
# The ADOC file is pretty useful, but if you just want the PDF, it's a byproduct you might want to clean up
api_pdf:
docker run --rm -v $(shell pwd):/opt swagger2markup/swagger2markup convert -i /opt/swagger/v1/swagger.json -f /opt/_docs/api-definition
docker run --rm -v $(shell pwd)/_docs:/documents/ asciidoctor/docker-asciidoctor asciidoctor-pdf api-definition.adoc
# To add configuration options for swagger2markup, create a config.properties file and specify with
# -c /opt/config.properties
# asciidoctor-pdf supports pretty extensive styling:
# https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc#applying-your-theme
@DaneWeber
Copy link
Author

Above is for a Unix environment. The same commands should work on Windows except for the $(shell pwd) bits, which are just about getting the full path to the current directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment