elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.64k stars 8.23k forks source link

[ResponseOps][Alerting] Rule and action's form errors are not typed correctly #194026

Open cnasikas opened 1 month ago

cnasikas commented 1 month ago

The alerting framework uses and passes an error object to the rule's and connector's params component to be able the components to show errors and disable their form inputs. The error object is typed as:

export interface IErrorObject {
  [key: string]: string | string[] | IErrorObject;
}

export interface RuleFormParamsErrors {
  [key: string]: string | string[] | RuleFormParamsErrors;
}

This leads to a lot of casting in the code because each component uses only one schema for the errors or the framework does not handle all error schemas. We should have one common error schema across all rule and connector forms. For example:

export interface Error {
  [key: string]: string;
}
elasticmachine commented 1 month ago

Pinging @elastic/response-ops (Team:ResponseOps)