Skip to content

Commit

Permalink
update: validate to catch input-error
Browse files Browse the repository at this point in the history
  • Loading branch information
sagold committed Apr 14, 2024
1 parent 0aad686 commit 93da964
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/draft/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import validate from "../validate";
import { CreateError } from "../utils/createCustomError";
import { each, EachCallback } from "../each";
import { eachSchema, EachSchemaCallback } from "../eachSchema";
import { JsonSchema, JsonPointer, JsonError } from "../types";
import { JsonSchema, JsonPointer, JsonError, isJsonError } from "../types";
import { createNode, SchemaNode, isSchemaNode } from "../schemaNode";
import { JsonValidator, JsonTypeValidator } from "../validation/type";
import { resolveAllOf } from "../features/allOf";
Expand Down Expand Up @@ -235,7 +235,9 @@ export class Draft {
const inuptNode = data;
return this.config.validate(inuptNode, inputData);
}

if (isJsonError(data)) {
return [data];
}
const node = this.createNode(schema, pointer);
return this.config.validate(node, data);
}
Expand Down

0 comments on commit 93da964

Please sign in to comment.