-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Summary
A prettified JSON output containing validation errors.
Related topic
Server usage, Command Line Interface (CLI) usage
Request motivation
When there are lots of errors, the output of validation is cryptic and difficult to read. Most of the times I pipe it to jq so that it's prettified. Nevertheless, this could be a feature by default, and it would not affect the output content at all, just its formatting.
It is in some way prettified at the Web UI level, although instead of having JSON format it's bullet points.
One could argue that the formatting is a service or client responsibility, but if it's easy to format it at the service level, and doesn't affect functionality at all, it's only a positive addition.
Use cases
- Programmatic use through HTTP (e.g.,
curl)
Examples
Example output without pjq to handle format:
$ curl --data @16_doc2.json -H "Content-Type: application/json" -X POST "http://localhost:3020/validate"
[{"dataPath":"/@context","errors":["must be object,string,array,null"]},{"dataPath":"/@id","errors":["must match format \"uri\""]}]Output after adding jq to handle format:
$ curl --data @16_doc2.json -H "Content-Type: application/json" -X POST "http://localhost:3020/validate" | jq
[
{
"dataPath": "/@context",
"errors": [
"must be object,string,array,null"
]
},
{
"dataPath": "/@id",
"errors": [
"must match format \"uri\""
]
}
]It also highlights text depending on the platform.
Additional context
No response