mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-23 00:45:16 +00:00
19 lines
474 B
JavaScript
19 lines
474 B
JavaScript
|
'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;
|
||
|
};
|