json-schema-org / json-schema-org/website

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

Open
#2,012 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🐛 Bug Status: Triage
Dominant language
HTML
Stars
169
Forks
484
Avg merge
2d 2h
Merged PRs (30d)
6

Description

Describe the bug

The JsonEditor component, used throughout the documentation to display interactive JSON Schema examples, fails to provide documentation links and correct syntax highlighting for subschemas defined under several critical keywords.

Currently, the editor only recognizes subschemas within properties, patternProperties, and items. Keywords like $defs, definitions, allOf, anyOf, oneOf, not, if, then, and else are treated as regular data, meaning their contents are not interactive and do not link to the reference documentation.

Steps To Reproduce

1.) Run the website locally using yarn dev.
2.) Navigate to the Structuring page: http://localhost:3000/understanding-json-schema/structuring#defs
3.) Scroll down to the $defs section.
4.) Hover over or click keywords like "type", "string", or "items" inside the $defs code block.
5.) Observe: They are rendered in cyan (data style) and are not clickable.
6.) Compare this to the Basics section: http://localhost:3000/understanding-json-schema/basics, where the same keywords inside a properties block are light blue and link to the docs.

Expected Behavior

The editor should recursively identify subschemas within all valid JSON Schema keywords. Specifically, getScopesOfParsedJsonSchema.ts
needs to be updated to traverse:

  • Object maps of schemas: $defs, definitions, dependentSchemas.
  • Arrays of schemas: allOf, anyOf, oneOf.
  • Single subschemas: not, if, then, else, additionalProperties.
Screenshots
Expected:-
Image Image
Actual :-
Image
Device Information [optional]
- OS:
- Browser:
- version:
Are you working on this issue?

Yes

Do you think this work might require an [Architectural Decision Record (ADR)]? (significant or noteworthy)

Yes

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with getScopesOfParsedJsonSchema.ts and reproduce the issue with yarn dev at the Structuring page's $defs section. Done means subschemas under the listed object-map, array, and single-schema keywords receive the same interactive links and syntax highlighting as schemas under properties.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.