if (SIMPLE_INLINED.has(key))
continue;
if (typeof schema[key] == "object") {
- util_1.eachItem(schema[key], (sch) => (count += countKeys(sch)));
+ (0, util_1.eachItem)(schema[key], (sch) => (count += countKeys(sch)));
}
if (count === Infinity)
return Infinity;
}
exports.resolveUrl = resolveUrl;
const ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
-function getSchemaRefs(schema) {
+function getSchemaRefs(schema, baseId) {
if (typeof schema == "boolean")
return {};
- const schemaId = normalizeId(schema.$id);
- const baseIds = { "": schemaId };
- const pathPrefix = getFullPath(schemaId, false);
+ const { schemaId } = this.opts;
+ const schId = normalizeId(schema[schemaId] || baseId);
+ const baseIds = { "": schId };
+ const pathPrefix = getFullPath(schId, false);
const localRefs = {};
const schemaRefs = new Set();
traverse(schema, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => {
return;
const fullPath = pathPrefix + jsonPtr;
let baseId = baseIds[parentJsonPtr];
- if (typeof sch.$id == "string")
- baseId = addRef.call(this, sch.$id);
+ if (typeof sch[schemaId] == "string")
+ baseId = addRef.call(this, sch[schemaId]);
addAnchor.call(this, sch.$anchor);
addAnchor.call(this, sch.$dynamicAnchor);
baseIds[jsonPtr] = baseId;