2023-07-10 15:56:12 +00:00
|
|
|
import { bool, number, object, SchemaOf, string } from 'yup';
|
|
|
|
|
|
|
|
import { Values } from './types';
|
|
|
|
|
2023-10-19 11:45:50 +00:00
|
|
|
export function validation(rateLimitExceeded: boolean): SchemaOf<Values> {
|
2023-07-10 15:56:12 +00:00
|
|
|
return object({
|
|
|
|
image: string().required('Image is required'),
|
|
|
|
registryId: number().default(0),
|
|
|
|
useRegistry: bool().default(false),
|
2023-10-19 11:45:50 +00:00
|
|
|
}).test('rate-limits', 'Rate limit exceeded', () => !rateLimitExceeded);
|
2023-07-10 15:56:12 +00:00
|
|
|
}
|