Skip to content

IMPLEMENT: multi-schema rendering in Schema panel (closes #236)#242

Merged
DaveHudson merged 3 commits intomainfrom
sandcastle/issue-236-multi-schema-rendering
May 1, 2026
Merged

IMPLEMENT: multi-schema rendering in Schema panel (closes #236)#242
DaveHudson merged 3 commits intomainfrom
sandcastle/issue-236-multi-schema-rendering

Conversation

@DaveHudson
Copy link
Copy Markdown
Collaborator

Summary

  • IMPLEMENT: multi-schema rendering in Schema panel (closes Multi Schema Rendering #236)
  • REVIEW: clean up nested ternary, dead export, and add filename fallback test

Closes #236

DaveHudson added 3 commits May 1, 2026 12:21
Add Zod / JSON Schema / Convex tab strip to SchemaPanel so users can
switch between all three generated formats. Pre-warms the Shiki
highlighter on component mount to eliminate the colour-delay UX snag.

Key decisions:
- Single `error` reflects Zod failure (all schemas share the same IR;
  if Zod fails the others almost certainly will too). JSON/Convex emit
  failures are non-fatal so their tabs just render empty.
- `deriveFileName` maps the Zod filename to the per-type filename
  (`*.schema.ts` → `*.schema.json` / `convex/schema.ts`).
- JSON lang added to the Shiki highlighter for JSON Schema syntax colouring.
- `warmHighlighter()` exported for future use; pre-warm effect fires on
  SchemaPanel mount (app startup) rather than on first tab open.

Files changed:
- apps/desktop/src/renderer/src/components/schema/SchemaPanel.tsx
- apps/desktop/src/renderer/src/components/schema/SchemaPanel.stories.tsx
- apps/desktop/src/renderer/src/components/schema/shiki-highlighter.ts
- apps/desktop/src/renderer/src/App.tsx
- apps/desktop/tests/components/schema/SchemaPanel.test.tsx
…ck test

- Replace nested ternary for activeSource with a Record<SchemaType, string>
  lookup — coding standards prohibit nested ternaries
- Remove warmHighlighter() from shiki-highlighter: it was exported but never
  called; pre-warming already happens in SchemaPanel's mount effect
- Add test covering deriveFileName's .ts → .json fallback branch (the path
  taken when schemaFileName is the default 'schema.ts', which has no
  '.schema.ts' segment)
…multi-schema-rendering

# Conflicts:
#	apps/desktop/src/renderer/src/App.tsx
@DaveHudson DaveHudson merged commit 38b611e into main May 1, 2026
3 checks passed
@DaveHudson DaveHudson deleted the sandcastle/issue-236-multi-schema-rendering branch May 1, 2026 13:51
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.

Multi Schema Rendering

1 participant