Skip to content

[Feature request]: Prettified validation output #85

@M-casado

Description

@M-casado

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions