feat(viewer): erDiagram shows real column types when present; ArtifactView accepts a {content} sql wrapper
erDiagram reads data_type/type from the candidate (top-level or signals),
falling back to the generic 'col' token Mermaid needs — real types render as
soon as schema_linking.json carries them. ArtifactView gains a defensive
{content} fallback for sql-kind artifacts, verified against real session shapes.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -97,3 +97,16 @@ test("(e) buildErDiagram emits entities, attributes and a relation", () => {
|
||||
expect(def).toContain("col id");
|
||||
expect(def).toContain("orders }o--o{ customers : join");
|
||||
});
|
||||
|
||||
test("(f) buildErDiagram uses a column's real type when the data carries one", () => {
|
||||
const def = buildErDiagram(
|
||||
[
|
||||
{ kind: "table", name: "orders", decision: "promoted" },
|
||||
{ kind: "column", name: "orders.total", decision: "promoted", signals: { data_type: "numeric" } },
|
||||
{ kind: "column", name: "orders.id", decision: "promoted" }, // no type -> generic "col"
|
||||
],
|
||||
[],
|
||||
);
|
||||
expect(def).toContain("numeric total");
|
||||
expect(def).toContain("col id");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user