diff --git a/joi/joi-tests.ts b/joi/joi-tests.ts index 9e631e3e37..c8c05bf872 100644 --- a/joi/joi-tests.ts +++ b/joi/joi-tests.ts @@ -579,7 +579,9 @@ objSchema = objSchema.without(str, strArr); objSchema = objSchema.rename(str, str); objSchema = objSchema.rename(str, str, renOpts); +objSchema = objSchema.assert(str, schema); objSchema = objSchema.assert(str, schema, str); +objSchema = objSchema.assert(ref, schema); objSchema = objSchema.assert(ref, schema, str); objSchema = objSchema.unknown(); diff --git a/joi/joi.d.ts b/joi/joi.d.ts index 2e230dcb86..c774b36ab4 100644 --- a/joi/joi.d.ts +++ b/joi/joi.d.ts @@ -1,6 +1,6 @@ // Type definitions for joi v4.6.0 // Project: https://github.com/spumko/joi -// Definitions by: Bart van der Schoor , Laurence Dougal Myers , Christopher Glantschnig +// Definitions by: Bart van der Schoor , Laurence Dougal Myers , Christopher Glantschnig , David Broder-Rodgers // Definitions: https://github.com/borisyankov/DefinitelyTyped // TODO express type of Schema in a type-parameter (.default, .valid, .example etc) @@ -584,8 +584,8 @@ declare module 'joi' { /** * Verifies an assertion where. */ - assert(ref: string, schema: Schema, message: string): ObjectSchema; - assert(ref: Reference, schema: Schema, message: string): ObjectSchema; + assert(ref: string, schema: Schema, message?: string): ObjectSchema; + assert(ref: Reference, schema: Schema, message?: string): ObjectSchema; /** * Overrides the handling of unknown keys for the scope of the current object only (does not apply to children).