hapijs / hapijs/joi

How to access what was `validationResult.details` in latest versions

Open
#2,507 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
21.2k
Forks
1.5k
Avg merge
4h 57m
Merged PRs (30d)
14

Description

#### Support plan

* *is this issue currently blocking your project?* (yes):
* *is this issue affecting a production system?* (no):

#### Context

* *node version*: 12.14.1
* *module version*: 17.3.0
* *environment* (e.g. node, browser, native): node
* *used with* (e.g. hapi application, another framework, standalone, ...): standalone within an express app
* *any other relevant information*:

#### How can we help?

Previously there was a properly `details` where you could get the path to an error. This is important for us because we need to tell the user where in the document tree the error occurred rather than making them hunt for which leaf node had the issue.

```
error.details.map((detail) => {
return `Error in node ${detail.path[0]}, child ${detail.path[1]}`
}
```

Using joi 16+ I only get `value` and `error` back. Is there a way to retrieve the full tree to present this information?

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Start by reviewing the Joi 16+ validation API and the change from the earlier validationResult.details behavior, using the reported Node 12.14.1 and module 17.3.0 setup. Done means identifying the supported way to access error paths, or confirming that the information is unavailable.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.