massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / table / node_modules / ajv / dist / compile / resolve.js
index 37eb9a8654c43da6c843165ba1911f3ab84e473b..f5b8a881305a4b648b4b5817f8aefd0ba3466d2f 100644 (file)
@@ -62,7 +62,7 @@ function countKeys(schema) {
         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;
@@ -91,12 +91,13 @@ function resolveUrl(baseId, id) {
 }
 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) => {
@@ -104,8 +105,8 @@ function getSchemaRefs(schema) {
             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;