Skip to content

fix: add JSONSchema7 types, resolve option index signature & missing JSONSchema return type in resolver options read #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JSONSchema4, JSONSchema4Type, JSONSchema6, JSONSchema6Type } from "json-schema";
import { JSONSchema4, JSONSchema4Type, JSONSchema6, JSONSchema6Type, JSONSchema7, JSONSchema7Type } from "json-schema";

export = $RefParser;

Expand Down Expand Up @@ -173,7 +173,7 @@ declare class $RefParser {
// eslint-disable-next-line no-redeclare
declare namespace $RefParser {

export type JSONSchema = JSONSchema4 | JSONSchema6;
export type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;
export type SchemaCallback = (err: Error | null, schema?: JSONSchema) => any;
export type $RefsCallback = (err: Error | null, $refs?: $Refs) => any;

Expand Down Expand Up @@ -208,7 +208,7 @@ declare namespace $RefParser {
file?: Partial<ResolverOptions> | boolean;
http?: HTTPResolverOptions | boolean;
} & {
[key: string]: Partial<ResolverOptions> | boolean;
[key: string]: Partial<ResolverOptions> | HTTPResolverOptions | boolean | undefined;
};

/**
Expand Down Expand Up @@ -284,7 +284,7 @@ declare namespace $RefParser {
read(
file: FileInfo,
callback?: (error: Error | null, data: string | null) => any
): string | Buffer | Promise<string | Buffer>;
): string | Buffer | JSONSchema | Promise<string | Buffer | JSONSchema>;
}

export interface ParserOptions {
Expand Down Expand Up @@ -395,15 +395,15 @@ declare namespace $RefParser {
*
* @param $ref The JSON Reference path, optionally with a JSON Pointer in the hash
*/
public get($ref: string): JSONSchema4Type | JSONSchema6Type
public get($ref: string): JSONSchema4Type | JSONSchema6Type | JSONSchema7Type

/**
* Sets the value at the given path in the schema. If the property, or any of its parents, don't exist, they will be created.
*
* @param $ref The JSON Reference path, optionally with a JSON Pointer in the hash
* @param value The value to assign. Can be anything (object, string, number, etc.)
*/
public set($ref: string, value: JSONSchema4Type | JSONSchema6Type): void
public set($ref: string, value: JSONSchema4Type | JSONSchema6Type | JSONSchema7Type): void
}

export type JSONParserErrorType = "EUNKNOWN" | "EPARSER" | "EUNMATCHEDPARSER" | "ERESOLVER" | "EUNMATCHEDRESOLVER" | "EMISSINGPOINTER" | "EINVALIDPOINTER";
Expand Down