1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

Only validating custom parameters if algorithm has been selected (#2005)

This commit is contained in:
Jamie Hewitt 2023-11-14 16:59:30 +03:00 committed by GitHub
parent b5b3137ea1
commit f39ddf97e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,14 +47,17 @@ const validationMetadata = {
.required('Required') .required('Required')
.isTrue('Please agree to the Terms and Conditions.'), .isTrue('Please agree to the Terms and Conditions.'),
usesConsumerParameters: Yup.boolean(), usesConsumerParameters: Yup.boolean(),
consumerParameters: Yup.array().when('usesConsumerParameters', { consumerParameters: Yup.array().when('type', {
is: true, is: 'algorithm',
then: Yup.array() then: Yup.array().when('usesConsumerParameters', {
.of(Yup.object().shape(validationConsumerParameters)) is: true,
.required('Required'), then: Yup.array()
otherwise: Yup.array() .of(Yup.object().shape(validationConsumerParameters))
.nullable() .required('Required'),
.transform((value) => value || null) otherwise: Yup.array()
.nullable()
.transform((value) => value || null)
})
}) })
} }