Skip to content

Commit

Permalink
Merge pull request #225 from medfreeman/fix/types
Browse files Browse the repository at this point in the history
feat: add `JSONSchema7` types
fix: fixed strict mode for resolve Options key
  • Loading branch information
Phil Sturgeon authored Jun 7, 2021
2 parents 7a899bc + dab6137 commit f6886ab
Showing 1 changed file with 6 additions and 6 deletions.
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

0 comments on commit f6886ab

Please sign in to comment.