Skip to content
This repository has been archived by the owner on Nov 2, 2021. It is now read-only.

worldline/yaml-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yaml-builder

Build Status

var builder =  require('yaml-builder');

var root = '/controller';
var template = { info: { version: '2.1', description: 'An amazing webapp'}, basePath: '/'};
var filter = /api/;

builder.configure(root, template, filter).compile(function(err, result){

    // Display the compiled swaggerize spec of your server
    console.log(result);
});

Installation

$ npm install --save-dev yaml-builder

Features

  • Find yaml files in tree directory structure
  • Inline the references and base paths to avoid collisions
  • Concatenate the files into a single one
  • Result overriding using a template
  • Filename filtering

API

configure([root], [template], [filter])

Configure the builder using the provided parameter:

  • root: the root folder to find yaml files, default is the current folder
  • template: an Object template to override attributes after the compilation process
  • filter: a filter to whitelist filenames, can be an array of exact filename or a RegExp

Return the builder object.

compile(callback)

Compile all the yaml files in a directory and its sub folders.

  • callback: a function(err, result) to callback when the compilation is over

About

Concatenate and inline reference of several yaml specs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published