I am currently using the following approach, but it has several typing issues:
for (const schema of schemas) {
registerSchema(
Object.assign(
{ $schema: "http://json-schema.org/draft-07/schema" },
schema as SchemaObject,
),
);
}
// AST declares `plugins` as an array, but the property is used as a `Set`
// https://github.com/hyperjump-io/json-schema/blob/50dd7df599011bcd1df3283b2073507e9fc02bf9/lib/keywords/validation.js#L39
const ast = { metaData: {}, plugins: new Set() } as unknown as AST;
for (const schema of schemas) {
const s = await getSchema(schema.$id!);
// `Validation.compile` does not use the third argument
// https://github.com/hyperjump-io/json-schema/blob/50dd7df599011bcd1df3283b2073507e9fc02bf9/lib/keywords/validation.js#L10
await Validation.compile(s, ast, s);
}
I am currently using the following approach, but it has several typing issues: