Package Exports
- swagger-js-codegen
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (swagger-js-codegen) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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.getNodeCode({ className: 'Test', swagger: swagger });
console.log(angularjsSourceCode);
Grunt task
There 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.