mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 09:25:15 +00:00
39 lines
817 B
JavaScript
39 lines
817 B
JavaScript
|
'use strict';
|
||
|
|
||
|
var util = require('./_util');
|
||
|
|
||
|
module.exports = function defFunc(ajv) {
|
||
|
if (ajv.RULES.keywords.switch && ajv.RULES.keywords.if) return;
|
||
|
|
||
|
var metaSchemaRef = util.metaSchemaRef(ajv);
|
||
|
|
||
|
defFunc.definition = {
|
||
|
inline: require('./dotjs/switch'),
|
||
|
statements: true,
|
||
|
errors: 'full',
|
||
|
metaSchema: {
|
||
|
type: 'array',
|
||
|
items: {
|
||
|
required: [ 'then' ],
|
||
|
properties: {
|
||
|
'if': metaSchemaRef,
|
||
|
'then': {
|
||
|
anyOf: [
|
||
|
{ type: 'boolean' },
|
||
|
metaSchemaRef
|
||
|
]
|
||
|
},
|
||
|
'continue': { type: 'boolean' }
|
||
|
},
|
||
|
additionalProperties: false,
|
||
|
dependencies: {
|
||
|
'continue': [ 'if' ]
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
ajv.addKeyword('switch', defFunc.definition);
|
||
|
return ajv;
|
||
|
};
|