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.5.0 to 11.5.1

2

dist/lib/normalize-args.d.ts
import type { Options, ParserOptions } from "./options.js";
import type { JSONSchema, SchemaCallback } from "./types";
export interface NormalizedArguments<S, O> {
export interface NormalizedArguments<S extends JSONSchema = JSONSchema, O extends ParserOptions = ParserOptions> {
path: string;

@@ -5,0 +5,0 @@ schema: S;

@@ -0,1 +1,2 @@

/// <reference types="node" />
import type { HTTPResolverOptions, JSONSchema, JSONSchemaObject, Plugin, ResolverOptions } from "./types/index.js";

@@ -42,3 +43,3 @@ export type DeepPartial<T> = T extends object ? {

*/
export interface $RefParserOptions<S> {
export interface $RefParserOptions<S extends JSONSchema = JSONSchema> {
/**

@@ -91,5 +92,567 @@ * The `parse` options determine how different types of files will be parsed.

export declare const getJsonSchemaRefParserDefaultOptions: () => $RefParserOptions<JSONSchema>;
export declare const getNewOptions: <S, O>(options: O | undefined) => O & $RefParserOptions<S>;
export declare const getNewOptions: <S extends JSONSchema = JSONSchema, O extends {
parse?: {
[x: string]: boolean | {
name?: string | undefined;
order?: number | undefined;
allowEmpty?: boolean | undefined;
allowBOM?: boolean | undefined;
encoding?: BufferEncoding | undefined;
canParse?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
parse?: string | number | {} | undefined;
} | undefined;
json?: boolean | {
name?: string | undefined;
order?: number | undefined;
allowEmpty?: boolean | undefined;
allowBOM?: boolean | undefined;
encoding?: BufferEncoding | undefined;
canParse?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
parse?: string | number | {} | undefined;
} | undefined;
yaml?: boolean | {
name?: string | undefined;
order?: number | undefined;
allowEmpty?: boolean | undefined;
allowBOM?: boolean | undefined;
encoding?: BufferEncoding | undefined;
canParse?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
parse?: string | number | {} | undefined;
} | undefined;
binary?: boolean | {
name?: string | undefined;
order?: number | undefined;
allowEmpty?: boolean | undefined;
allowBOM?: boolean | undefined;
encoding?: BufferEncoding | undefined;
canParse?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
parse?: string | number | {} | undefined;
} | undefined;
text?: boolean | {
name?: string | undefined;
order?: number | undefined;
allowEmpty?: boolean | undefined;
allowBOM?: boolean | undefined;
encoding?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "binary" | "hex" | undefined;
canParse?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
parse?: string | number | {} | undefined;
} | undefined;
} | undefined;
resolve?: {
[x: string]: boolean | {
name?: string | undefined;
order?: number | undefined;
canRead?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
read?: string | object | {} | undefined;
} | {
headers?: ([(string | undefined)?, (string | undefined)?] | undefined)[] | {
[x: string]: string | undefined;
} | {
append?: {} | undefined;
delete?: {} | undefined;
get?: {} | undefined;
getSetCookie?: {} | undefined;
has?: {} | undefined;
set?: {} | undefined;
forEach?: {} | undefined;
} | null | undefined;
timeout?: number | undefined;
redirects?: number | undefined;
withCredentials?: boolean | undefined;
name?: string | undefined;
order?: number | undefined;
canRead?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
read?: string | object | {} | undefined;
} | undefined;
external?: boolean | undefined;
file?: boolean | {
name?: string | undefined;
order?: number | undefined;
canRead?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
read?: string | object | {} | undefined;
} | undefined;
http?: boolean | {
headers?: ([(string | undefined)?, (string | undefined)?] | undefined)[] | {
[x: string]: string | undefined;
} | {
append?: {} | undefined;
delete?: {} | undefined;
get?: {} | undefined;
getSetCookie?: {} | undefined;
has?: {} | undefined;
set?: {} | undefined;
forEach?: {} | undefined;
} | null | undefined;
timeout?: number | undefined;
redirects?: number | undefined;
withCredentials?: boolean | undefined;
name?: string | undefined;
order?: number | undefined;
canRead?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
read?: string | object | {} | undefined;
} | undefined;
} | undefined;
continueOnError?: boolean | undefined;
dereference?: {
circular?: boolean | "ignore" | undefined;
excludedPathMatcher?: {} | undefined;
onDereference?: {} | undefined;
externalReferenceResolution?: "relative" | "root" | undefined;
} | undefined;
mutateInputSchema?: boolean | undefined;
} = {
parse?: {
[x: string]: boolean | {
name?: string | undefined;
order?: number | undefined;
allowEmpty?: boolean | undefined;
allowBOM?: boolean | undefined;
encoding?: BufferEncoding | undefined;
canParse?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
parse?: string | number | {} | undefined;
} | undefined;
json?: boolean | {
name?: string | undefined;
order?: number | undefined;
allowEmpty?: boolean | undefined;
allowBOM?: boolean | undefined;
encoding?: BufferEncoding | undefined;
canParse?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
parse?: string | number | {} | undefined;
} | undefined;
yaml?: boolean | {
name?: string | undefined;
order?: number | undefined;
allowEmpty?: boolean | undefined;
allowBOM?: boolean | undefined;
encoding?: BufferEncoding | undefined;
canParse?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
parse?: string | number | {} | undefined;
} | undefined;
binary?: boolean | {
name?: string | undefined;
order?: number | undefined;
allowEmpty?: boolean | undefined;
allowBOM?: boolean | undefined;
encoding?: BufferEncoding | undefined;
canParse?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
parse?: string | number | {} | undefined;
} | undefined;
text?: boolean | {
name?: string | undefined;
order?: number | undefined;
allowEmpty?: boolean | undefined;
allowBOM?: boolean | undefined;
encoding?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "binary" | "hex" | undefined;
canParse?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
parse?: string | number | {} | undefined;
} | undefined;
} | undefined;
resolve?: {
[x: string]: boolean | {
name?: string | undefined;
order?: number | undefined;
canRead?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
read?: string | object | {} | undefined;
} | {
headers?: ([(string | undefined)?, (string | undefined)?] | undefined)[] | {
[x: string]: string | undefined;
} | {
append?: {} | undefined;
delete?: {} | undefined;
get?: {} | undefined;
getSetCookie?: {} | undefined;
has?: {} | undefined;
set?: {} | undefined;
forEach?: {} | undefined;
} | null | undefined;
timeout?: number | undefined;
redirects?: number | undefined;
withCredentials?: boolean | undefined;
name?: string | undefined;
order?: number | undefined;
canRead?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
read?: string | object | {} | undefined;
} | undefined;
external?: boolean | undefined;
file?: boolean | {
name?: string | undefined;
order?: number | undefined;
canRead?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
read?: string | object | {} | undefined;
} | undefined;
http?: boolean | {
headers?: ([(string | undefined)?, (string | undefined)?] | undefined)[] | {
[x: string]: string | undefined;
} | {
append?: {} | undefined;
delete?: {} | undefined;
get?: {} | undefined;
getSetCookie?: {} | undefined;
has?: {} | undefined;
set?: {} | undefined;
forEach?: {} | undefined;
} | null | undefined;
timeout?: number | undefined;
redirects?: number | undefined;
withCredentials?: boolean | undefined;
name?: string | undefined;
order?: number | undefined;
canRead?: string | boolean | {
exec?: {} | undefined;
test?: {} | undefined;
readonly source?: string | undefined;
readonly global?: boolean | undefined;
readonly ignoreCase?: boolean | undefined;
readonly multiline?: boolean | undefined;
lastIndex?: number | undefined;
compile?: {} | undefined;
readonly flags?: string | undefined;
readonly sticky?: boolean | undefined;
readonly unicode?: boolean | undefined;
readonly dotAll?: boolean | undefined;
readonly hasIndices?: boolean | undefined;
[Symbol.match]?: {} | undefined;
[Symbol.replace]?: {} | undefined;
[Symbol.search]?: {} | undefined;
[Symbol.split]?: {} | undefined;
[Symbol.matchAll]?: {} | undefined;
} | (string | undefined)[] | {} | undefined;
read?: string | object | {} | undefined;
} | undefined;
} | undefined;
continueOnError?: boolean | undefined;
dereference?: {
circular?: boolean | "ignore" | undefined;
excludedPathMatcher?: {} | undefined;
onDereference?: {} | undefined;
externalReferenceResolution?: "relative" | "root" | undefined;
} | undefined;
mutateInputSchema?: boolean | undefined;
}>(options: O | undefined) => O & $RefParserOptions<S>;
export type Options = $RefParserOptions<JSONSchema>;
export type ParserOptions = DeepPartial<$RefParserOptions<JSONSchema>>;
export default $RefParserOptions;

@@ -12,3 +12,3 @@ import type $RefParserOptions from "./options.js";

*/
declare class Pointer<S = JSONSchema> {
declare class Pointer<S extends JSONSchema = JSONSchema> {
/**

@@ -15,0 +15,0 @@ * The {@link $Ref} object that contains this {@link Pointer} object.

@@ -13,3 +13,3 @@ import Pointer from "./pointer.js";

*/
declare class $Ref<S = JSONSchema> {
declare class $Ref<S extends JSONSchema = JSONSchema> {
/**

@@ -181,4 +181,4 @@ * The file path or URL of the referenced file.

*/
static dereference<S>($ref: $Ref<S>, resolvedValue: S): S;
static dereference<S extends JSONSchema = JSONSchema>($ref: $Ref<S>, resolvedValue: S): S;
}
export default $Ref;

@@ -5,3 +5,3 @@ import $Ref from "./ref.js";

import type { JSONSchema } from "./types";
interface $RefsMap<S> {
interface $RefsMap<S extends JSONSchema = JSONSchema> {
[url: string]: $Ref<S>;

@@ -16,3 +16,3 @@ }

*/
export default class $Refs<S = JSONSchema> {
export default class $Refs<S extends JSONSchema = JSONSchema> {
/**

@@ -19,0 +19,0 @@ * This property is true if the schema contains any circular references. You may want to check this property before serializing the dereferenced schema as JSON, since JSON.stringify() does not support circular references by default.

@@ -6,8 +6,8 @@ /// <reference types="node" />

export type JSONSchemaObject = JSONSchema4Object | JSONSchema6Object | JSONSchema7Object;
export type SchemaCallback<S = JSONSchema> = (err: Error | null, schema?: S | object | null) => any;
export type $RefsCallback<S = JSONSchema> = (err: Error | null, $refs?: $Refs<S>) => any;
export type SchemaCallback<S extends JSONSchema = JSONSchema> = (err: Error | null, schema?: S | object | null) => any;
export type $RefsCallback<S extends JSONSchema = JSONSchema> = (err: Error | null, $refs?: $Refs<S>) => any;
/**
* See https://apitools.dev/json-schema-ref-parser/docs/options.html
*/
export interface HTTPResolverOptions<S = JSONSchema> extends Partial<ResolverOptions<S>> {
export interface HTTPResolverOptions<S extends JSONSchema = JSONSchema> extends Partial<ResolverOptions<S>> {
/**

@@ -35,3 +35,3 @@ * You can specify any HTTP headers that should be sent when downloading files. For example, some servers may require you to set the `Accept` or `Referrer` header.

*/
export interface ResolverOptions<S = JSONSchema> {
export interface ResolverOptions<S extends JSONSchema = JSONSchema> {
name?: string;

@@ -38,0 +38,0 @@ /**

/// <reference types="node" />
import type { FileInfo } from "../types/index.js";
import type { FileInfo, JSONSchema } from "../types/index.js";
import type $RefParserOptions from "../options.js";

@@ -13,3 +13,3 @@ import type { ResolverOptions } from "../types/index.js";

*/
export declare function all<S>(plugins: $RefParserOptions<S>["resolve"]): Plugin[];
export declare function all<S extends JSONSchema = JSONSchema>(plugins: $RefParserOptions<S>["resolve"]): Plugin[];
/**

@@ -23,3 +23,3 @@ * Filters the given plugins, returning only the ones return `true` for the given method.

export declare function sort(plugins: Plugin[]): Plugin[];
export interface PluginResult<S> {
export interface PluginResult<S extends JSONSchema = JSONSchema> {
plugin: Plugin;

@@ -37,2 +37,2 @@ result?: string | Buffer | S;

*/
export declare function run<S>(plugins: Plugin[], method: keyof Plugin | keyof ResolverOptions<S>, file: FileInfo, $refs: $Refs<S>): Promise<PluginResult<S>>;
export declare function run<S extends JSONSchema = JSONSchema>(plugins: Plugin[], method: keyof Plugin | keyof ResolverOptions<S>, file: FileInfo, $refs: $Refs<S>): Promise<PluginResult<S>>;

@@ -43,3 +43,3 @@ import $Ref from "./ref.js";

*/
function crawl<S, O>(
function crawl<S extends JSONSchema = JSONSchema, O extends ParserOptions = ParserOptions>(
parent: any,

@@ -106,3 +106,3 @@ key: string | null,

*/
function inventory$Ref<S, O>(
function inventory$Ref<S extends JSONSchema = JSONSchema, O extends ParserOptions = ParserOptions>(
$refParent: any,

@@ -109,0 +109,0 @@ $refKey: any,

@@ -7,3 +7,3 @@ import type { Options, ParserOptions } from "./options.js";

// In the future, I'd like to deprecate the api and accept only named parameters in index.ts
export interface NormalizedArguments<S, O> {
export interface NormalizedArguments<S extends JSONSchema = JSONSchema, O extends ParserOptions = ParserOptions> {
path: string;

@@ -10,0 +10,0 @@ schema: S;

@@ -56,3 +56,3 @@ import jsonParser from "./parsers/json.js";

*/
export interface $RefParserOptions<S> {
export interface $RefParserOptions<S extends JSONSchema = JSONSchema> {
/**

@@ -178,3 +178,5 @@ * The `parse` options determine how different types of files will be parsed.

export const getNewOptions = <S, O>(options: O | undefined): O & $RefParserOptions<S> => {
export const getNewOptions = <S extends JSONSchema = JSONSchema, O extends ParserOptions = ParserOptions>(
options: O | undefined,
): O & $RefParserOptions<S> => {
const newOptions = getJsonSchemaRefParserDefaultOptions();

@@ -181,0 +183,0 @@ if (options) {

@@ -29,3 +29,3 @@ import type $RefParserOptions from "./options.js";

*/
class Pointer<S = JSONSchema> {
class Pointer<S extends JSONSchema = JSONSchema> {
/**

@@ -32,0 +32,0 @@ * The {@link $Ref} object that contains this {@link Pointer} object.

@@ -17,3 +17,3 @@ import Pointer from "./pointer.js";

*/
class $Ref<S = JSONSchema> {
class $Ref<S extends JSONSchema = JSONSchema> {
/**

@@ -271,3 +271,3 @@ * The file path or URL of the referenced file.

*/
static dereference<S>($ref: $Ref<S>, resolvedValue: S): S {
static dereference<S extends JSONSchema = JSONSchema>($ref: $Ref<S>, resolvedValue: S): S {
if (resolvedValue && typeof resolvedValue === "object" && $Ref.isExtended$Ref($ref)) {

@@ -274,0 +274,0 @@ const merged = {};

@@ -9,3 +9,3 @@ import { ono } from "@jsdevtools/ono";

interface $RefsMap<S> {
interface $RefsMap<S extends JSONSchema = JSONSchema> {
[url: string]: $Ref<S>;

@@ -20,3 +20,3 @@ }

*/
export default class $Refs<S = JSONSchema> {
export default class $Refs<S extends JSONSchema = JSONSchema> {
/**

@@ -220,3 +220,3 @@ * This property is true if the schema contains any circular references. You may want to check this property before serializing the dereferenced schema as JSON, since JSON.stringify() does not support circular references by default.

*/
function getPaths<S>($refs: $RefsMap<S>, types: string[]) {
function getPaths<S extends JSONSchema = JSONSchema>($refs: $RefsMap<S>, types: string[]) {
let paths = Object.keys($refs);

@@ -223,0 +223,0 @@

@@ -69,3 +69,3 @@ import { ono } from "@jsdevtools/ono";

*/
async function download<S>(
async function download<S extends JSONSchema = JSONSchema>(
u: URL | string,

@@ -113,3 +113,3 @@ httpOptions: HTTPResolverOptions<S>,

*/
async function get<S>(u: RequestInfo | URL, httpOptions: HTTPResolverOptions<S>) {
async function get<S extends JSONSchema = JSONSchema>(u: RequestInfo | URL, httpOptions: HTTPResolverOptions<S>) {
let controller: any;

@@ -116,0 +116,0 @@ let timeoutId: any;

@@ -13,4 +13,4 @@ import type {

export type JSONSchemaObject = JSONSchema4Object | JSONSchema6Object | JSONSchema7Object;
export type SchemaCallback<S = JSONSchema> = (err: Error | null, schema?: S | object | null) => any;
export type $RefsCallback<S = JSONSchema> = (err: Error | null, $refs?: $Refs<S>) => any;
export type SchemaCallback<S extends JSONSchema = JSONSchema> = (err: Error | null, schema?: S | object | null) => any;
export type $RefsCallback<S extends JSONSchema = JSONSchema> = (err: Error | null, $refs?: $Refs<S>) => any;

@@ -21,3 +21,3 @@ /**

export interface HTTPResolverOptions<S = JSONSchema> extends Partial<ResolverOptions<S>> {
export interface HTTPResolverOptions<S extends JSONSchema = JSONSchema> extends Partial<ResolverOptions<S>> {
/**

@@ -49,3 +49,3 @@ * You can specify any HTTP headers that should be sent when downloading files. For example, some servers may require you to set the `Accept` or `Referrer` header.

*/
export interface ResolverOptions<S = JSONSchema> {
export interface ResolverOptions<S extends JSONSchema = JSONSchema> {
name?: string;

@@ -52,0 +52,0 @@ /**

@@ -63,3 +63,3 @@ import { Ono } from "@jsdevtools/ono";

for (const $ref of Object.values(parser.$refs._$refs) as $Ref<unknown>[]) {
for (const $ref of Object.values(parser.$refs._$refs) as $Ref<S>[]) {
if ($ref.errors) {

@@ -66,0 +66,0 @@ errors.push(...$ref.errors);

@@ -1,2 +0,2 @@

import type { FileInfo } from "../types/index.js";
import type { FileInfo, JSONSchema } from "../types/index.js";
import type $RefParserOptions from "../options.js";

@@ -13,3 +13,3 @@ import type { ResolverOptions } from "../types/index.js";

*/
export function all<S>(plugins: $RefParserOptions<S>["resolve"]): Plugin[] {
export function all<S extends JSONSchema = JSONSchema>(plugins: $RefParserOptions<S>["resolve"]): Plugin[] {
return Object.keys(plugins)

@@ -47,3 +47,3 @@ .filter((key) => {

export interface PluginResult<S> {
export interface PluginResult<S extends JSONSchema = JSONSchema> {
plugin: Plugin;

@@ -62,3 +62,3 @@ result?: string | Buffer | S;

*/
export async function run<S>(
export async function run<S extends JSONSchema = JSONSchema>(
plugins: Plugin[],

@@ -133,3 +133,3 @@ method: keyof Plugin | keyof ResolverOptions<S>,

*/
function getResult<S>(
function getResult<S extends JSONSchema = JSONSchema>(
obj: Plugin,

@@ -136,0 +136,0 @@ prop: keyof Plugin | keyof ResolverOptions<S>,

{
"name": "@apidevtools/json-schema-ref-parser",
"version": "11.5.0",
"version": "11.5.1",
"description": "Parse, Resolve, and Dereference JSON Schema $ref pointers",

@@ -87,3 +87,3 @@ "keywords": [

"rimraf": "^5.0.5",
"typescript": "^5.3.3",
"typescript": "^5.4.2",
"vitest": "^1.3.1"

@@ -90,0 +90,0 @@ },

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