@apidevtools/json-schema-ref-parser 14.1.0 → 14.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -104,8 +104,12 @@ function crawl(parent, key, path, pathFromRoot, indirections, inventory, $refs,
104
104
  else {
105
105
  crawl(obj, key, keyPath, keyPathFromRoot, indirections, inventory, $refs, options);
106
106
  }
107
- if (value["$ref"]) {
108
- bundleOptions?.onBundle?.(value["$ref"], obj[key], obj, key);
107
+ // We need to ensure that we have an object to work with here because we may be crawling
108
+ // an `examples` schema and `value` may be nullish.
109
+ if (value && typeof value === "object" && !Array.isArray(value)) {
110
+ if ("$ref" in value) {
111
+ bundleOptions?.onBundle?.(value["$ref"], obj[key], obj, key);
112
+ }
109
113
  }
110
114
  }
111
115
  }
package/lib/bundle.ts CHANGED
@@ -101,8 +101,12 @@ function crawl<S extends object = JSONSchema, O extends ParserOptions<S> = Parse
101
101
  crawl(obj, key, keyPath, keyPathFromRoot, indirections, inventory, $refs, options);
102
102
  }
103
103
 
104
- if (value["$ref"]) {
105
- bundleOptions?.onBundle?.(value["$ref"], obj[key], obj as any, key);
104
+ // We need to ensure that we have an object to work with here because we may be crawling
105
+ // an `examples` schema and `value` may be nullish.
106
+ if (value && typeof value === "object" && !Array.isArray(value)) {
107
+ if ("$ref" in value) {
108
+ bundleOptions?.onBundle?.(value["$ref"], obj[key], obj as any, key);
109
+ }
106
110
  }
107
111
  }
108
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apidevtools/json-schema-ref-parser",
3
- "version": "14.1.0",
3
+ "version": "14.1.1",
4
4
  "description": "Parse, Resolve, and Dereference JSON Schema $ref pointers",
5
5
  "scripts": {
6
6
  "prepublishOnly": "yarn build",