API Code Generation

Post on 14-Jan-2015

3.284 views 6 download

Tags:

description

How to generate nodejs API consumer code from a Postman collections, with the help of the API Blueprint.

Transcript of API Code Generation

http://www.flickr.com/photos/iprozac/3609806359/

BarcelonaJS API Code Generation13 February 2014

Bruno Pedro

Bruno Pedro Web and Cloud Computing Technologist with over ten years’ experience. CTO of GetApp. Editor at APIUX.com.

http://brunopedro.com/

Summary

• Postman

• API Blueprint

• Code generation

• Questions

Postman• Powerful HTTP client

• Chrome application

• Advanced request builder

• History, Collections, Authentication, Documentation, …http://www.getpostman.com/

Postman

Postman

Postman

Postman

Postman

Postman

Postman

API Blueprint• Web API Language

• Markdown syntax

• Documentation + method description

• Powerful toolinghttp://apiblueprint.org/ !

API Blueprint• Testing with Dredd

• HTML docs with aglio

• Mock server with Contractor

API Blueprint

API Blueprint

Code Generation

Code Generation• collection

• markdown

• functions

Code Generation• collection

• markdown

• functionsnodeunit

postman2apiblueprint• Reads Postman collection JSON

• API endpoints

• HTTP methods (GET, POST, etc)

• Headers

• Parameters

• Converts to API Blueprint

postman2apiblueprint

apiblueprint2nodejs• Reads API Blueprint markdown

• Uses protagonist

• Converts markdown into JSON

• Generates nodejs code from JSON !

apiblueprint2nodejs

Future work

• Explore Postman Collection runner

• Richer output to API Blueprint

• Better code generation

• Reverse operation?

Questions?

Thank you!