supamend
Version:
Pluggable DevSecOps Security Scanner with 10+ scanners and multiple reporting channels
33 lines • 1.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfigValidator = void 0;
class ConfigValidator {
static validate(config) {
const errors = [];
if (!config.scanners || !Array.isArray(config.scanners)) {
errors.push('scanners must be an array');
}
else {
config.scanners.forEach((scanner, index) => {
if (!scanner.name)
errors.push(`scanners[${index}].name is required`);
if (typeof scanner.enabled !== 'boolean')
errors.push(`scanners[${index}].enabled must be boolean`);
});
}
if (!config.reporters || !Array.isArray(config.reporters)) {
errors.push('reporters must be an array');
}
else {
config.reporters.forEach((reporter, index) => {
if (!reporter.name)
errors.push(`reporters[${index}].name is required`);
if (typeof reporter.enabled !== 'boolean')
errors.push(`reporters[${index}].enabled must be boolean`);
});
}
return { valid: errors.length === 0, errors };
}
}
exports.ConfigValidator = ConfigValidator;
//# sourceMappingURL=config-validator.js.map