Skip to content

Commit ef318a0

Browse files
committed
Remove unused plugin system with type errors
After fixing some type errors in @hyperjump/json-schema, it exposed a type issue in the plugin system. We aren't using the plugin system, so I decided to just remove it for now instead of fix it. Something like it can be added in again later if it turns out we need it.
1 parent e725f64 commit ef318a0

File tree

2 files changed

+3
-24
lines changed

2 files changed

+3
-24
lines changed

src/index.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AST, EvaluationPlugin } from "@hyperjump/json-schema/experimental";
1+
import { AST } from "@hyperjump/json-schema/experimental";
22
import { JsonNode } from "@hyperjump/json-schema/instance/experimental";
33
import { Localization } from "./localization.js";
44

@@ -63,7 +63,6 @@ export type KeywordHandler = {
6363
export type EvaluationContext = {
6464
ast: AST;
6565
errorIndex: ErrorIndex;
66-
plugins: EvaluationPlugin[];
6766
};
6867

6968
export type ErrorIndex = {

src/normalized-output.js

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,9 @@ export const setNormalizationHandler = (uri, handler) => {
2222
export const evaluateSchema = (schemaLocation, instance, context) => {
2323
const instanceLocation = Instance.uri(instance);
2424

25-
let valid = true;
2625
/** @type API.NormalizedOutput */
2726
const output = { [instanceLocation]: {} };
2827

29-
for (const plugin of context.plugins) {
30-
plugin.beforeSchema?.(schemaLocation, instance, context);
31-
}
32-
3328
const schemaNode = context.ast[schemaLocation];
3429
if (typeof schemaNode === "boolean") {
3530
output[instanceLocation] = {
@@ -44,18 +39,11 @@ export const evaluateSchema = (schemaLocation, instance, context) => {
4439

4540
const keywordContext = {
4641
ast: context.ast,
47-
errorIndex: context.errorIndex,
48-
plugins: context.plugins
42+
errorIndex: context.errorIndex
4943
};
50-
for (const plugin of context.plugins) {
51-
plugin.beforeKeyword?.(node, instance, keywordContext, context, keyword);
52-
}
5344

5445
const keywordOutput = keyword.evaluate?.(keywordValue, instance, keywordContext);
5546
const isKeywordValid = !context.errorIndex[keywordLocation]?.[instanceLocation];
56-
if (!isKeywordValid) {
57-
valid = false;
58-
}
5947

6048
if (keyword.simpleApplicator) {
6149
for (const suboutput of (keywordOutput ?? [])) {
@@ -68,17 +56,9 @@ export const evaluateSchema = (schemaLocation, instance, context) => {
6856
output[instanceLocation][keywordUri] ??= {};
6957
output[instanceLocation][keywordUri][keywordLocation] = isKeywordValid;
7058
}
71-
72-
for (const plugin of context.plugins) {
73-
plugin.afterKeyword?.(node, instance, keywordContext, isKeywordValid, context, keyword);
74-
}
7559
}
7660
}
7761

78-
for (const plugin of context.plugins) {
79-
plugin.afterSchema?.(schemaLocation, instance, context, valid);
80-
}
81-
8262
return output;
8363
};
8464

@@ -142,6 +122,6 @@ export async function normalizedErrorOuput(instance, errorOutput, subjectUri) {
142122
const { schemaUri, ast } = await compile(schema);
143123
const value = Instance.fromJs(instance);
144124
/** @type API.EvaluationContext */
145-
const context = { ast, errorIndex, plugins: [] };
125+
const context = { ast, errorIndex };
146126
return evaluateSchema(schemaUri, value, context);
147127
}

0 commit comments

Comments
 (0)