Add XSD visual viewer (MVP)#83
Conversation
There was a problem hiding this comment.
💡 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".
| if (elementDecl.children && elementDecl.children.length > 0) { | ||
| const inlineType = doc.createElementNS(SCHEMA_NS, 'xs:complexType'); | ||
| appendSequence(doc, inlineType, elementDecl.children); | ||
| element.append(inlineType); |
There was a problem hiding this comment.
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 👍 / 👎.
Motivation
Description
web_src/js/features/xsdvisual/implementing a minimal XSD AST, parser (parse.ts), graph model/layout usingdagre(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).index.ts) and wire it into the global registry andweb_src/js/index-domready.ts, plus a new templatetemplates/repo/view_file_xsd_visual.tmplcontaining a mount point and payload JSON..xsdfiles to the new viewer by settingIsXSDVisual/XSDVisualPayloadinrouters/web/repo/view_file.goand wire raw/diagram toggling in the template; the UI disables editing when the repo/context is not editable.PGV_SET_CONTENTand buffering pending content inweb_src/js/features/processgitviewer/index.tsso the viewer can postPGV_SET_CONTENTand later request a commit viaPGV_REQUEST_SAVE.dagretopackage.jsonand adeclare module 'dagre'entry totypes.d.tsto support the layout dependency and TypeScript compilation.Testing
pnpm install --lockfile-onlyto 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)page.gotoreturnednet::ERR_EMPTY_RESPONSE. (failed)Codex Task