const schema = yup.object().shape({
name: yup.string().required('Bu alan zorunludur'),
email: yup.string('Doğru bir email format değildir').email().required('Bu alan zorunludur'),
phone: yup
.number('Doğru bir telefon numara format değildir')
.positive()
.transform((v, o) => (o === '' ? null : v))
.nullable()
.required('Bu alan zorunludur'),
topic: yup.string().required('Bu alan zorunludur'),
subject: yup.string().required('Bu alan zorunludur'),
description: yup.string().required('Bu alan zorunludur'),
poll_options: yup.array().required('Bu Alan Zorunludur'),
password: yup
.string()
.matches(
/^(?=.*[a-zA-Z])(?=.*[0-9])(?=.{8,})/,
'Parolanız en az 7 karakter, harf ve rakam içermelidir.',
)
.required('Bu Alan Zorunludur'),
passwordConfirmation: yup.string().oneOf(
[yup.ref('password'), null],
'Passwords must match',
),
consentDate: yup.date()
.nullable()
.transform((curr, orig) => orig === '' ? null : curr)
.required('Bu Alan Zorunludur'),
customer_mail_server: yup.string().url().required('Bu Alan Zorunludur'),
accept_terms: yup
.boolean()
.required('The terms and conditions must be accepted.')
.oneOf([true], 'Gizlilik politikası kabul etmesi zorunludur.'),
});
Last active
November 10, 2021 09:38
-
-
Save choyan/2a6a868453b9346f9e25991d5ff57e4e to your computer and use it in GitHub Desktop.
Yup schema definitions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment