swagger is great tool to describe your restful api in a clear and structured way. But as the spec gets longer and longer it could be sometimes useful to zoom out and look at your api from 10,000 feet.
pikturr is a very simple tool to transform your swagger api spec into a simple uml class diagram.
Because pikturr makes use of node-plantuml, which in turn makes use of...ehhh...plantuml, you have to fulfill some preconditions:
- you need to have the java executable in your path
- you must have graphviz installed
- the GRAPHVIZ_DOT environment variable must point the dot executable of graphviz
That's it for now.
Just get the code, look inside and you'll find out.
From the command line:
cd pikturr npm install // supply the url of the swagger as an argument node index.js 'http://petstore.swagger.io/v2/swagger.yaml'
Pikturr supports a few command line arguments:
node index.js [-o|--output outputFilePath] [-u|--uml] url-or-filePath
node index.js -o someDir/petstore-swagger.plantuml --uml http://petstore.swagger.io/v2/swagger.json
Download the spec at:
and output uml script in a file named:
node index.js test/my-app-swagger.yaml
Read spec from local file at:
and output png diagram in a file named:
--output flag is not passed, the output file will be created in the working directory,
and will be named from the last token in the input reference.
--uml flag is passed a plantuml script will be generated,
else a png diagram will be generated.
As a module:
const pikturr = require(pikturr) pikturr.generate('http://petstore.swagger.io/v2/swagger.yaml')
Running Unit Tests
To run the test suite issue the following command:
Feel free to extend the tests suite.
- re-structure code to meet nodejs project structure standards
- add some tests
- provide a rest api
- provide a simple web frontend
- provide some configurable options