1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/ajv-keywords/keywords/switch.js

39 lines
817 B
JavaScript
Raw Permalink Normal View History

2023-12-18 13:12:25 +08:00
'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;
};