Is it possible to do highly user-centric JSON Schema validation? #717
Replies: 2 comments 2 replies
-
Personally, I think that's some of the better output I've seen. Each error gives you:
Most tools won't give you these data points, and they're pretty important. Granted, it doesn't say why it failed... It could use some error messages. That aside, there are a few things to conisder. First, the spec-defined output formats are recommended, not required. They're still somewhat in development. In fact, for the next version they're changing them and we're removing them and giving them their own spec. Check out https://json-everything.net/json-schema to see what the next generation output should look like. Also, bear in mind that this output was originally intended to be read by machines and potentially translated into something more human-friendly by a consuming application. (I think that last sentence is really the answer to the subject question.) Second, collecting annotations is also a recommendation, not a requirement. Sadly, few implementations actually support it. |
Beta Was this translation helpful? Give feedback.
-
Hi everyone! Do you know about https://github.com/atlassian/better-ajv-errors? This ajv complementary tool does a pretty good job with error reporting. |
Beta Was this translation helpful? Give feedback.
-
The purist in me would like to do OSV record correctness checks as JSON Schema validation as much as possible, however the main problem I'm seeing with this approach is you're completely at the mercy of the validation tooling used for the user experience.
I'm exploring https://pkg.go.dev/github.com/santhosh-tekuri/jsonschema/v5, which seems pretty decent, but even that spits out:
In the spirit of 1. Focus on the user and all else will follow I can't in good conscience subject OSV's record provider users to this sort of user experience.
I had thought that maybe judicious use of
title
and/ordescription
in sub-schemas would help, and maybe it does (I'm finding the documentation on validation about as difficult to understand as the validation output) but I think it also requires the validation tooling to do the right thing with the annotations, and it's not looking like relying on that to be the case universally is a winning strategy for usability.Beta Was this translation helpful? Give feedback.
All reactions