[ML] Fix runtime mappings for runtimeField with optional script field (#91634)

This commit is contained in:
Quynh Nguyen 2021-02-17 09:40:49 -06:00 committed by GitHub
parent 9eb69cf71a
commit 7a75e19c3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 8 deletions

View file

@ -113,7 +113,7 @@ type RuntimeType = typeof RUNTIME_FIELD_TYPES[number];
export interface RuntimeField {
type: RuntimeType;
script:
script?:
| string
| {
source: string;

View file

@ -76,12 +76,14 @@ export const runtimeMappingsSchema = schema.maybe(
schema.literal('ip'),
schema.literal('boolean'),
]),
script: schema.oneOf([
schema.string(),
schema.object({
source: schema.string(),
}),
]),
script: schema.maybe(
schema.oneOf([
schema.string(),
schema.object({
source: schema.string(),
}),
])
),
})
)
);

View file

@ -40,7 +40,7 @@ type RuntimeType = typeof RUNTIME_FIELD_TYPES[number];
export interface RuntimeField {
type: RuntimeType;
script:
script?:
| string
| {
source: string;