parent
2e2450b8b9
commit
13994880ac
1 changed files with 29 additions and 0 deletions
@ -0,0 +1,29 @@ |
|||||||
|
import * as yup from 'yup'; |
||||||
|
|
||||||
|
import buildYupDynamicObject from '../../lib/buildYupDynamicObject'; |
||||||
|
|
||||||
|
const fileLocationSchema = yup.object({ active: yup.boolean().required() }); |
||||||
|
|
||||||
|
const fileLocationAnvilSchema = yup.lazy((anvils) => |
||||||
|
yup.object(buildYupDynamicObject(anvils, fileLocationSchema)), |
||||||
|
); |
||||||
|
|
||||||
|
const fileLocationDrHostSchema = yup.lazy((drHosts) => |
||||||
|
yup.object(buildYupDynamicObject(drHosts, fileLocationSchema)), |
||||||
|
); |
||||||
|
|
||||||
|
const fileSchema = yup.object({ |
||||||
|
locations: yup.object({ |
||||||
|
anvils: fileLocationAnvilSchema, |
||||||
|
drHosts: fileLocationDrHostSchema, |
||||||
|
}), |
||||||
|
name: yup.string().required(), |
||||||
|
type: yup.string().oneOf(['iso', 'other', 'script']), |
||||||
|
uuid: yup.string().uuid().required(), |
||||||
|
}); |
||||||
|
|
||||||
|
const fileListSchema = yup.lazy((files) => |
||||||
|
yup.object(buildYupDynamicObject(files, fileSchema)), |
||||||
|
); |
||||||
|
|
||||||
|
export default fileListSchema; |
Loading…
Reference in new issue