Local modifications to ClusterLabs/Anvil by Alteeve
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 lines
832 B

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;