Skip to content

Commit

Permalink
Release new minor version (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
cococonscious authored Jun 13, 2024
2 parents a1e1c4c + bca572e commit ea41f84
Show file tree
Hide file tree
Showing 5 changed files with 13,448 additions and 1,452 deletions.
21 changes: 20 additions & 1 deletion bin/apikana
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,27 @@ function generate() {
var plop = nodePlop(__dirname + '/../src/plopfile_start.js', { defaults });
var generator = plop.getGenerator('start');
const model = Object.assign({}, packageJSON, { api: openapi });

// Workaround for validatorjs to fix wildcard on `paths`
const paths = [];
Object.values(model.api.paths).forEach(path => paths.push(path));
model.api.paths = paths;

if (defaults.validation) {
const Validator = require('validatorjs')
const validator = new Validator(model.api, defaults.validation);
if(!validator.check()) {
log(colors.bold(colors.red('Validation of the OpenAPI definition has failed with ' + validator.errorCount + ' errors')));
Object.entries(validator.errors.all()).forEach(errorEntry => {
const [errorField, error] = errorEntry;
log(colors.bold(colors.red(errorField + ": " + error)))
});
process.exit(1);
}
}

generator.runActions(model).then(_ => {
require('../src/generate').generate(path.resolve(source), params.target());
require('../src/generate').generate(defaults, path.resolve(source), params.target());
});
}

Expand Down
Loading

0 comments on commit ea41f84

Please sign in to comment.