Skip to content

fix(jsonforms-renderers): scan nested and $ref schemas for conditional required - #117

Merged
ginaxu1 merged 3 commits into
mainfrom
fix/jsonforms-conditional-required-nested-scan
Oct 16, 2026
Merged

ginaxu1 merged 3 commits into
mainfrom
fix/jsonforms-conditional-required-nested-scan

Conversation

@ginaxu1

@ginaxu1 ginaxu1 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #112 / closes #115.

schemaHasConditionalRequired now walks the whole schema (properties, items, then/else, etc.), follows local $refs into $defs / definitions, and caches the result per schema object in a WeakMap. Property-level enum oneOf that only lists const options stays on the fast path; branches that add required or further conditionals do not.

Type of change

Release notes

N/A — covered in #112's release notes (nested / $ref conditionals). Use skip-changelog on this PR.

Test plan

@ginaxu1 ginaxu1 added Type/Improvement Enhancement to existing functionality Package/jsonforms-renderers Changes to packages/jsonforms-renderers labels Oct 15, 2026
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 49d2eca7-0c66-4fbc-9fd3-e3ac992fea4b
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sthanikan2000 sthanikan2000 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.

The scan looks right: I ran the suite and probed it against AJV, and the #115 example works end to end. Three things:

  1. The base is #112's branch, so Packages CI hasn't run. After #112 squash-merges, please git rebase --onto main and confirm CI is green. Please run pnpm lint too; I saw possible no-unnecessary-type-assertion at required.ts lines 28, 108 and 115, which I couldn't confirm locally.
  2. It has both Type/Improvement and Type/Bug. This completes unreleased work, so I'd use skip-changelog and mention nested/$ref in #112's Release notes.
  3. Please change the title scope to jsonforms-renderers. Optional: add a test for the self-referential $ref guard.

@ginaxu1 ginaxu1 added Package/jsonforms-renderers Changes to packages/jsonforms-renderers skip-changelog Leave this PR out of the release notes and removed Type/Improvement Enhancement to existing functionality Type/Bug Something isn't working as expected Package/jsonforms-renderers Changes to packages/jsonforms-renderers labels Oct 15, 2026
@ginaxu1 ginaxu1 changed the title fix(jsonforms): scan nested and $ref schemas for conditional required fix(jsonforms-renderers): scan nested and $ref schemas for conditional required Oct 15, 2026
@ginaxu1

ginaxu1 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

@sthanikan2000 Thanks — addressed what we can before #112 merges:

  1. Lint: fixed the three no-unnecessary-type-assertion hits in required.ts (43ed744). pnpm lint / eslint is clean on that file; tests pass including a self-referential $ref guard. Rebase onto main + Packages CI will happen after fix(jsonforms-renderers): show required asterisk for conditionally required fields #112 squash-merges (still open).
  2. Labels: removed Type/Improvement and Type/Bug, added skip-changelog. Nested/$ref called out in fix(jsonforms-renderers): show required asterisk for conditionally required fields #112's Release notes.
  3. Title scope is now jsonforms-renderers.

@github-actions github-actions Bot added the Type/Bug Something isn't working as expected label Oct 15, 2026
@ginaxu1 ginaxu1 removed the Type/Bug Something isn't working as expected label Oct 15, 2026
@ginaxu1
ginaxu1 force-pushed the fix/jsonforms-conditional-required-nested-scan branch from 43ed744 to fecd594 Compare October 15, 2026 22:57
@ginaxu1
ginaxu1 requested a review from sthanikan2000 October 16, 2026 04:40
@sthanikan2000
sthanikan2000 added this pull request to stack #120 October 16, 2026 04:50
Base automatically changed from fix/jsonforms-options-required-asterisk to main October 16, 2026 05:31
ginaxu1 and others added 2 commits October 16, 2026 11:01
Widen schemaHasConditionalRequired so nested if/then and local $refs are seen,
cache the result per schema object, and keep enum-only oneOf on the fast path.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@ginaxu1
ginaxu1 force-pushed the fix/jsonforms-conditional-required-nested-scan branch from fecd594 to 11cad85 Compare October 16, 2026 05:32
Property-array dependencies report under keyword `dependencies`, so the
asterisk hook missed them even though AJV enforces the constraint.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ginaxu1

ginaxu1 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the non-blocking dependencies follow-up from #112: isPathRequiredBySchema now matches AJV errors with keyword dependencies (property-array form) as well as required. Schema-form dependencies already surfaced as nested required errors. Covered with a unit test.

@sthanikan2000 sthanikan2000 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.

Re-checked on the rebased head. Through the real controls, nested if/then, a conditional behind a local $ref, and property-array dependencies all show the * when the condition holds and not otherwise. The schema-form dependencies claim in your comment is also correct. 587 tests pass, type-check is clean, and CI is green now that it targets main. Approving.

Non-blocking: the description still says "Stacked on #112 … rebase after #112 squash-merges", and the test-plan boxes are unchecked. Worth cleaning up before merge.

@ginaxu1
ginaxu1 merged commit d180ad5 into main Oct 16, 2026
14 checks passed
@ginaxu1
ginaxu1 deleted the fix/jsonforms-conditional-required-nested-scan branch October 16, 2026 06:23
@ginaxu1 ginaxu1 self-assigned this Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Package/jsonforms-renderers Changes to packages/jsonforms-renderers skip-changelog Leave this PR out of the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

jsonforms-renderers: detect nested and $ref conditionals in schemaHasConditionalRequired

2 participants