Skip to content

Add XSD visual viewer (MVP)#83

Merged
rg4444 merged 1 commit into
mainfrom
codex/add-xsd-visual-editor-for-processgit
Feb 5, 2026
Merged

Add XSD visual viewer (MVP)#83
rg4444 merged 1 commit into
mainfrom
codex/add-xsd-visual-editor-for-processgit

Conversation

@rg4444
Copy link
Copy Markdown
Contributor

@rg4444 rg4444 commented Feb 5, 2026

Motivation

  • Provide a new ProcessGit viewer "xsd-visual" that renders .xsd files as an interactive diagram and enables light-weight edits and export for common XSD workflows (pan/zoom, select, search, rename, cardinality, docs, add child in sequence).

Description

  • Add a new feature under web_src/js/features/xsdvisual/ implementing a minimal XSD AST, parser (parse.ts), graph model/layout using dagre (graph.ts), SVG renderer with pan/zoom and selection (render.ts), UI panel and modal forms (ui.ts), AST mutation editor operations (editor.ts), and XSD serializer (serialize.ts).
  • Register the viewer init (index.ts) and wire it into the global registry and web_src/js/index-domready.ts, plus a new template templates/repo/view_file_xsd_visual.tmpl containing a mount point and payload JSON.
  • Route .xsd files to the new viewer by setting IsXSDVisual/XSDVisualPayload in routers/web/repo/view_file.go and wire raw/diagram toggling in the template; the UI disables editing when the repo/context is not editable.
  • Make the ProcessGit host frame accept staged content for saves by handling PGV_SET_CONTENT and buffering pending content in web_src/js/features/processgitviewer/index.ts so the viewer can post PGV_SET_CONTENT and later request a commit via PGV_REQUEST_SAVE.
  • Add dagre to package.json and a declare module 'dagre' entry to types.d.ts to support the layout dependency and TypeScript compilation.

Testing

  • Attempted pnpm install --lockfile-only to update the lockfile and validate dependency resolution but it failed due to a registry 403 fetching a different package (so full install/build was not completed). (failed)
  • Attempted an automated Playwright script to load a local server and capture a screenshot of the viewer, but the server was not running and page.goto returned net::ERR_EMPTY_RESPONSE. (failed)

Codex Task

@rg4444 rg4444 merged commit 62f27ce into main Feb 5, 2026
8 of 23 checks passed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d80a62262

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +88 to +91
if (elementDecl.children && elementDecl.children.length > 0) {
const inlineType = doc.createElementNS(SCHEMA_NS, 'xs:complexType');
appendSequence(doc, inlineType, elementDecl.children);
element.append(inlineType);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve choice vs sequence in inline complex types

Inline complex types that use <xs:choice> are parsed into elementDecl.children, but serializeXsd always writes them back inside <xs:sequence>. This silently changes schema semantics when exporting or saving (e.g., an element that allowed one-of alternatives will be serialized as an ordered sequence). If the input XSD contains inline choices, opening and saving through the viewer will corrupt the content model. Consider tracking whether the inline children came from a choice vs. sequence and serializing accordingly.

Useful? React with 👍 / 👎.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant