You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
parttimejob/node_modules/ajv-keywords/keywords/allRequired.js

19 lines
474 B

4 weeks ago
'use strict';
module.exports = function defFunc(ajv) {
defFunc.definition = {
type: 'object',
macro: function (schema, parentSchema) {
if (!schema) return true;
var properties = Object.keys(parentSchema.properties);
if (properties.length == 0) return true;
return {required: properties};
},
metaSchema: {type: 'boolean'},
dependencies: ['properties']
};
ajv.addKeyword('allRequired', defFunc.definition);
return ajv;
};