Skip to content

Commit

Permalink
switched Validator types to interfaces; made ValidatorContext a POJO …
Browse files Browse the repository at this point in the history
…not of type Pojo
  • Loading branch information
jtlapp authored and koskimas committed Jan 8, 2018
1 parent f655993 commit a159e16
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions typings/objection/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,15 @@ declare namespace Objection {
skipValidation?: boolean;
}

export interface ValidatorContext extends Pojo { }
export interface ValidatorContext {
[key: string]: any;
}

export type ValidatorArgs = {
ctx: ValidatorContext,
model: Model,
json: Pojo,
options: ModelOptions
export interface ValidatorArgs {
ctx: ValidatorContext;
model: Model;
json: Pojo;
options: ModelOptions;
}

export class Validator {
Expand All @@ -111,10 +113,10 @@ declare namespace Objection {
afterValidate(args: ValidatorArgs): void;
}

export type AjvConfig = {
export interface AjvConfig {
onCreateAjv(ajv: ajv.Ajv): void;
options?: ajv.Options;
};
}

export class AjvValidator extends Validator {
constructor(config: AjvConfig);
Expand Down

0 comments on commit a159e16

Please sign in to comment.