diff --git a/src/components/Publish/_validation.ts b/src/components/Publish/_validation.ts index c81c77a25..934de8bc9 100644 --- a/src/components/Publish/_validation.ts +++ b/src/components/Publish/_validation.ts @@ -47,14 +47,17 @@ const validationMetadata = { .required('Required') .isTrue('Please agree to the Terms and Conditions.'), usesConsumerParameters: Yup.boolean(), - consumerParameters: Yup.array().when('usesConsumerParameters', { - is: true, - then: Yup.array() - .of(Yup.object().shape(validationConsumerParameters)) - .required('Required'), - otherwise: Yup.array() - .nullable() - .transform((value) => value || null) + consumerParameters: Yup.array().when('type', { + is: 'algorithm', + then: Yup.array().when('usesConsumerParameters', { + is: true, + then: Yup.array() + .of(Yup.object().shape(validationConsumerParameters)) + .required('Required'), + otherwise: Yup.array() + .nullable() + .transform((value) => value || null) + }) }) }