Giter VIP home page Giter VIP logo

pikturr's Introduction

pikturr

Why?

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.

What?

I'm new to the javascript and node party. So please be patient and do not expect the ultra efficient javascript ninja code. I find a visual representation of an api spec useful and I want to learn js and node...so I wrote this tool. It's as simple as that.

How?

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

E.g.

  • node index.js -o someDir/petstore-swagger.plantuml --uml http://petstore.swagger.io/v2/swagger.json
    Download the spec at: http://petstore.swagger.io/v2/swagger.json
    and output uml script in a file named: someDir/petstore-swagger.plantuml

  • node index.js test/my-app-swagger.yaml
    Read spec from local file at: test/my-app-swagger.yaml
    and output png diagram in a file named: swagger.png

If the -o or --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.

If the -u or --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')

class diagram for the pet store api

Running Unit Tests

To run the test suite issue the following command:
npm test

Feel free to extend the tests suite.

What next?

  • 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

pikturr's People

Contributors

adrolet avatar antonyh avatar buchenberg avatar eschaarschmidt avatar nrekretep avatar sebastian-schmid avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.