@apidevtools/json-schema-ref-parser 14.0.0 → 14.0.2

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.
@@ -65,6 +65,10 @@ exports.default = {
65
65
  e.message = `Malformed URI: ${file.url}: ${e.message}`;
66
66
  throw new errors_js_1.ResolverError(e, file.url);
67
67
  }
68
+ // strip trailing slashes
69
+ if (path.endsWith("/") || path.endsWith("\\")) {
70
+ path = path.slice(0, -1);
71
+ }
68
72
  try {
69
73
  return await fs_1.default.promises.readFile(path);
70
74
  }
@@ -28,7 +28,7 @@ export interface HTTPResolverOptions<S extends object = JSONSchema> extends Part
28
28
  /**
29
29
  * Set this to `false` if you want to allow unsafe URLs (e.g., `127.0.0.1`, localhost, and other internal URLs).
30
30
  */
31
- safeUrlResolver: true;
31
+ safeUrlResolver?: boolean;
32
32
  }
33
33
  /**
34
34
  * JSON Schema `$Ref` Parser comes with built-in resolvers for HTTP and HTTPS URLs, as well as local filesystem paths (when running in Node.js). You can add your own custom resolvers to support additional protocols, or even replace any of the built-in resolvers with your own custom implementation.
@@ -31,6 +31,10 @@ export default {
31
31
  e.message = `Malformed URI: ${file.url}: ${e.message}`;
32
32
  throw new ResolverError(e, file.url);
33
33
  }
34
+ // strip trailing slashes
35
+ if (path.endsWith("/") || path.endsWith("\\")) {
36
+ path = path.slice(0, -1);
37
+ }
34
38
  try {
35
39
  return await fs.promises.readFile(path);
36
40
  } catch (err: any) {
@@ -45,7 +45,7 @@ export interface HTTPResolverOptions<S extends object = JSONSchema> extends Part
45
45
  /**
46
46
  * Set this to `false` if you want to allow unsafe URLs (e.g., `127.0.0.1`, localhost, and other internal URLs).
47
47
  */
48
- safeUrlResolver: true;
48
+ safeUrlResolver?: boolean;
49
49
  }
50
50
 
51
51
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apidevtools/json-schema-ref-parser",
3
- "version": "14.0.0",
3
+ "version": "14.0.2",
4
4
  "description": "Parse, Resolve, and Dereference JSON Schema $ref pointers",
5
5
  "scripts": {
6
6
  "prepublishOnly": "yarn build",
@@ -74,13 +74,13 @@
74
74
  "@types/node": "^24",
75
75
  "@typescript-eslint/eslint-plugin": "^8.34.1",
76
76
  "@typescript-eslint/parser": "^8.34.1",
77
- "@vitest/coverage-v8": "^3.2.3",
77
+ "@vitest/coverage-v8": "^3.2.4",
78
78
  "cross-env": "^7.0.3",
79
79
  "eslint": "^9.29.0",
80
80
  "eslint-config-prettier": "^10.1.5",
81
81
  "eslint-config-standard": "^17.1.0",
82
82
  "eslint-plugin-import": "^2.31.0",
83
- "eslint-plugin-prettier": "^5.4.1",
83
+ "eslint-plugin-prettier": "^5.5.0",
84
84
  "eslint-plugin-promise": "^7.2.1",
85
85
  "eslint-plugin-unused-imports": "^4.1.4",
86
86
  "globals": "^16.2.0",
@@ -89,7 +89,7 @@
89
89
  "rimraf": "^6.0.1",
90
90
  "typescript": "^5.8.3",
91
91
  "typescript-eslint": "^8.34.1",
92
- "vitest": "^3.2.3"
92
+ "vitest": "^3.2.4"
93
93
  },
94
94
  "dependencies": {
95
95
  "@types/json-schema": "^7.0.15",