Skip to content

Commit 644b5c8

Browse files
committed
Some performance tweaks
1 parent 70666cc commit 644b5c8

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

lib/keywords/else.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as Browser from "@hyperjump/browser";
2+
import { FLAG } from "../index.js";
23
import { getKeywordName, Validation } from "../experimental.js";
34

45

@@ -16,7 +17,7 @@ const compile = async (schema, ast, parentSchema) => {
1617

1718
const interpret = ([ifSchema, elseSchema], instance, context) => {
1819
return ifSchema === undefined
19-
|| Validation.interpret(ifSchema, instance, { ...context, errors: [], annotations: [] })
20+
|| Validation.interpret(ifSchema, instance, { ...context, errors: [], annotations: [], oututFormat: FLAG })
2021
|| Validation.interpret(elseSchema, instance, context);
2122
};
2223

lib/keywords/then.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Browser from "@hyperjump/browser";
2-
import { getKeywordName } from "../keywords.js";
3-
import { Validation } from "../experimental.js";
2+
import { FLAG } from "../index.js";
3+
import { getKeywordName, Validation } from "../experimental.js";
44

55

66
const id = "https://json-schema.org/keyword/then";
@@ -17,7 +17,7 @@ const compile = async (schema, ast, parentSchema) => {
1717

1818
const interpret = ([ifSchema, thenSchema], instance, context) => {
1919
return ifSchema === undefined
20-
|| !Validation.interpret(ifSchema, instance, { ...context, errors: [], annotations: [] })
20+
|| !Validation.interpret(ifSchema, instance, { ...context, errors: [], annotations: [], outputFormat: FLAG })
2121
|| Validation.interpret(thenSchema, instance, context);
2222
};
2323

lib/keywords/unevaluatedItems.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { zip, range } from "@hyperjump/pact";
2+
import { FLAG } from "../index.js";
3+
import { canonicalUri, Validation } from "../experimental.js";
24
import * as Instance from "../instance.js";
3-
import { canonicalUri } from "../schema.js";
4-
import { Validation } from "../experimental.js";
55

66

77
const id = "https://json-schema.org/keyword/unevaluatedItems";
@@ -15,7 +15,8 @@ const interpret = ([schemaUrl, unevaluatedItems], instance, context) => {
1515
return true;
1616
}
1717

18-
const itemIndexes = Validation.collectEvaluatedItems(schemaUrl, instance, { ...context, errors: [], annotations: [] }, true);
18+
const keywordContext = { ...context, errors: [], annotations: [], outputFormat: FLAG };
19+
const itemIndexes = Validation.collectEvaluatedItems(schemaUrl, instance, keywordContext, true);
1920
if (itemIndexes === false) {
2021
return true;
2122
}

lib/keywords/unevaluatedProperties.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { FLAG } from "../index.js";
12
import { Validation, canonicalUri } from "../experimental.js";
23
import * as Instance from "../instance.js";
34

@@ -13,7 +14,8 @@ const interpret = ([schemaUrl, unevaluatedProperties], instance, context) => {
1314
return true;
1415
}
1516

16-
const evaluatedPropertyNames = Validation.collectEvaluatedProperties(schemaUrl, instance, { ...context, errors: [], annotations: [] }, true);
17+
const keywordContext = { ...context, errors: [], annotations: [], outputFormat: FLAG };
18+
const evaluatedPropertyNames = Validation.collectEvaluatedProperties(schemaUrl, instance, keywordContext, true);
1719
if (evaluatedPropertyNames === false) {
1820
return true;
1921
}

0 commit comments

Comments
 (0)