From 672a0e563f5d5419784b56bcfc44338f8a5d52df Mon Sep 17 00:00:00 2001 From: YulNaumenko Date: Tue, 26 Oct 2021 12:43:21 -0700 Subject: [PATCH] fixed typecheck --- x-pack/plugins/actions/server/lib/action_executor.test.ts | 5 +---- x-pack/plugins/actions/server/lib/action_executor.ts | 8 ++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/actions/server/lib/action_executor.test.ts b/x-pack/plugins/actions/server/lib/action_executor.test.ts index 549e721ffcdd4..4175649454f71 100644 --- a/x-pack/plugins/actions/server/lib/action_executor.test.ts +++ b/x-pack/plugins/actions/server/lib/action_executor.test.ts @@ -279,9 +279,6 @@ test('throws an error when connector is invalid', async () => { name: 'Test', minimumLicenseRequired: 'basic', validate: { - config: schema.object({ - param1: schema.string(), - }), connector: () => { return 'error'; }, @@ -311,7 +308,7 @@ test('throws an error when connector is invalid', async () => { actionId: '1', status: 'error', retry: false, - message: `error validating action type config: [param1]: expected value of type [string] but got [undefined]`, + message: `error validating action type connector: error`, }); }); diff --git a/x-pack/plugins/actions/server/lib/action_executor.ts b/x-pack/plugins/actions/server/lib/action_executor.ts index 5da4d4c4e6c55..518d4582de2bc 100644 --- a/x-pack/plugins/actions/server/lib/action_executor.ts +++ b/x-pack/plugins/actions/server/lib/action_executor.ts @@ -149,12 +149,12 @@ export class ActionExecutor { let validatedSecrets: Record; try { validatedParams = validateParams(actionType, params); - validatedConfig = validateConfig(actionType, config as Record); - validatedSecrets = validateSecrets(actionType, secrets as Record); + validatedConfig = validateConfig(actionType, config); + validatedSecrets = validateSecrets(actionType, secrets); if (actionType.validate?.connector) { validateConnector(actionType, { - config: config as Record, - secrets: secrets as Record, + config, + secrets, }); } } catch (err) {