fib-swagger
v1.0.0
Published
Swagger to fibjs Codegen
Downloads
3
Readme
Swagger to fibjs Codegen
This package generates a fibjs class from a swagger specification file. The code is generated using mustache templates and is quality checked by jshint and beautified by js-beautify.
The generator is based on superagent and can be used for fibjs.
This fork was made to simplify some parts, add some more features, and tailor it more to specific use cases.
Installation
fibjs --install fib-swagger
cli
fibjs node_modules/fib-swagger/lib/cli -c Test gen test.json test.js
Example Code
var fs = require("fs");
var CodeGen = require("fib-swagger").CodeGen;
var file = "swagger/spec.json";
var swagger = JSON.parse(fs.readFileSync(file, "UTF-8"));
var tsSourceCode = CodeGen.getFibjsCode({
className: "Test",
swagger: swagger
});
console.log(tsSourceCode);