Hey guys, thank you for a great plugin:)
I've been having some trouble working with the validator, I only get appropriate errors on the docs page, and the page has to be refreshed in order to check for errors which I find tiresome.
So to fix this I've created a small gulp script which watches for changes in my files. Upon a detected change, the script validates the swagger doc and generate a new doc that I save to another repository to which my clients are subscribed too.
I thought you might find it useful, so here it is:)
var gulp = require('gulp');
var swagger = require('gulp-swagger');
const shell = require('gulp-shell')
var api_path = './src/controller/api/**/*.php'
var definitions_path = './src/model/swagger/**/*.php';
var swagger_json_path = './tmp/cache/cakephp_swagger_api.json';
gulp.task('validate', function() {
gulp.src(swagger_json_path)
.pipe(swagger('athgene_internal_api.json'))
.pipe(gulp.dest('PATH_TO_REPO'));
});
gulp.task('compile_swagger', shell.task([
'./bin/cake swagger makedocs localhost:8765'
]));
gulp.task('default', ['validate']);
// Rerun the task when a file changes
gulp.task('watch', function () {
gulp.watch(api_path, ['compile_swagger']);
gulp.watch(definitions_path, ['compile_swagger']);
gulp.watch(swagger_json_path, ['validate']);
});
Hey guys, thank you for a great plugin:) I've been having some trouble working with the validator, I only get appropriate errors on the docs page, and the page has to be refreshed in order to check for errors which I find tiresome.
So to fix this I've created a small gulp script which watches for changes in my files. Upon a detected change, the script validates the swagger doc and generate a new doc that I save to another repository to which my clients are subscribed too.
I thought you might find it useful, so here it is:)