Skip to content

feat: add ER diagram support with crow's foot cardinality#117

Draft
kevinswiber wants to merge 1 commit intomainfrom
feat/er-diagram-support
Draft

feat: add ER diagram support with crow's foot cardinality#117
kevinswiber wants to merge 1 commit intomainfrom
feat/er-diagram-support

Conversation

@kevinswiber
Copy link
Copy Markdown
Owner

Summary

  • Add erDiagram as a graph-family diagram type with text and SVG rendering
  • Extend Arrow enum with 4 crow's foot cardinality variants (OnlyOne, ZeroOrOne, OneOrMore, ZeroOrMore) — the only graph IR change across the entire diagram-type parity effort
  • Hand-written line-oriented parser for entities, typed attributes (PK/FK/UK keys, quoted comments), and relationships with cardinality notation
  • SVG crow's foot markers using quadratic Bézier curves; text mode uses head/tail labels
  • Entities render as 2-compartment nodes (name + attributes) via the existing SEPARATOR pattern

Closes #101

Test plan

  • 2177/2177 tests passing (34 new: 17 parser, 10 compiler, 2 instance, 5 compliance)
  • 4 fixtures: simple, attributes, cardinality, mixed_relations
  • Text + SVG snapshots generated and locked
  • just lint clean
  • just architecture-check clean
  • Smoke tested: echo 'erDiagram\n CUSTOMER ||--o{ ORDER : places' | cargo run

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 31, 2026

Playground Preview

@kevinswiber kevinswiber force-pushed the feat/er-diagram-support branch 2 times, most recently from c49432b to 78cce24 Compare April 2, 2026 19:51
Add `erDiagram` as a graph-family diagram type with full text and SVG
rendering support.

Parser: hand-written line-oriented parser for entities, typed attributes
(PK/FK/UK keys, quoted comments), and relationships with cardinality
notation (||, o|, }|, }o) and identifying/non-identifying line types.

Graph IR: extend Arrow enum with 4 crow's foot variants (OnlyOne,
ZeroOrOne, OneOrMore, ZeroOrMore) — the only IR change needed across
the entire diagram-type parity effort.

Rendering: SVG crow's foot markers using quadratic Bézier curves for
the fork notation. Text mode uses head/tail labels for cardinality.
Entities render as 2-compartment nodes (name + attributes) using the
existing SEPARATOR pattern from class diagrams.

Closes #101
@kevinswiber kevinswiber force-pushed the feat/er-diagram-support branch from 78cce24 to 8091363 Compare April 3, 2026 17:45
@cocogitto-bot
Copy link
Copy Markdown

cocogitto-bot Bot commented Apr 3, 2026

✔️ 8091363 - Conventional commits check succeeded.

@kevinswiber kevinswiber marked this pull request as draft April 14, 2026 02:45
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.

ER diagram support (erDiagram) with crow's foot cardinality

1 participant