Skip to content

Commit 382bde1

Browse files
author
Siddharth Yadav
committed
fix: includes error
1 parent 99b97fb commit 382bde1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dereference.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,16 @@ function validateSchemaMeta(schema, schemaVersion) {
8585
function detectSchemaVersion(schema) {
8686
const schemaUrl = schema.$schema;
8787

88+
if (!schemaUrl) {
89+
throw new Error('Missing $schema property in the JSON Schema.');
90+
}
91+
8892
if (schemaUrl.includes('draft/2020-12')) {
8993
return '2020-12';
9094
} else if (schemaUrl.includes('draft-07')) {
9195
return 'draft-07';
9296
} else {
93-
throw new Error('Unsupported or missing $schema property in the JSON Schema.');
97+
throw new Error('Unsupported $schema property in the JSON Schema: ' + schemaUrl);
9498
}
9599
}
96100

0 commit comments

Comments
 (0)