0

What will be the validation of the following schema using Joi validation? How do we validate nested objects and arrays?

const user = {
        address: {
        contactName: 'Sunny',
        detailAddress: {
            line1: 'Sector: 2/A',
            line2: 'Q. No.: 3-018',
            line3: 'Near Shopping Centre'
        },
        pin: 827001,
        country: 'India'
    },
    cart: [
        {
            id: 'newId',
            count: 2
        }
    ]
};

1 Answers1

0

you have to use Object.keys() this link will help you https://stackoverflow.com/a/36741711/2429434

Mhd Wael Jazmati
  • 636
  • 9
  • 18