Add LevelLinter (static checks) and LevelChecker (execution checks) shared by tests and the future author editor

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
denis
2026-10-16 16:44:05 +02:00
parent a97995342f
commit 2205d64ea3
16 changed files with 1637 additions and 51 deletions
+23
View File
@@ -0,0 +1,23 @@
import { dereference } from './dereference.js';
import { validate } from './validate.js';
export class Validator {
schema;
draft;
shortCircuit;
lookup;
constructor(schema, draft = '2019-09', shortCircuit = true) {
this.schema = schema;
this.draft = draft;
this.shortCircuit = shortCircuit;
this.lookup = dereference(schema);
}
validate(instance) {
return validate(instance, this.schema, this.draft, this.lookup, this.shortCircuit);
}
addSchema(schema, id) {
if (id) {
schema = { ...schema, $id: id };
}
dereference(schema, this.lookup);
}
}