Skip to content

Conversation

@Shuklax
Copy link

@Shuklax Shuklax commented Dec 25, 2025

What kind of change does this PR introduce?
Bugfix and Refactoring of the schema scope detection logic.

Issue Number:
Closes #2012

Screenshots/videos:
Screenshot 2025-12-25 144249

If relevant, did you update the documentation?
N/A (This change improves the documentation's interactive tools).

Summary
This PR solves a limitation in the JsonEditor where subschemas inside keywords like $defs, definitions, allOf, anyOf, oneOf, and if/then/else were not recognized as interactive "scopes."

The Problem:
Users browsing the documentation (e.g., the Structuring page) could not click on keywords like type or items when they appeared inside a $defs block or a logical combinator. This made the documentation feel disconnected.

The Solution:
I refactored lib/getScopesOfParsedJsonSchema.ts to use a keyword-driven traversal approach. Instead of relying on a restrictive type: object check, it now systematically recurses into Map-based keywords ($defs, properties), Array-based keywords (allOf, anyOf, etc.), and single-subschema keywords (not, if).

Does this PR introduce a breaking change?
No. It is a backwards-compatible improvement to the website's syntax highlighting and interactivity.

Checklist
Please ensure the following tasks are completed before submitting this pull request.

Read, understood, and followed the contributing guidelines.

@Shuklax Shuklax requested a review from a team as a code owner December 25, 2025 09:14
@github-project-automation github-project-automation bot moved this to Ready to review in PR - Triage Group Dec 25, 2025
@github-actions
Copy link

github-actions bot commented Dec 25, 2025

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
website ✅ Ready (View Log) Visit Preview 99d25ea

@codecov
Copy link

codecov bot commented Dec 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (58506bc) to head (99d25ea).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #2029   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           30        30           
  Lines          633       633           
  Branches       196       196           
=========================================
  Hits           633       633           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

Status: Ready to review

Development

Successfully merging this pull request may close these issues.

🐛 Bug: JsonEditor missing interactive scope for $defs and other subschema keywords

1 participant