From 394a7e53e1ba959125a23964dff99bbf7e3a6093 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 18 Oct 2024 06:36:46 +1100 Subject: [PATCH] [8.x] [ES|QL] Fix trailing decimals dropped from client side validation messages (#196570) (#196752) # Backport This will backport the following commits from `main` to `8.x`: - [[ES|QL] Fix trailing decimals dropped from client side validation messages (#196570)](https://github.com/elastic/kibana/pull/196570) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Quynh Nguyen (Quinn) <43350163+qn895@users.noreply.github.com> --- .../src/validation/__tests__/functions.test.ts | 2 +- .../src/validation/validation.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/kbn-esql-validation-autocomplete/src/validation/__tests__/functions.test.ts b/packages/kbn-esql-validation-autocomplete/src/validation/__tests__/functions.test.ts index 9cf211315757e..85a6fadcc8f5c 100644 --- a/packages/kbn-esql-validation-autocomplete/src/validation/__tests__/functions.test.ts +++ b/packages/kbn-esql-validation-autocomplete/src/validation/__tests__/functions.test.ts @@ -260,7 +260,7 @@ describe('function validation', () => { // date await expectErrors('FROM a_index | EVAL TEST(NOW())', []); await expectErrors('FROM a_index | EVAL TEST(1.)', [ - 'Argument of [test] must be [date], found value [1] type [decimal]', + 'Argument of [test] must be [date], found value [1.] type [decimal]', ]); }); }); diff --git a/packages/kbn-esql-validation-autocomplete/src/validation/validation.ts b/packages/kbn-esql-validation-autocomplete/src/validation/validation.ts index 23508eeedd234..2790a8a14a3b1 100644 --- a/packages/kbn-esql-validation-autocomplete/src/validation/validation.ts +++ b/packages/kbn-esql-validation-autocomplete/src/validation/validation.ts @@ -112,7 +112,7 @@ function validateFunctionLiteralArg( values: { name: astFunction.name, argType: argDef.type as string, - value: typeof actualArg.value === 'number' ? actualArg.value : String(actualArg.value), + value: actualArg.text, givenType: actualArg.literalType, }, locations: actualArg.location,