yaml-joi
Parse string in yaml format into Joi validator.
Install
$ npm install yaml-joior$ yarn add yaml-joi
Example
; const yamlLoadOpts = {};const yamlSchema = `type: stringallowEmpty: truelimitation: - min: 3 - max: 5 - regex: !!js/regexp /^(\S*)$/`; const validator = ;validatorerror === null;validatorerror !== null;validatorerror === null;validatorerror !== null;validatorerror !== null;
; const yamlSchema = `type: objectlimitation: - keys: name: isSchema: true type: string allowEmpty: nothing limitation: - min: 5 - max: 24`; const validator = ;validatorerror === null;validatorerror !== null;validatorerror === null;
Get more at cases.yml.