feat(editor): enhance interactive JSON schema validation errors#354
feat(editor): enhance interactive JSON schema validation errors#354itvi-1234 wants to merge 3 commits into
Conversation
Preview Deployed!
Last updated at 2026-06-29T18:05:45Z |
|
Hi @AgniveshChaubey & @jagpreetrahi , COuld you please review the PR whenever you have time ,I think preview is failing , It is not showing all the changes Original one -
Preview -
|
AgniveshChaubey
left a comment
There was a problem hiding this comment.
Actions status looks successful. Will need to check what can be issue here.
Anyways, here are couple of points based on local deployment:
-
right now, the error popup opens up only for
JSON Schemarelated error, not forJSONsyntax errors. Figuring out JSON syntax error can be a bit tricky, but we'll have to somehow cover JSON syntax errors as well. -
I can see clicking the json schema doc button takes us to the official json schema page. But I highly doubt if JSON Schema has a dedicated page for each keyword. Maybe we can use the learnjsonschema.com website in our case, because as of now, it has a dedicated page for keyword of dialect 2020-12.
81fd854 to
a8366ed
Compare
AgniveshChaubey
left a comment
There was a problem hiding this comment.
Left some comments. We're definitely moving in the right direction.
| } | ||
| ); | ||
| unregisterSchema(schemaId); | ||
| setMetaSchemaOutputFormat("BASIC"); |
There was a problem hiding this comment.
Let's not remove the comment from here. It is providing an importaent info and might ve very useful in future during debugging.
There was a problem hiding this comment.
Yes , I have refractored it
| } catch (err) { | ||
| const message = err instanceof Error ? err.message : String(err); | ||
|
|
||
| setSchemaValidation({ |
There was a problem hiding this comment.
Currently, because of this filtering, we're missing important information that should be surfaced to the user. Indeed we're properly tracing and following the error, but when we look at the error message (for example when I put a value of type as objec instead of object), it says some misleadning things ("/type: invalid anyOf", in case of above example). Actually all the repititive errors blocks for the same location contains different meta-validation failures. We need to figure out a way to utilize those error blocks and detrive a meaningful error message for the end user. With quick google search, i found one library under Hyperjump unbrella itself (https://github.com/hyperjump-io/json-schema-errors). We can explore how helpful this can be in our case.
There was a problem hiding this comment.
haven't checked the updated code, but how are we constructing this custom message?
There was a problem hiding this comment.
Hi @AgniveshChaubey ,Here we are using the @hyperjump/json-schema-errors library
It acts as a smart translator. Instead of us manually hacking the output, we just pass the raw validation result to it.
Then,
- It traverses the error tree, understands the context, and correctly identifies the root cause instead of just the symptoms.
- It has built-in handlers for specific keywords. https://github.com/hyperjump-io/json-schema-errors/tree/main/src/error-handlers So, instead of returning an enum failure, it translates the root cause into a clean, human-readable string: https://github.com/hyperjump-io/json-schema-errors/blob/main/src/translations/en-US.js Expected one of 'array', 'boolean', 'integer'...
Also Previously, because Hyperjump outputs a flat list of all meta-validation failures (a chain of errors), multiple errors were being thrown for a single instanceLocation. To prevent the UI from being spammed, we used a manual Set to deduplicate errors by path. The downside of this was that we ended up keeping the top-level generic "symptom" (like invalid anyOf) while accidentally filtering out the actual root cause (the enum failure).
| {schemaValidation.schemaErrors.map((err, i) => ( | ||
| <li | ||
| key={i} | ||
| className={`flex items-center gap-2 pr-2 rounded transition-colors group ${activeErrorIndex === i ? 'bg-[var(--popup-header-bg-color)]' : 'hover:bg-[var(--popup-header-bg-color)]' |
There was a problem hiding this comment.
I think we should wrap this into a separate component.
There was a problem hiding this comment.
yes , I have wrapped it up in a seperate file
Signed-off-by: itvi-1234 <rjsumit71@gmail.com>
e14f156 to
3f86ecd
Compare
|
Hi @AgniveshChaubey , I have addressed all the sugggetions , could you please take a look whenever have some time |



Description
This PR introduces a major upgrade to the JSON Schema validation UX within the Monaco Editor. We have replaced the static error reporting system with an interactive, highly visual overlay that guides users precisely to the source of their schema errors and provides actionable documentation links.
closes #335
Key Features & Improvements
@hyperjump/json-schemaexecution to use the"BASIC"output format, successfully exposing the exact rule and JSON pointer path of schema violations.backdrop-blur-smoverlay appears over the graph visualization panel displaying a list of errors.getHighlightedNodeRangeFromPath) to sync the editor with validation errors.hover-out), providing clear context of the currently selected error.getKeywordDocLink) that reads the failed Hyperjump keyword (e.g.maxLength,enum) and provides a directtarget="_blank"link to the relevant section of the official Understanding JSON Schema documentation.Technical Changes
MonacoEditor.tsxto handle the newSchemaValidationErrortype containingpathanddocLink.Testing Instructions
"type": "int"instead of"integer").<BsBoxArrowUpRight>) to confirm it opens the correct Official JSON Schema documentation page.