strapi/packages/core/content-releases/shared/validation-schemas.ts

17 lines
467 B
TypeScript
Raw Normal View History

import * as yup from 'yup';
export const RELEASE_SCHEMA = yup
.object()
.shape({
name: yup.string().trim().required(),
// scheduledAt is a date, but we always receive strings from the client
scheduledAt: yup.string().nullable(),
timezone: yup.string().when('scheduledAt', {
is: (scheduledAt: string) => !!scheduledAt,
then: yup.string().required(),
otherwise: yup.string().nullable(),
}),
})
.required()
.noUnknown();