How to Export Swagger documentation in PDF and XML files

user3711357 picture user3711357 · Nov 8, 2017 · Viewed 13.7k times · Source

I have generated swagger document for web api using below link: http://wmpratt.com/swagger-and-asp-net-web-api-part-1/

Need to export document in PDF or XML file to send across handy.

Its .NET WEB API.

How to export swagger documentation ?

Thanks

Answer

Gabriel Arellano picture Gabriel Arellano · Dec 15, 2018

You can use Swagger2Markup and AsciiDoc docker images:

docker run --rm -v $(pwd):/opt swagger2markup/swagger2markup convert -i "https://api.example.org/api/doc/swagger.json" -f /opt/swagger-doc

Creates asciidoc file named 'swagger-doc.adoc' in current folder.

docker run -it -v $(pwd):/documents/ asciidoctor/docker-asciidoctor asciidoctor-pdf swagger-doc.adoc

Creates a PDF file named 'swagger-doc.pdf' in current folder.