Skip to content

Commit

Permalink
working directory tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonluca committed Apr 21, 2024
1 parent c33ca65 commit 734a4be
Show file tree
Hide file tree
Showing 23 changed files with 539 additions and 48 deletions.
106 changes: 58 additions & 48 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ export class $RefParser<S extends object = JSONSchema, O extends ParserOptions<S
* @param [callback] - An error-first callback. The second parameter is the parsed JSON schema object.
* @returns - The returned promise resolves with the parsed JSON schema object.
*/
public parse(schema: S | string): Promise<S>;
public parse(schema: S | string, callback: SchemaCallback<S>): Promise<void>;
public parse(schema: S | string, options: O): Promise<S>;
public parse(schema: S | string, options: O, callback: SchemaCallback<S>): Promise<void>;
public parse(baseUrl: string, schema: S | string, options: O): Promise<S>;
public parse(baseUrl: string, schema: S | string, options: O, callback: SchemaCallback<S>): Promise<void>;
public parse(schema: S | string | unknown): Promise<S>;
public parse(schema: S | string | unknown, callback: SchemaCallback<S>): Promise<void>;
public parse(schema: S | string | unknown, options: O): Promise<S>;
public parse(schema: S | string | unknown, options: O, callback: SchemaCallback<S>): Promise<void>;
public parse(baseUrl: string, schema: S | string | unknown, options: O): Promise<S>;
public parse(baseUrl: string, schema: S | string | unknown, options: O, callback: SchemaCallback<S>): Promise<void>;
async parse() {
const args = normalizeArgs<S, O>(arguments as any);
let promise;
Expand Down Expand Up @@ -144,29 +144,29 @@ export class $RefParser<S extends object = JSONSchema, O extends ParserOptions<S
}

public static parse<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(

Check warning on line 146 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 146 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 146 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 146 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 146 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 146 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 146 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 146 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 146 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u
schema: S | string,
schema: S | string | unknown,
): Promise<S>;
public static parse<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(

Check warning on line 149 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 149 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 149 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 149 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 149 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 149 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 149 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 149 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 149 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u
schema: S | string,
schema: S | string | unknown,
callback: SchemaCallback<S>,
): Promise<void>;
public static parse<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
schema: S | string,
schema: S | string | unknown,
options: O,
): Promise<S>;
public static parse<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
schema: S | string,
schema: S | string | unknown,
options: O,
callback: SchemaCallback<S>,
): Promise<void>;
public static parse<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
baseUrl: string,
schema: S | string,
schema: S | string | unknown,
options: O,
): Promise<S>;
public static parse<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
baseUrl: string,
schema: S | string,
schema: S | string | unknown,
options: O,
callback: SchemaCallback<S>,
): Promise<void>;
Expand All @@ -188,12 +188,17 @@ export class $RefParser<S extends object = JSONSchema, O extends ParserOptions<S
* @param options (optional)
* @param callback (optional) A callback that will receive a `$Refs` object
*/
public resolve(schema: S | string): Promise<$Refs<S, O>>;
public resolve(schema: S | string, callback: $RefsCallback<S, O>): Promise<void>;
public resolve(schema: S | string, options: O): Promise<$Refs<S, O>>;
public resolve(schema: S | string, options: O, callback: $RefsCallback<S, O>): Promise<void>;
public resolve(baseUrl: string, schema: S | string, options: O): Promise<$Refs<S, O>>;
public resolve(baseUrl: string, schema: S | string, options: O, callback: $RefsCallback<S, O>): Promise<void>;
public resolve(schema: S | string | unknown): Promise<$Refs<S, O>>;
public resolve(schema: S | string | unknown, callback: $RefsCallback<S, O>): Promise<void>;
public resolve(schema: S | string | unknown, options: O): Promise<$Refs<S, O>>;
public resolve(schema: S | string | unknown, options: O, callback: $RefsCallback<S, O>): Promise<void>;
public resolve(baseUrl: string, schema: S | string | unknown, options: O): Promise<$Refs<S, O>>;
public resolve(
baseUrl: string,
schema: S | string | unknown,
options: O,
callback: $RefsCallback<S, O>,
): Promise<void>;
async resolve() {
const args = normalizeArgs<S, O>(arguments);

Expand All @@ -219,29 +224,29 @@ export class $RefParser<S extends object = JSONSchema, O extends ParserOptions<S
* @param callback (optional) A callback that will receive a `$Refs` object
*/
public static resolve<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
schema: S | string,
schema: S | string | unknown,
): Promise<$Refs<S, O>>;
public static resolve<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
schema: S | string,
schema: S | string | unknown,
callback: $RefsCallback<S, O>,
): Promise<void>;
public static resolve<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
schema: S | string,
schema: S | string | unknown,
options: O,
): Promise<$Refs<S, O>>;
public static resolve<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
schema: S | string,
schema: S | string | unknown,
options: O,
callback: $RefsCallback<S, O>,
): Promise<void>;
public static resolve<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
baseUrl: string,
schema: S | string,
schema: S | string | unknown,
options: O,
): Promise<$Refs<S, O>>;
public static resolve<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
baseUrl: string,
schema: S | string,
schema: S | string | unknown,
options: O,
callback: $RefsCallback<S, O>,
): Promise<void>;
Expand All @@ -264,29 +269,29 @@ export class $RefParser<S extends object = JSONSchema, O extends ParserOptions<S
* @param callback (optional) A callback that will receive the bundled schema object
*/
public static bundle<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(

Check warning on line 271 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 271 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 271 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 271 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 271 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 271 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 271 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 271 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 271 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u
schema: S | string,
schema: S | string | unknown,
): Promise<S>;
public static bundle<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(

Check warning on line 274 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 274 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 274 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 274 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 274 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 274 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 274 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 274 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 274 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u
schema: S | string,
schema: S | string | unknown,
callback: SchemaCallback<S>,
): Promise<void>;
public static bundle<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
schema: S | string,
schema: S | string | unknown,
options: O,
): Promise<S>;
public static bundle<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
schema: S | string,
schema: S | string | unknown,
options: O,
callback: SchemaCallback<S>,
): Promise<void>;
public static bundle<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
baseUrl: string,
schema: S | string,
schema: S | string | unknown,
options: O,
): Promise<S>;
public static bundle<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
baseUrl: string,
schema: S | string,
schema: S | string | unknown,
options: O,
callback: SchemaCallback<S>,
): Promise<S>;
Expand All @@ -308,12 +313,12 @@ export class $RefParser<S extends object = JSONSchema, O extends ParserOptions<S
* @param options (optional)
* @param callback (optional) A callback that will receive the bundled schema object
*/
public bundle(schema: S | string): Promise<S>;
public bundle(schema: S | string, callback: SchemaCallback<S>): Promise<void>;
public bundle(schema: S | string, options: O): Promise<S>;
public bundle(schema: S | string, options: O, callback: SchemaCallback<S>): Promise<void>;
public bundle(baseUrl: string, schema: S | string, options: O): Promise<S>;
public bundle(baseUrl: string, schema: S | string, options: O, callback: SchemaCallback<S>): Promise<void>;
public bundle(schema: S | string | unknown): Promise<S>;
public bundle(schema: S | string | unknown, callback: SchemaCallback<S>): Promise<void>;
public bundle(schema: S | string | unknown, options: O): Promise<S>;
public bundle(schema: S | string | unknown, options: O, callback: SchemaCallback<S>): Promise<void>;
public bundle(baseUrl: string, schema: S | string | unknown, options: O): Promise<S>;
public bundle(baseUrl: string, schema: S | string | unknown, options: O, callback: SchemaCallback<S>): Promise<void>;
async bundle() {
const args = normalizeArgs<S, O>(arguments);
try {
Expand All @@ -338,29 +343,29 @@ export class $RefParser<S extends object = JSONSchema, O extends ParserOptions<S
* @param callback (optional) A callback that will receive the dereferenced schema object
*/
public static dereference<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(

Check warning on line 345 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 345 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 345 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 345 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 345 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 345 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 345 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 345 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 345 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u
schema: S | string,
schema: S | string | unknown,
): Promise<S>;
public static dereference<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(

Check warning on line 348 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 348 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 348 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on ubuntu-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 348 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 348 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 348 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on windows-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 348 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node lts/* on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 348 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node 18 on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 348 in lib/index.ts

View workflow job for this annotation

GitHub Actions / Node current on macos-latest

'O' is defined but never used. Allowed unused vars must match /^_/u
schema: S | string,
schema: S | string | unknown,
callback: SchemaCallback<S>,
): Promise<void>;
public static dereference<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
schema: S | string,
schema: S | string | unknown,
options: O,
): Promise<S>;
public static dereference<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
schema: S | string,
schema: S | string | unknown,
options: O,
callback: SchemaCallback<S>,
): Promise<void>;
public static dereference<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
baseUrl: string,
schema: S | string,
schema: S | string | unknown,
options: O,
): Promise<S>;
public static dereference<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>>(
baseUrl: string,
schema: S | string,
schema: S | string | unknown,
options: O,
callback: SchemaCallback<S>,
): Promise<void>;
Expand All @@ -383,12 +388,17 @@ export class $RefParser<S extends object = JSONSchema, O extends ParserOptions<S
* @param options (optional)
* @param callback (optional) A callback that will receive the dereferenced schema object
*/
public dereference(baseUrl: string, schema: S | string, options: O, callback: SchemaCallback<S>): Promise<void>;
public dereference(schema: S | string, options: O, callback: SchemaCallback<S>): Promise<void>;
public dereference(schema: S | string, callback: SchemaCallback<S>): Promise<void>;
public dereference(baseUrl: string, schema: S | string, options: O): Promise<S>;
public dereference(schema: S | string, options: O): Promise<S>;
public dereference(schema: S | string): Promise<S>;
public dereference(
baseUrl: string,
schema: S | string | unknown,
options: O,
callback: SchemaCallback<S>,
): Promise<void>;
public dereference(schema: S | string | unknown, options: O, callback: SchemaCallback<S>): Promise<void>;
public dereference(schema: S | string | unknown, callback: SchemaCallback<S>): Promise<void>;
public dereference(baseUrl: string, schema: S | string | unknown, options: O): Promise<S>;
public dereference(schema: S | string | unknown, options: O): Promise<S>;
public dereference(schema: S | string | unknown): Promise<S>;
async dereference() {
const args = normalizeArgs<S, O>(arguments);

Expand Down
Loading

0 comments on commit 734a4be

Please sign in to comment.