mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
more validation tweaks
This commit is contained in:
parent
a313f39494
commit
c689ce5555
@ -101,8 +101,8 @@ const validationService = {
|
|||||||
valid: Yup.boolean().isTrue().required('File must be valid.')
|
valid: Yup.boolean().isTrue().required('File must be valid.')
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.min(1, (param) => `At least one file is required`)
|
.min(1, (param) => `At least one file is required.`)
|
||||||
.required('Enter a valid URL and click "ADD FILE"'),
|
.required('Enter a valid URL and click ADD FILE.'),
|
||||||
links: Yup.array<{ url: string; valid: boolean }[]>()
|
links: Yup.array<{ url: string; valid: boolean }[]>()
|
||||||
.of(
|
.of(
|
||||||
Yup.object().shape({
|
Yup.object().shape({
|
||||||
@ -119,7 +119,7 @@ const validationService = {
|
|||||||
access: Yup.string()
|
access: Yup.string()
|
||||||
.matches(/compute|download/g)
|
.matches(/compute|download/g)
|
||||||
.required('Required'),
|
.required('Required'),
|
||||||
providerUrl: Yup.string().url().nullable()
|
providerUrl: Yup.string().url().required('Required')
|
||||||
}
|
}
|
||||||
|
|
||||||
const validationPricing = {
|
const validationPricing = {
|
||||||
@ -141,14 +141,17 @@ const validationPricing = {
|
|||||||
.min(0.1, (param) => `Must be more or equal to ${param.min}`)
|
.min(0.1, (param) => `Must be more or equal to ${param.min}`)
|
||||||
.max(10, 'Maximum is 10%')
|
.max(10, 'Maximum is 10%')
|
||||||
.required('Required')
|
.required('Required')
|
||||||
.nullable()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: make Yup.SchemaOf<FormPublishData> work, requires conditional validation
|
||||||
|
// of all the custom docker image stuff.
|
||||||
// export const validationSchema: Yup.SchemaOf<FormPublishData> =
|
// export const validationSchema: Yup.SchemaOf<FormPublishData> =
|
||||||
export const validationSchema: Yup.SchemaOf<any> = Yup.object().shape({
|
export const validationSchema: Yup.SchemaOf<any> = Yup.object().shape({
|
||||||
|
user: Yup.object().shape({
|
||||||
stepCurrent: Yup.number(),
|
stepCurrent: Yup.number(),
|
||||||
chainId: Yup.number(),
|
chainId: Yup.number().required('Required'),
|
||||||
accountId: Yup.string(),
|
accountId: Yup.string().required('Required')
|
||||||
|
}),
|
||||||
metadata: Yup.object().shape(validationMetadata),
|
metadata: Yup.object().shape(validationMetadata),
|
||||||
services: Yup.array().of(Yup.object().shape(validationService)),
|
services: Yup.array().of(Yup.object().shape(validationService)),
|
||||||
pricing: Yup.object().shape(validationPricing)
|
pricing: Yup.object().shape(validationPricing)
|
||||||
|
Loading…
Reference in New Issue
Block a user