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.
portainer/app/react/docker/containers/CreateView/NetworkTab/validation.ts

26 lines
758 B

import { object, SchemaOf, string } from 'yup';
import { Values } from './types';
import { hostnameSchema } from './HostnameField';
import { hostFileSchema } from './HostsFileEntries';
export function validation(): SchemaOf<Values> {
return object({
networkMode: string().default(''),
hostname: hostnameSchema,
domain: string().default(''),
macAddress: string().default(''),
ipv4Address: string().default(''),
ipv6Address: string().default(''),
primaryDns: string().default(''),
secondaryDns: string().default(''),
hostsFileEntries: hostFileSchema,
container: string()
.default('')
.when('network', {
is: 'container',
then: string().required('Container is required'),
}),
});
}