1.0.0 • Published 3 years ago

fib-swagger v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

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);