Skip to content

feat(editor): enhance interactive JSON schema validation errors#354

Open
itvi-1234 wants to merge 3 commits into
ioflux-org:mainfrom
itvi-1234:feature/clickable-validation-errors
Open

feat(editor): enhance interactive JSON schema validation errors#354
itvi-1234 wants to merge 3 commits into
ioflux-org:mainfrom
itvi-1234:feature/clickable-validation-errors

Conversation

@itvi-1234

@itvi-1234 itvi-1234 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

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

  • Detailed Validation Reporting: Upgraded @hyperjump/json-schema execution to use the "BASIC" output format, successfully exposing the exact rule and JSON pointer path of schema violations.
  • Interactive Error Overlay: When validation fails, a sleek backdrop-blur-sm overlay appears over the graph visualization panel displaying a list of errors.
  • Click-to-Locate Functionality:
    • Reused the existing AST calculation engine (getHighlightedNodeRangeFromPath) to sync the editor with validation errors.
    • Clicking an error seamlessly scrolls the Monaco Editor to the exact line/column and highlights it.
    • Added active state tracking: Clicking an error retains its highlighted background in the error list (even on hover-out), providing clear context of the currently selected error.
  • Contextual Documentation Links:
    • Implemented an intelligent mapping system (getKeywordDocLink) that reads the failed Hyperjump keyword (e.g. maxLength, enum) and provides a direct target="_blank" link to the relevant section of the official Understanding JSON Schema documentation.
    • Ensures users not only know where they failed, but why and how to fix it.

Technical Changes

  • Modified MonacoEditor.tsx to handle the new SchemaValidationError type containing path and docLink.
  • Replaced the bottom status bar error text with a top-level error count and informative links.

Testing Instructions

  1. Open the studio editor and input an invalid schema (e.g., set "type": "int" instead of "integer").
  2. Observe the blurred overlay appearing with the error list.
  3. Hover over an error to see the text turn blue (indicating interactivity).
  4. Click the error—the editor should instantly scroll to highlight the offending line, and the list item should remain highlighted gray.
  5. Click the external link icon (<BsBoxArrowUpRight>) to confirm it opens the correct Official JSON Schema documentation page.

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Preview Deployed!

Item Status
Latest Deploy Visit Preview
Environment Preview (PR-354)
Action View Logs

Last updated at 2026-06-27T18:45:23Z

@itvi-1234

itvi-1234 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

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 -

image

Preview -

image

@AgniveshChaubey AgniveshChaubey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

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 Schema related error, not for JSON syntax 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.

Screenshot 2026-06-21 221451

Signed-off-by: itvi-1234 <rjsumit71@gmail.com>
@itvi-1234 itvi-1234 force-pushed the feature/clickable-validation-errors branch from 81fd854 to a8366ed Compare June 27, 2026 12:34
Signed-off-by: itvi-1234 <rjsumit71@gmail.com>
Signed-off-by: itvi-1234 <rjsumit71@gmail.com>

@AgniveshChaubey AgniveshChaubey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments. We're definitely moving in the right direction.

];
const SUPPORTED_DIALECTS = ["https://json-schema.org/draft/2020-12/schema"];

const getKeywordDocLink = (keywordLabel: string) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possibly we can put this function a sepaarte utils file

}
);
unregisterSchema(schemaId);
setMetaSchemaOutputFormat("BASIC");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not remove the comment from here. It is providing an importaent info and might ve very useful in future during debugging.

} catch (err) {
const message = err instanceof Error ? err.message : String(err);

setSchemaValidation({

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

{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)]'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should wrap this into a separate component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validation Error Navigation

2 participants