Evaluation Options Editor API Methods
validateOptions()
Checks whether the specified evaluation options match the evaluation options schema.
You would want to use this method so that you can check options before you load them into the editor or save them to your database.
Examples
// Validate options that contain a marking style that is not allowed, and log the result
const validateResult = await editor.validateOptions({
grading: {
marking_style: 'strict'
}
});
console.log(validateResult);
/* Example output:
{
isValid: false,
errors: [
{
location: 'Grading > Marking style',
message: 'must be equal to one of the allowed values'
}
]
}
*/
Arguments
-
options object
The evaluation options JSON object to validate.
-
settings object
Controls optional settings for how the options are validated.
The following properties are supported.
-
strict boolean
Controls whether the options are validated against the evaluation options schema.
When set to
false, the method does not validate the options and always resolves withisValidset totrue.Default:
true
-
Return value
Type Promise
Resolves with an object containing the following properties:
-
isValid boolean
Indicates whether the options are valid.
-
errors array[object]
The validation errors. Present only when the options are not valid.
Each error has a
locationstring that identifies the option and amessagestring that describes the problem.
Related articles
- Evaluation options in the Feedback Aide API reference.