From 8220481ec1011ce472f911f28fb1963f740cee2f Mon Sep 17 00:00:00 2001 From: Young Rok Kim Date: Mon, 21 Aug 2017 03:32:55 +0900 Subject: [PATCH] joi: add missing api .exist() --- types/joi/index.d.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index 43ba612f6f..1d03f64ca8 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -227,6 +227,7 @@ export interface AnySchema { * Marks a key as required which will not allow undefined as value. All keys are optional by default. */ required(): this; + exist(): this; /** * Marks a key as optional which will allow undefined as values. Used to annotate the schema for readability as all keys are optional by default. @@ -371,11 +372,15 @@ export interface AnySchema { export interface Description { type?: Types | string; + label?: string; + description?: string; flags?: object; notes?: string[]; tags?: string[]; - meta?: any; - example?: any; + meta?: any[]; + example?: any[]; + valids?: any[]; + invalids?: any[]; unit?: string; options?: ValidationOptions; [key: string]: any; @@ -865,7 +870,7 @@ export interface Reference extends AnySchema { export interface Rules

{ name: string; - params?: { [key in keyof P]: SchemaLike; }; + params?: ObjectSchema | { [key in keyof P]: SchemaLike; }; setup?(this: Schema, params: P): Schema | void; validate?(this: Schema, params: P, value: any, state: State, options: ValidationOptions): Err | R; description?: string | ((params: P) => string); @@ -875,6 +880,7 @@ export interface Extension { name: string; base?: Schema; language?: LanguageOptions; + coerce?(this: Schema, value: any, state: State, options: ValidationOptions): Err | R; pre?(this: Schema, value: any, state: State, options: ValidationOptions): Err | R; describe?(this: Schema, description: Description): Description; rules?: Rules[];