Merge pull request #27917 from SimonSchick/feat/joi-global-exist

fix(joi): add global exist function
This commit is contained in:
Ron Buckton
2018-08-08 13:35:02 -07:00
committed by GitHub
2 changed files with 7 additions and 1 deletions

View File

@@ -1122,7 +1122,7 @@ export function ref(key: string, options?: ReferenceOptions): Reference;
export function isRef(ref: any): ref is Reference;
/**
* Get a sub-schema of an existing schema based on a `path` that can be either a string or an array
* Get a sub-schema of an existing schema based on a `path` that can be either a string or an array
* of strings For string values path separator is a dot (`.`)
*/
export function reach(schema: ObjectSchema, path: string): Schema;
@@ -1189,6 +1189,11 @@ export function not(values: any[]): Schema;
*/
export function required(): Schema;
/**
* Alias of `required`.
*/
export function exist(): Schema;
/**
* 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.
*/

View File

@@ -1110,6 +1110,7 @@ schema = Joi.not(x, x);
schema = Joi.not([x, x, x]);
schema = Joi.required();
schema = Joi.exist();
schema = Joi.optional();
schema = Joi.forbidden();
schema = Joi.strip();