Skip to content

Commit

Permalink
Add empty string validation for Tags and Authors (elastic#101756)
Browse files Browse the repository at this point in the history
  • Loading branch information
machadoum committed Jul 13, 2021
1 parent 2eebe7d commit db13d79
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
FormSchema,
ValidationFunc,
ERROR_CODE,
VALIDATION_TYPES,
} from '../../../../shared_imports';
import { AboutStepRule } from '../../../pages/detection_engine/rules/types';
import { OptionalFieldLabel } from '../optional_field_label';
Expand All @@ -38,6 +39,20 @@ export const schema: FormSchema<AboutStepRule> = {
}
),
labelAppend: OptionalFieldLabel,
validations: [
{
validator: emptyField(
i18n.translate(
'xpack.securitySolution.detectionEngine.createRule.stepAboutRule.authorFieldEmptyError',
{
defaultMessage: 'An author must not be empty',
}
)
),
type: VALIDATION_TYPES.ARRAY_ITEM,
isBlocking: false,
},
],
},
name: {
type: FIELD_TYPES.TEXT,
Expand Down Expand Up @@ -243,6 +258,20 @@ export const schema: FormSchema<AboutStepRule> = {
}
),
labelAppend: OptionalFieldLabel,
validations: [
{
validator: emptyField(
i18n.translate(
'xpack.securitySolution.detectionEngine.createRule.stepAboutRule.tagFieldEmptyError',
{
defaultMessage: 'A tag must not be empty',
}
)
),
type: VALIDATION_TYPES.ARRAY_ITEM,
isBlocking: false,
},
],
},
note: {
type: FIELD_TYPES.TEXTAREA,
Expand Down

0 comments on commit db13d79

Please sign in to comment.