@apidevtools/json-schema-ref-parser
Advanced tools
Comparing version 11.2.3 to 11.2.4
@@ -5,3 +5,3 @@ import $Refs from "./refs.js"; | ||
import type { Plugin, $RefsCallback, JSONSchema, SchemaCallback, HTTPResolverOptions, FileInfo, ResolverOptions, JSONSchemaObject } from "./types/index.js"; | ||
export { JSONSchemaObject, ResolverOptions, ParserError, UnmatchedResolverError, ResolverError, HTTPResolverOptions, FileInfo, UnmatchedParserError, ParserOptions, MissingPointerError, InvalidPointerError, JSONParserError, Plugin, }; | ||
export { JSONSchemaObject, ResolverOptions, ParserError, UnmatchedResolverError, ResolverError, HTTPResolverOptions, FileInfo, UnmatchedParserError, ParserOptions, MissingPointerError, InvalidPointerError, JSONParserError, Plugin, JSONSchema, $RefsCallback, SchemaCallback, }; | ||
export type RefParserSchema = string | JSONSchema; | ||
@@ -8,0 +8,0 @@ /** |
@@ -36,2 +36,10 @@ "use strict"; | ||
const escapedTilde = /~0/g; | ||
const safeDecodeURIComponent = (encodedURIComponent) => { | ||
try { | ||
return decodeURIComponent(encodedURIComponent); | ||
} | ||
catch { | ||
return encodedURIComponent; | ||
} | ||
}; | ||
/** | ||
@@ -157,3 +165,3 @@ * This class represents a single JSON pointer and its resolved value. | ||
for (let i = 0; i < pointer.length; i++) { | ||
pointer[i] = decodeURIComponent(pointer[i].replace(escapedSlash, "/").replace(escapedTilde, "~")); | ||
pointer[i] = safeDecodeURIComponent(pointer[i].replace(escapedSlash, "/").replace(escapedTilde, "~")); | ||
} | ||
@@ -160,0 +168,0 @@ if (pointer[0] !== "") { |
@@ -218,4 +218,7 @@ "use strict"; | ||
const hasProjectUri = upperPath.includes(posixUpper); | ||
const isAbsolutePath = path_1.win32?.isAbsolute(path); | ||
if (!(hasProjectDir || hasProjectUri || isAbsolutePath)) { | ||
const isAbsolutePath = path_1.win32?.isAbsolute(path) || | ||
path.startsWith("http://") || | ||
path.startsWith("https://") || | ||
path.startsWith("file://"); | ||
if (!(hasProjectDir || hasProjectUri || isAbsolutePath) && !projectDir.startsWith("http")) { | ||
path = (0, path_2.join)(projectDir, path); | ||
@@ -222,0 +225,0 @@ } |
@@ -47,2 +47,5 @@ import $Refs from "./refs.js"; | ||
Plugin, | ||
JSONSchema, | ||
$RefsCallback, | ||
SchemaCallback, | ||
}; | ||
@@ -49,0 +52,0 @@ |
@@ -11,2 +11,10 @@ import type $RefParserOptions from "./options.js"; | ||
const safeDecodeURIComponent = (encodedURIComponent: string): string => { | ||
try { | ||
return decodeURIComponent(encodedURIComponent); | ||
} catch { | ||
return encodedURIComponent; | ||
} | ||
}; | ||
/** | ||
@@ -185,3 +193,3 @@ * This class represents a single JSON pointer and its resolved value. | ||
for (let i = 0; i < pointer.length; i++) { | ||
pointer[i] = decodeURIComponent(pointer[i].replace(escapedSlash, "/").replace(escapedTilde, "~")); | ||
pointer[i] = safeDecodeURIComponent(pointer[i].replace(escapedSlash, "/").replace(escapedTilde, "~")); | ||
} | ||
@@ -188,0 +196,0 @@ |
@@ -194,5 +194,9 @@ import convertPathToPosix from "./convert-path-to-posix"; | ||
const hasProjectUri = upperPath.includes(posixUpper); | ||
const isAbsolutePath = win32?.isAbsolute(path); | ||
const isAbsolutePath = | ||
win32?.isAbsolute(path) || | ||
path.startsWith("http://") || | ||
path.startsWith("https://") || | ||
path.startsWith("file://"); | ||
if (!(hasProjectDir || hasProjectUri || isAbsolutePath)) { | ||
if (!(hasProjectDir || hasProjectUri || isAbsolutePath) && !projectDir.startsWith("http")) { | ||
path = join(projectDir, path); | ||
@@ -199,0 +203,0 @@ } |
{ | ||
"name": "@apidevtools/json-schema-ref-parser", | ||
"version": "11.2.3", | ||
"version": "11.2.4", | ||
"description": "Parse, Resolve, and Dereference JSON Schema $ref pointers", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
308639
7185