Open vitaliidm opened 2 years ago
Describe the feature: Execute validateMutatedRuleTypeParamsin both update and create methods of rulesClient
validateMutatedRuleTypeParams
update
create
In scope of implementation https://github.com/elastic/kibana/issues/124715 new rule params validation method validateMutatedParams has been added in this PR to rule type params validator.
validateMutatedParams
export interface RuleTypeParamsValidator<Params extends RuleTypeParams> { validate: (object: unknown) => Params; validateMutatedParams?: (mutatedOject: unknown, origObject?: unknown) => Params; }
It gets called during bulk editing of rule, and it executes any required validation of rule parameters during its mutation.
const validatedMutatedAlertTypeParams = validateMutatedRuleTypeParams( validatedAlertTypeParams, rule.attributes.params, ruleType.validate?.params );
To make consistent behaviour within all rulesClient mutate methods, this validation function should be also called in update and create as well
Pinging @elastic/response-ops (Team:ResponseOps)
cc: @XavierM Small enhancement we would like to see in other rulesClient methods to make behaviour same as during bulkEdit. Let me know, if this makes sense
Describe the feature: Execute
validateMutatedRuleTypeParams
in bothupdate
andcreate
methods of rulesClientIn scope of implementation https://github.com/elastic/kibana/issues/124715 new rule params validation method
validateMutatedParams
has been added in this PR to rule type params validator.It gets called during bulk editing of rule, and it executes any required validation of rule parameters during its mutation.
To make consistent behaviour within all rulesClient mutate methods, this validation function should be also called in
update
andcreate
as well