Name: grunt-swagger-tools
Owner: Topcoder
Description: Grunt integration for Swagger Tools (https://github.com/apigee-127/swagger-tools)
Created: 2014-10-03 13:29:37.0
Updated: 2016-07-18 14:59:41.0
Pushed: 2015-01-29 18:50:15.0
Homepage: null
Size: 180
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This is an initial public release.
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 .
install bower
npm install -g bower
install grunt-cli
npm install -g grunt-cli
install grunt
npm install grunt
install dependencies
npm install
test with npm
npm test
test with grunt
grunt test
test with npm
npm run-script demo
test with grunt
grunt demo
test with npm
npm run-script nolog
test with grunt
grunt nolog
jshint version 2.5.5 is failing with this error
ERR! cb() never called!
ERR! not ok code 0
install jshint@2.5.0
nt@2.5.0 node_modules/jshint
p-json-comments@0.1.3
ole-browserify@0.1.6
@0.1.2
rscore@1.4.4
ljs@0.1.4
match@0.4.0 (sigmund@1.0.0, lru-cache@2.5.0)
parser2@3.3.0 (domelementtype@1.1.1, domutils@1.1.6, domhandler@2.1.0, readable-stream@1.0.33-1)
0.4.5 (glob@4.0.6)
there is a demo file Gruntfile.js update it to suite your needs.
swagger_testfiles = {
or 1.2 Swagger Specification file
ion_1 : [
'./examples/1.2/api/api-doc.json',
'./examples/1.2/api/weather.json'
or 2.0 Swagger Specification file
ion_2 : [
'./examples/2.0/api/swagger.json',
''
AML version of a 2.0 Swagger Specification file
ion_3 : [
'./examples/2.0/api/swagger.yaml',
''
on top of Gruntfile.js, add the following
re;
swagger;
swagger_file = __dirname + '/PATH/TO/YOUR/SWAGGER.yaml';
at the bottom of Gruntfile.js, add something like
hould be >= 0.10.0
t.loadNpmTasks('grunt-contrib-jshint');
aml tester for ./PATH/TO/YOUR/SWAGGER.yaml
t.task.registerTask('yamlTest', 'Test Swagger spec file', function() {
oad the grunt-swagger-tools >= 0.1.1
{
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'});
tch (e) { re = e.message; }
f has error, result in console
ole.log('YAML 2.0 RESULT: ' + re + '\n');
The current version of this software is intended to be use only on serenity project.