Object
Object
You can use object
method to validate an object
. Below is a basic example:
import { object } from '@resourge/schema';
object({
name: string().required(),
age: number().min(18).required()
})
// with message
object({
name: string().required(),
age: number().min(18).required()
}, 'Custom error message')