diff --git a/packages/core/admin/ee/server/validation/review-workflows.js b/packages/core/admin/ee/server/validation/review-workflows.js index e896c84d0e..e374cab291 100644 --- a/packages/core/admin/ee/server/validation/review-workflows.js +++ b/packages/core/admin/ee/server/validation/review-workflows.js @@ -8,12 +8,6 @@ const stageObject = yup.object().shape({ color: yup.string().matches(/^#(?:[0-9a-fA-F]{3}){1,2}$/i), // hex color }); -const validateUpdateStagesSchema = yup - .array() - .of(stageObject) - .required() - .max(200, 'You can not create more than 200 stages'); - const validateUpdateStageOnEntity = yup .object() .shape({ @@ -23,20 +17,25 @@ const validateUpdateStageOnEntity = yup const validateWorkflowCreateSchema = yup.object().shape({ name: yup.string().max(255).required(), - stages: yup.array().of(stageObject).min(1, 'Can not create a workflow without stages').required(), + stages: yup + .array() + .of(stageObject) + .min(1, 'Can not create a workflow without stages') + .max(200, 'Can not have more than 200 stages') + .required(), }); const validateWorkflowUpdateSchema = yup.object().shape({ name: yup.string().max(255), - stages: yup.array().of(stageObject), + stages: yup + .array() + .of(stageObject) + .min(1, 'Can not create a workflow without stages') + .max(200, 'Can not have more than 200 stages'), }); module.exports = { validateWorkflowCreate: validateYupSchema(validateWorkflowCreateSchema), - validateUpdateStages: validateYupSchema(validateUpdateStagesSchema, { - strict: false, - stripUnknown: true, - }), validateUpdateStageOnEntity: validateYupSchema(validateUpdateStageOnEntity), validateWorkflowUpdate: validateYupSchema(validateWorkflowUpdateSchema), };