Enki Curriculum AST Validators
Validates Enki Curriculum AST.
See Enki curriculum processors for more details.
Rules
Headline
There can only be 1
Headline
node per Insight
. This is checked by the headline
validator.
YAML
There can only be 1
YAML
metadata node per Insight
. This is checked by the yaml
validator.
Insight Section
The section name must be one of the following:
- Content
- Footnotes
- Revision
- Practice
- Quiz
Insight Question Gap
The insight question must have at least 1 question gap.
Insight Question Answers
The insight question must have answers and the number of question gaps must match the number of correct answers
API
const contentTypes = ;const getParser = ;const getValidator getSafeValidator validate validateSafe = ; const ast = ; // safely validate any insight propertyconst error = ;console;// "Must have exactly 1 yaml configuration but found 0 instead" // safely validate an entire insightconst errors = ast;console;// ["Must have exactly 1 yaml configuration but found 0 instead"] // strictly validate any insight propertytry ; catch e console; // "Must have exactly 1 yaml configuration but found 0 instead" // strictly validate an entire insighttry ast; catch e console; // "Must have exactly 1 yaml configuration but found 0 instead"