Skip to content

Commit b80e3e2

Browse files
committed
Fix too many dynamic plugins
1 parent 2b5d032 commit b80e3e2

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const validate = async (url, value = undefined, outputFormat = undefined)
2727
};
2828

2929
export const compile = async (schema) => {
30-
const ast = { metaData: {}, plugins: [] };
30+
const ast = { metaData: {}, plugins: new Set() };
3131
const schemaUri = await Validation.compile(schema, ast);
3232
return { ast, schemaUri };
3333
};

lib/experimental.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export type Keyword<A> = {
7676

7777
export type ValidationContext = {
7878
ast: AST;
79-
plugins: EvaluationPlugin<unknown>[];
79+
plugins: Set<EvaluationPlugin<unknown>>;
8080
};
8181

8282
export type EvaluationPlugin<Context> = {

lib/keywords/validation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const compile = async (schema, ast) => {
3333
asyncMap(async ([keyword, keywordSchema]) => {
3434
const keywordHandler = getKeywordByName(keyword, schema.document.dialectId);
3535
if (keywordHandler.plugin) {
36-
ast.plugins.push(keywordHandler.plugin);
36+
ast.plugins.add(keywordHandler.plugin);
3737
}
3838
const keywordAst = await keywordHandler.compile(keywordSchema, ast, schema);
3939
return [keywordHandler.id, pointerAppend(keyword, canonicalUri(schema)), keywordAst];

0 commit comments

Comments
 (0)