mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
* Fix validations not handling extra things like params or lang
* Add translations
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit f8d932f70a
)
This commit is contained in:
parent
27362eb699
commit
d5a9f0b375
8 changed files with 77 additions and 39 deletions
|
@ -14,11 +14,12 @@ export function isRuntimeField(arg: unknown): arg is estypes.MappingRuntimeField
|
|||
return (
|
||||
((isPopulatedObject(arg, ['type']) && Object.keys(arg).length === 1) ||
|
||||
(isPopulatedObject(arg, ['type', 'script']) &&
|
||||
Object.keys(arg).length === 2 &&
|
||||
// Can be a string
|
||||
(typeof arg.script === 'string' ||
|
||||
(isPopulatedObject(arg.script, ['source']) &&
|
||||
Object.keys(arg.script).length === 1 &&
|
||||
typeof arg.script.source === 'string')))) &&
|
||||
// Can be InlineScript
|
||||
(isPopulatedObject(arg.script, ['source']) && typeof arg.script.source === 'string') ||
|
||||
// Can be StoredScriptId
|
||||
(isPopulatedObject(arg.script, ['id']) && typeof arg.script.id === 'string')))) &&
|
||||
RUNTIME_FIELD_TYPES.includes(arg.type as RuntimeType)
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue