feat: implement Story 3.2 — AI diagram generation from natural language
Add complete AI-powered diagram generation pipeline: natural language input → type inference → graph patch generation → validated canvas render with ELK.js layout animation. Includes adversarial code review fixes for diagramType enum validation, duplicate ID detection, tool part history preservation, PATCH error handling, and graphData structural validation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -32,12 +32,22 @@ export const updateDiagramBodySchema = z
|
||||
title: z.string().min(1).max(255).optional(),
|
||||
projectId: z.string().nullable().optional(),
|
||||
sortOrder: z.number().int().min(0).optional(),
|
||||
graphData: z
|
||||
.object({
|
||||
meta: z.record(z.string(), z.unknown()).optional(),
|
||||
nodes: z.array(z.record(z.string(), z.unknown())),
|
||||
edges: z.array(z.record(z.string(), z.unknown())),
|
||||
pools: z.array(z.record(z.string(), z.unknown())).optional(),
|
||||
groups: z.array(z.record(z.string(), z.unknown())).optional(),
|
||||
})
|
||||
.optional(),
|
||||
})
|
||||
.refine(
|
||||
(data) =>
|
||||
data.title !== undefined ||
|
||||
data.projectId !== undefined ||
|
||||
data.sortOrder !== undefined,
|
||||
data.sortOrder !== undefined ||
|
||||
data.graphData !== undefined,
|
||||
{ message: "At least one field must be provided" },
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user