New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gulp-loopback-swagger-validator

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-loopback-swagger-validator

A gulp module to validate loopback code against swagger spec

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

gulp-loopback-swagger-validator


NPM

NPM

Build status codecov

Gulp plugin that parses Swagger specifications in YAML format, validates against the official [Swagger 2.0 schema][swagger2spec], and compares against loopback application

Usage

Pre-requisite changes in Loopback configuration:

  1. Create a folder called 'spec' and store your YAML specification file
  2. Make changes to component-config.json Modify the configuration of the loopback-explorer component as:
{
  "loopback-component-explorer": {
    "mountPath": "/explorer",
    "consumes": "${consumes}",
    "produces" : "${produces}",
    "apiInfo": "${apiInfo}"
  }
}
  1. Make changes to config.json At the end of config.json file add the follow configuration:
{
      "apiInfo": {
        "title": Title of the your API application as written in YAML
      },
      "consumes":Array of mime types that your application consumes (as written in YAML),
      "produces":Array of mime types that your application produces (as written in YAML)
}
  1. Add gulpfile task

var gulp = require('gulp');
var lbValidator = require('gulp-loopback-swagger-validator');
var swagger = require('gulp-swagger');
var path     = require('path');

gulp.task('swagger-validate', function() {
  gulp.src('./json/*.json')
  .pipe(swagger('schema.json'))
  .pipe(lbValidator({'appPath':path.resolve('./project/server/server')}))
  .on('error',function(e){
      console.log(e.message);
  });
});



gulp.task('default', ['swagger-validate']);
  1. Preview in the console

Preview

See Also

FAQs

Package last updated on 01 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc