Skip to content

fix – fixes incomplete scope generation in getScopesOfParsedJsonSche…#2177

Open
Adityakk9031 wants to merge 2 commits intojson-schema-org:mainfrom
Adityakk9031:#2174
Open

fix – fixes incomplete scope generation in getScopesOfParsedJsonSche…#2177
Adityakk9031 wants to merge 2 commits intojson-schema-org:mainfrom
Adityakk9031:#2174

Conversation

@Adityakk9031
Copy link
Contributor

@Adityakk9031 Adityakk9031 commented Jan 28, 2026

What kind of change does this PR introduce?

Bug fix – fixes incomplete scope generation in getScopesOfParsedJsonSchema, which previously ignored important JSON Schema constructs.

Issue Number

Closes #2174

Summary

Previously, the getScopesOfParsedJsonSchema utility only handled shallow schemas with type: 'object' or type: 'array', and completely ignored combinators (oneOf, anyOf, allOf), definitions (definitions, $defs), references ($ref), conditional schemas, and several other JSON Schema keywords. This led to incomplete scope generation and broke clickable documentation links and syntax highlighting in the JSON Editor for complex, real‑world schemas.

This PR rewrites the function to recursively traverse all relevant JSON Schema constructs across multiple JSON Schema drafts, ensuring that scopes are generated for deeply nested and combined schemas used in production.

Changes

  • Removed the narrow type-based conditional logic that restricted traversal to only type: 'object' or type: 'array'.
  • Introduced helper functions for clearer structure:
    • processObjectProperties – handles property-like keywords such as properties, definitions, $defs, and related object schema fields.
    • processSchemasArray – handles arrays of schemas for oneOf, anyOf, allOf, tuple items, and similar patterns.
  • Added comprehensive support for more than 14 JSON Schema keywords, including:
    • Combinators: oneOf, anyOf, allOf, not.
    • Definitions: definitions (Draft 7) and $defs (Draft 2019‑09+).
    • Property schemas: additionalProperties, unevaluatedProperties, propertyNames.
    • Array schemas: tuple validation (items as array), prefixItems, additionalItems, unevaluatedItems, contains.
    • Conditional schemas: if / then / else, dependentSchemas.
  • Preserved compatibility with existing handling of properties, patternProperties, and single‑schema items.

Screenshots / Videos

N/A – this is an internal utility function change.

To verify manually:

  • Open the JSON Editor with a complex schema that includes oneOf, definitions, and nested combinators.
  • Confirm that clickable documentation links are available for schema keywords inside combinators, definitions, and other nested constructs.
  • Verify that syntax highlighting appears correctly throughout the entire schema tree.

Does this PR introduce a breaking change?

No.

Documentation Updates

N/A.

Checklist

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

…a which ignored critical JSON Schema constructs.
@github-actions
Copy link

Hi @Adityakk9031! Thanks a lot for your contribution!

I noticed that the following required information is missing or incomplete: kind of change description

Please update the PR description to include this information. You can find placeholders in the PR template for these items.

Thanks a lot!

@github-actions
Copy link

Hi @Adityakk9031! Thanks a lot for your contribution!

I noticed that the following required information is missing or incomplete: kind of change description

Please update the PR description to include this information. You can find placeholders in the PR template for these items.

Thanks a lot!

@github-actions
Copy link

github-actions bot commented Jan 28, 2026

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

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

@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (fd76cd7) to head (c40c405).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #2177   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           30        30           
  Lines          640       640           
  Branches       198       198           
=========================================
  Hits           640       640           

☔ 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.

@Adityakk9031
Copy link
Contributor Author

@Utkarsh-123github please have a look

@vtushar06
Copy link
Collaborator

Thanks for PR, But as Utkarsh mention in your other issue about tagging multiple time please follow that strictly.

@Adityakk9031
Copy link
Contributor Author

@AgniveshChaubey sir please look this pr

@AgniveshChaubey
Copy link
Collaborator

let's wait for someone who has better understanding of that section of code.

@Adityakk9031
Copy link
Contributor Author

@Utkarsh-123github sir please have a look

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:Scopes.tscurrentlygenerateSchemaScopes` fails to resolve nested constructs — incomplete scope mapping

3 participants