Node.js/Joi

[Node.js] Joi Validation Error with Json Object

brightlightkim 2022. 4. 7. 06:55
 ValidationError: "action" is required

If you see this kind of error when you typed 

it('should be a valid schema', async () => {
      await InputSchema.validateAsync({<Your jSON Object>})
    })

like this, it's because you typed your object in the { } this bracket.

 

To solve this, you should remove  { } bracket

it('should be a valid schema', async () => {
      await InputSchema.validateAsync(<Your jSON Object>)
    })

Then, it will work

'Node.js > Joi' 카테고리의 다른 글

[Node.js] Joi Validation with the array  (0) 2022.04.07