Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Event Log] Add missing import statement to schema generator template #111955

Merged
merged 1 commit into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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