Skip to content

Commit

Permalink
Add missing import statement to schema generator template (elastic#11…
Browse files Browse the repository at this point in the history
  • Loading branch information
xcrzx authored Sep 13, 2021
1 parent daf9cd5 commit 2bdb313
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions x-pack/plugins/event_log/generated/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,17 @@ 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) {
if (ISO_DATE_PATTERN.test(isoDate)) return;
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;
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/event_log/scripts/create_schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -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> = {
Expand Down

0 comments on commit 2bdb313

Please sign in to comment.