Skip to content

NikolaySl/swagger-js-codegen

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Swagger to JS Codegen Build Status NPM version Code Climate

This package generates a nodejs or angularjs class from a swagger specification file. The code is generated using mustache templates and is quality checked by jshint and beautified by js-beautify.

##Installation

npm install swagger-js-codegen

##Example

var fs = require('fs');
var CodeGen = require('swagger-js-codegen').CodeGen;

var file = 'swagger/spec.json';
var swagger = JSON.parse(fs.readFileSync(file, 'UTF-8'));
var nodejsSourceCode = CodeGen.getNodeCode({ className: 'Test', swagger: swagger }); 
var angularjsSourceCode = CodeGen.getAngularCode({ className: 'Test', swagger: swagger }); 
console.log(nodejsSourceCode);
console.log(angularjsSourceCode);

Grunt task

There is a grunt task that enables you to integrate the code generation in your development pipeline. This is extremely convenient if your application is using APIs which are documented/specified in the swagger format.

##Who is using it? 28.io is using this project to generate their nodejs and angularjs language bindings.

About

A Swagger Codegen for nodejs & angularjs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%