Skip to content

Commit

Permalink
🐛 Migration wave name is min 3/max 20 chars only when provided (#1156)
Browse files Browse the repository at this point in the history
Resolves https://issues.redhat.com/browse/MTA-906

---------
Co-authored-by: Ian Bolton <[email protected]>
  • Loading branch information
gildub committed Jul 19, 2023
1 parent 0b20ab3 commit 34e68b7
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,21 @@ export const WaveForm: React.FC<WaveFormProps> = ({
const validationSchema: yup.SchemaOf<WaveFormValues> = yup.object().shape({
name: yup
.string()
.trim()
.min(3, t("validation.minLength", { length: 3 }))
.max(120, t("validation.maxLength", { length: 120 })),
.defined()
.test(
"min-char-check",
"Name is invalid. The name must be between 3 and 120 characters ",
(value) => {
if (!!value) {
const schema = yup
.string()
.min(3, t("validation.minLength", { length: 3 }))
.max(120, t("validation.maxLength", { length: 120 }));
return schema.isValidSync(value);
}
return true;
}
),
startDateStr: yup
.string()
.required(t("validation.required"))
Expand Down

0 comments on commit 34e68b7

Please sign in to comment.