Skip to content

Commit

Permalink
add additional validation for meta parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth committed Sep 16, 2020
1 parent f919daa commit 22caf79
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ export const PARAMETERS_DEFINITION: { [key in ParameterName]: ParameterDefinitio
}

const json = JSON.parse(value);
const valuesAreNotString = Object.values(json).some((v) => typeof v !== 'string');

if (Array.isArray(json)) {
return {
Expand All @@ -455,6 +456,15 @@ export const PARAMETERS_DEFINITION: { [key in ParameterName]: ParameterDefinitio
}
),
};
} else if (valuesAreNotString) {
return {
message: i18n.translate(
'xpack.idxMgmt.mappingsEditor.parameters.metaFieldEditorOnlyStringValuesAllowedError',
{
defaultMessage: 'Values must be a string.',
}
),
};
}
},
},
Expand Down

0 comments on commit 22caf79

Please sign in to comment.