问题
I've developed a pretty extense API, and I have it on Postman, which works pretty nice. Now I have to generate an html doc to keep it versioned inside /docs along with my sources.
Is there a tool or a way to achieve this? I really don't want to write all this documentation. Sharing the postman collection is not an option.
回答1:
I recently had the same problem and I did not find anything. So I created a simple tool to do it. It is a very basic javascript application written with react.js. At the moment it is very basic, but I'm working on it, so any feature request is welcome.
You can use it for free at: http://www.vernizzis.it/docman/
Plus you can get the code and modify it at: https://github.com/davidevernizzi/docman
Any comment is more than welcome.
UPDATE1: looking around I also found this project: https://github.com/JakeWorrell/docodile and this feature request: https://github.com/a85/POSTMan-Chrome-Extension/issues/204
UPDATE2: the feature request (see UPDATE1) has been closed and the possibility of creating documentation has been added to Postman cloud. Here is the feature request closing comment:
This is available as part of Postman Cloud: http://blog.getpostman.com/2015/12/10/introducing-postman-cloud/. Cloud hosts, updates and maintains documentation for everyone. I'd suggest http://docman.launchrock.com/ and https://github.com/JakeWorrell/docodile for generating one-time documentation from Collections.
回答2:
I know this is an old question and you probably found a solution by now, but still you might be interested by Postmanerator: https://github.com/aubm/postmanerator
Basically, this is how you use it from the command line:
postmanerator -collection=/path/to/your/collection.js -output=/path/to/doc.html
To get it installed, download the latest Github release. You need to pick the appropriate binary depending on your system. Then place it somewhere in your PATH.
See the documentation in the README if you want additionnal information. From there you will find recommandations for taking full advandage of the tool, or change the look of your documentation by using custom themes.
The Github presentation also provides a reference to a generated example documentation.
You will also discover how you can take advantage of a CI platform like Travis, to automate the generation and the publication of your documentation with Postmanerator.
As this is an open source project I'm currently working on, feel free to submit issues on Github if you have any ideas that can make it better.
回答3:
You can install Newman using command "npm install -g Newman" and then run the command "newman run CollectionName.json -e envVar.json" from the location where you have saved your collection, where CollectionName.json is your collection name and enVar.json is the set of environment variables. This will generate html report in the same folder. One prerequisite is to have node js installed.
回答4:
You can also try the free tool that I made. It provides the documentation in .txt but you can convert it to pdf using your browser.
https://postmandoc.herokuapp.com/
来源:https://stackoverflow.com/questions/29238120/creating-html-doc-from-postman-collection