Skip to content

Incomplete validation message #557

@gagle

Description

@gagle

I don't know very well if this issue should be posted in the hapi or joi repos...

Given the following payload schema:

joi.object().keys({
  a: joi.object().keys({
    c: joi.number()
  }),
  b: joi.object().keys({
    c: joi.number()
  })
})

And the given value:

{
  "a": {},
  "b": {}
}

The error message is:

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "c is required. c is required",
  "validation": {
    "source": "payload",
    "keys": ["a.c", "b.c"]
  }
}

As you can see, the message has an ambiguous meaning. This should be: "a.c is required. b.c is required".

Metadata

Metadata

Assignees

Labels

breaking changesChange that can breaking existing codebugBug or defect

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions