Rubric Editor API Methods
validateRubric()
Checks if the provided rubric JSON is valid, meaning if it matches the required schema or not.
You would want to use this method when you want to validate a rubric JSON before loading it into the editor, for example, when you want to ensure that the rubric JSON is valid before saving it to your database.
Examples
const validateResult = await editor.validateRubric({...});
console.log(validateResult);
/* Example output:
{
isValid: false,
errors: [...]
}
*/
Arguments
-
rubric object
The rubric JSON object to validate.
-
options object
Optional settings for validation.
The following properties are supported.
-
strict boolean
Controls whether the rubric should be validated against the schema.
If set to
true, the editor will validate the rubric against our predefined rubric schema and reject if invalid.If set to
false, the editor will only validate the rubrictype.You would want to use this argument when your rubric contains additional properties that are not part of the schema.
Default:
true
-
Return value
Type Promise
Resolves with an object containing the following properties:
-
isValid boolean
Indicates whether the rubric is valid or not.
-
errors array[Error]
An array of errors if the rubric is invalid.