npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grunt-swagger-tools

v0.1.4

Published

Serenity Grunt module for Swagger validation

Downloads

30

Readme

topcoder Serenity Grunt module for Swagger validation

Initial version

This is an initial public release.

What is grunt-swagger-tools?

This software is a NodeJS application.

It is intended to be use for rapid testing and validation of Swagger Specification file in version 1.2 or version 2.0 document format.

The validation process is simplified with the use of this Swagger tool .

It is design to be run with npm using npm run-script {XXXX}; where XXXX is one of demo, test, nolog.

This initial release also supports running grunt-swagger-tools with grunt .

How to install

npm install -g bower

npm install -g grunt-cli

npm install grunt

  • install dependencies

npm install

How to test

  • test with npm

npm test

  • test with grunt

grunt test

Test with JSON logs

  • test with npm

npm run-script demo

  • test with grunt

grunt demo

Test without JSON logs

  • test with npm

npm run-script nolog

  • test with grunt

grunt nolog

NOTES

  • jshint version 2.5.5 is failing with this error
 npm ERR! cb() never called!
 npm ERR! not ok code 0

 npm install [email protected]

 [email protected] node_modules/jshint
 [email protected]
 [email protected]
 [email protected]
 [email protected]
 [email protected]
 [email protected] ([email protected], [email protected])
 [email protected] ([email protected], [email protected], [email protected], [email protected])
 [email protected] ([email protected])

How to use it to test your Swagger document?

  • there is a demo file Gruntfile.js update it to suite your needs.
var swagger_testfiles = {

   // for 1.2 Swagger Specification file
   version_1 : [
       './examples/1.2/api/api-doc.json',
       './examples/1.2/api/weather.json'
   ],

   // for 2.0 Swagger Specification file
   version_2 : [
       './examples/2.0/api/swagger.json',
       ''
   ],

   // YAML version of a 2.0 Swagger Specification file
   version_3 : [
       './examples/2.0/api/swagger.yaml',
       ''
  ]
};

   ```

### Here is a sample grunt task name 'yamlTest'

* on top of Gruntfile.js, add the following

var re; var swagger; var swagger_file = __dirname + '/PATH/TO/YOUR/SWAGGER.yaml';

```
  • at the bottom of Gruntfile.js, add something like
 // should be >= 0.10.0
 grunt.loadNpmTasks('grunt-contrib-jshint');

 // yaml tester for ./PATH/TO/YOUR/SWAGGER.yaml
 grunt.task.registerTask('yamlTest', 'Test Swagger spec file', function() {

   // load the grunt-swagger-tools >= 0.1.1
   try {
   	swagger = require('grunt-swagger-tools')();

   	// Setup 2.0 Swagger spec compliant using YAML format
   	swagger.validator.set('fileext', '.yaml');

   	// No logging of loaded YAML data
   	swagger.validator.set('log', 'false');

   	// Run the validator on file at swagger_file
   	console.log('YAML Test for file: ' + swagger_file + '\n');
   	re = swagger.validator.Validate(swagger_file, undefined, {version: '2.0'});

   } catch (e) { re = e.message; }

   // If has error, result in console
   console.log('YAML 2.0 RESULT: ' + re + '\n');
 });

   ```

### License

[MIT](https://github.com/topcoderinc/grunt-swagger-tools/blob/master/LICENSE)

### Current status

The current version of this software is intended to be use only on [serenity](https://github.com/topcoderinc/serenity-core) project.