Add missing import statement to schema generator template (#111955)
This commit is contained in:
parent
daf9cd55b1
commit
2bdb3131df
2 changed files with 5 additions and 4 deletions
|
@ -149,10 +149,6 @@ function ecsDate() {
|
||||||
return schema.maybe(schema.string({ validate: validateDate }));
|
return schema.maybe(schema.string({ validate: validateDate }));
|
||||||
}
|
}
|
||||||
|
|
||||||
function ecsVersion() {
|
|
||||||
return schema.maybe(schema.string({ validate: validateVersion }));
|
|
||||||
}
|
|
||||||
|
|
||||||
const ISO_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
|
const ISO_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
|
||||||
|
|
||||||
function validateDate(isoDate: string) {
|
function validateDate(isoDate: string) {
|
||||||
|
@ -160,6 +156,10 @@ function validateDate(isoDate: string) {
|
||||||
return 'string is not a valid ISO date: ' + isoDate;
|
return 'string is not a valid ISO date: ' + isoDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ecsVersion() {
|
||||||
|
return schema.maybe(schema.string({ validate: validateVersion }));
|
||||||
|
}
|
||||||
|
|
||||||
function validateVersion(version: string) {
|
function validateVersion(version: string) {
|
||||||
if (semver.valid(version)) return;
|
if (semver.valid(version)) return;
|
||||||
return 'string is not a valid version: ' + version;
|
return 'string is not a valid version: ' + version;
|
||||||
|
|
|
@ -283,6 +283,7 @@ const SchemaFileTemplate = `
|
||||||
// the event log
|
// the event log
|
||||||
|
|
||||||
import { schema, TypeOf } from '@kbn/config-schema';
|
import { schema, TypeOf } from '@kbn/config-schema';
|
||||||
|
import semver from 'semver';
|
||||||
|
|
||||||
type DeepWriteable<T> = { -readonly [P in keyof T]: DeepWriteable<T[P]> };
|
type DeepWriteable<T> = { -readonly [P in keyof T]: DeepWriteable<T[P]> };
|
||||||
type DeepPartial<T> = {
|
type DeepPartial<T> = {
|
||||||
|
|
Loading…
Reference in a new issue