We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b32c87c commit 70c43fdCopy full SHA for 70c43fd
src/index.js
@@ -25,8 +25,18 @@ import {
25
export const validate = (schema, instance) => {
26
registerSchema(schema, "");
27
const schemaNode = /** @type NonNullable<JsonNode> */ (schemaRegistry.get(""));
28
+
29
+ if (schemaNode.jsonType === "object" && jsonObjectHas("$schema", schemaNode)) {
30
+ const $schema = jsonPointerStep("$schema", schemaNode);
31
+ if ($schema.jsonType === "string" && $schema.value !== "https://json-schema.org/draft/2020-12/schema") {
32
+ throw Error(`Dialect '${$schema.value}' is not supported. Use 2020-12.`);
33
+ }
34
35
36
const isValid = validateSchema(schemaNode, toJsonNode(instance));
37
38
schemaRegistry.delete("");
39
40
return isValid;
41
};
42
0 commit comments