botbook/node_modules/json-schema-library/dist/module/lib/isValid.js
Rodrigo Rodriguez 6ae15fe3e5 Updated.
2024-09-04 13:13:15 -03:00

12 lines
420 B
JavaScript

/**
* Test if the data is valid according to the given schema
*
* @param draft - validator
* @param value - value to validate
* @param [schema] - json schema
* @param [pointer] - json pointer pointing to value
* @return if schema does match given value
*/
export default function isValid(draft, value, schema = draft.rootSchema, pointer = "#") {
return draft.validate(value, schema, pointer).length === 0;
}