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')
.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)
})
})
}