* bump joi to 17.4.0, start adapting stuff * remove custom validation rule, adapt instead * fix error handling * fix error handling again * fix strings type & validation * fix buffers and arrays * fix bytes * fix bytes_size type * update conditional_type error messages in tests * fix duration and map types * first attempt to fix union type error messages * revert conditional type assertions back to master state * fix object type * fix record type * fix stream types * rename test files to match sources * fix union type tests * temporary adapt feature/home usages of Joi * fix lint * adapt test assertion * fix http config schema validation * fix @kbn/test Config class * fix config again * fix reporting schema tests * fix security solution schema * adapt url tests * remove useless comment * remove space * typo * review comments
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
* Side Public License, v 1.
|
|
*/
|
|
|
|
import * as Joi from 'joi';
|
|
import { ByteSizeValue } from '../src/byte_size_value';
|
|
|
|
declare module 'joi' {
|
|
interface BytesSchema extends AnySchema {
|
|
min(limit: number | string | ByteSizeValue): this;
|
|
|
|
max(limit: number | string | ByteSizeValue): this;
|
|
}
|
|
|
|
interface MapSchema extends AnySchema {
|
|
entries(key: AnySchema, value: AnySchema): this;
|
|
}
|
|
|
|
interface RecordSchema extends AnySchema {
|
|
entries(key: AnySchema, value: AnySchema): this;
|
|
}
|
|
|
|
interface ErrorReport {
|
|
// missing from the typedef
|
|
// see https://github.com/sideway/joi/blob/master/lib/errors.js
|
|
local?: Record<string, any>;
|
|
|
|
toString(): string;
|
|
}
|
|
|
|
export type JoiRoot = Joi.Root & {
|
|
bytes: () => BytesSchema;
|
|
duration: () => AnySchema;
|
|
map: () => MapSchema;
|
|
record: () => RecordSchema;
|
|
stream: () => AnySchema;
|
|
};
|
|
}
|