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
|
@ -6,8 +6,9 @@
|
|||
*/
|
||||
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { TRANSFORM_STATE } from '../constants';
|
||||
import { isRuntimeField } from '../shared_imports';
|
||||
|
||||
export const transformIdsSchema = schema.arrayOf(
|
||||
schema.object({
|
||||
|
@ -57,26 +58,17 @@ export interface CommonResponseStatusSchema {
|
|||
}
|
||||
|
||||
export const runtimeMappingsSchema = schema.maybe(
|
||||
schema.recordOf(
|
||||
schema.string(),
|
||||
schema.object({
|
||||
type: schema.oneOf([
|
||||
schema.literal('keyword'),
|
||||
schema.literal('long'),
|
||||
schema.literal('double'),
|
||||
schema.literal('date'),
|
||||
schema.literal('ip'),
|
||||
schema.literal('boolean'),
|
||||
schema.literal('geo_point'),
|
||||
]),
|
||||
script: schema.maybe(
|
||||
schema.oneOf([
|
||||
schema.string(),
|
||||
schema.object({
|
||||
source: schema.string(),
|
||||
}),
|
||||
])
|
||||
),
|
||||
})
|
||||
schema.object(
|
||||
{},
|
||||
{
|
||||
unknowns: 'allow',
|
||||
validate: (v: object) => {
|
||||
if (Object.values(v).some((o) => !isRuntimeField(o))) {
|
||||
return i18n.translate('xpack.transform.invalidRuntimeFieldMessage', {
|
||||
defaultMessage: 'Invalid runtime field',
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
|
|
|
@ -11,6 +11,7 @@ export {
|
|||
isPopulatedObject,
|
||||
isRuntimeMappings,
|
||||
patternValidator,
|
||||
isRuntimeField,
|
||||
} from '../../ml/common';
|
||||
|
||||
export { RUNTIME_FIELD_TYPES } from '../../../../src/plugins/data/common';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue