google / google/jsonschema-go

Proposal: Validate: rich error reporting

Open
#53 3 comments 8 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
478
Forks
37
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
When I validate the schema, I get an opaque error which I cannot action. As an example, I'd like to get a jsonpath to the offending node, so that I'd be able to present it to the user.

**Describe the solution you'd like**
Expose an `Error/ValidationError/other` struct which I would be able to cast the error to via `errors.As()` and get the JSONPath to the offending node of the document, as well as the JSONPath to the Schema node(s).

Getting a pointer to the exact Schema/object node would be the easiest way to inspect the nodes, but it has its own set of problems.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.