Add missing import statement to schema generator template (#111955)

This commit is contained in:
Dmitry Shevchenko 2021-09-13 18:39:52 +02:00 committed by GitHub
parent daf9cd55b1
commit 2bdb3131df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -149,10 +149,6 @@ function ecsDate() {
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$/;
function validateDate(isoDate: string) {
@ -160,6 +156,10 @@ function validateDate(isoDate: string) {
return 'string is not a valid ISO date: ' + isoDate;
}
function ecsVersion() {
return schema.maybe(schema.string({ validate: validateVersion }));
}
function validateVersion(version: string) {
if (semver.valid(version)) return;
return 'string is not a valid version: ' + version;

View file

@ -283,6 +283,7 @@ const SchemaFileTemplate = `
// the event log
import { schema, TypeOf } from '@kbn/config-schema';
import semver from 'semver';
type DeepWriteable<T> = { -readonly [P in keyof T]: DeepWriteable<T[P]> };
type DeepPartial<T> = {