diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index c05367540a..f95fc905a8 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -503,6 +503,18 @@ export interface StringSchema extends AnySchema { max(limit: number, encoding?: string): this; max(limit: Reference, encoding?: string): this; + /** + * Specifies whether the string.max() limit should be used as a truncation. + * @param enabled - optional parameter defaulting to true which allows you to reset the behavior of truncate by providing a falsy value. + */ + truncate(enabled?: boolean): this; + + /** + * Requires the string value to be in a unicode normalized form. If the validation convert option is on (enabled by default), the string will be normalized. + * @param form - The unicode normalization form to use. Valid values: NFC [default], NFD, NFKC, NFKD + */ + normalize(form?: 'NFC' | 'NFD' | 'NFKC' | 'NFKD'): this; + /** * Requires the number to be a credit card number (Using Lunh Algorithm). */ diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts index 939059bdd3..96d91a72b9 100644 --- a/types/joi/joi-tests.ts +++ b/types/joi/joi-tests.ts @@ -773,6 +773,10 @@ strSchema = strSchema.isoDate(); strSchema = strSchema.lowercase(); strSchema = strSchema.uppercase(); strSchema = strSchema.trim(); +strSchema = strSchema.truncate(); +strSchema = strSchema.truncate(false); +strSchema = strSchema.normalize(); +strSchema = strSchema.normalize('NFKC'); namespace common { strSchema = strSchema.allow(x); diff --git a/types/joi/v10/index.d.ts b/types/joi/v10/index.d.ts index 86fdc9271f..372975ed9e 100644 --- a/types/joi/v10/index.d.ts +++ b/types/joi/v10/index.d.ts @@ -501,6 +501,19 @@ export interface StringSchema extends AnySchema { max(limit: number, encoding?: string): this; max(limit: Reference, encoding?: string): this; + + /** + * Specifies whether the string.max() limit should be used as a truncation. + * @param enabled - optional parameter defaulting to true which allows you to reset the behavior of truncate by providing a falsy value. + */ + truncate(enabled?: boolean): this; + + /** + * Requires the string value to be in a unicode normalized form. If the validation convert option is on (enabled by default), the string will be normalized. + * @param form - The unicode normalization form to use. Valid values: NFC [default], NFD, NFKC, NFKD + */ + normalize(form?: 'NFC' | 'NFD' | 'NFKC' | 'NFKD'): this; + /** * Requires the number to be a credit card number (Using Lunh Algorithm). */ diff --git a/types/joi/v10/joi-tests.ts b/types/joi/v10/joi-tests.ts index f83196a983..226abb3a7f 100644 --- a/types/joi/v10/joi-tests.ts +++ b/types/joi/v10/joi-tests.ts @@ -773,6 +773,10 @@ strSchema = strSchema.isoDate(); strSchema = strSchema.lowercase(); strSchema = strSchema.uppercase(); strSchema = strSchema.trim(); +strSchema = strSchema.truncate(); +strSchema = strSchema.truncate(false); +strSchema = strSchema.normalize(); +strSchema = strSchema.normalize('NFKC'); namespace common { strSchema = strSchema.allow(x);