Socket
Socket
Sign inDemoInstall

@apidevtools/json-schema-ref-parser

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apidevtools/json-schema-ref-parser - npm Package Compare versions

Comparing version 11.2.3 to 11.2.4

2

dist/lib/index.d.ts

@@ -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": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc