Files
flowgraph/tasks/schema-graph-schemas.md

39 lines
1.6 KiB
Markdown

---
id: schema/graph-schemas
name: Define SerializedGraph factory and OperationGraphSerialized/CallGraphSerialized schemas
status: completed
depends_on:
- schema/node-attrs
- schema/edge-attrs
scope: narrow
risk: low
impact: component
level: implementation
---
## Description
Define the generic `SerializedGraph` factory function that produces graphology native JSON format schemas, and the two specialized serialization types for operation graphs and call graphs.
## Acceptance Criteria
- [ ] `src/schema/graph.ts` exports `SerializedGraph` factory function
- [ ] `SerializedGraph<N, E, G>`: generic factory producing `Type.Object` with `attributes` (GraphAttrs), `options` ({type: "directed", multi: false, allowSelfLoops: false}), `nodes` (Array of {key, attributes}), `edges` (Array of {key, source, target, attributes})
- [ ] `OperationGraphSerialized`: `SerializedGraph(OperationNodeAttrs, OperationEdgeAttrs, Type.Object({}))` — no graph-level attributes
- [ ] `CallGraphSerialized`: `SerializedGraph(CallNodeAttrs, CallEdgeAttrs, Type.Object({}))` — no graph-level attributes
- [ ] `FlowGraphSerialized` type alias for the general case (used by `fromJSON`)
- [ ] Edge key convention documented: `${source}->${target}` for simple cases, `${source}->${target}:${edgeType}` for call graph depends_on edges
- [ ] `src/schema/index.ts` re-exports graph schemas
- [ ] Unit tests: `Value.Check()` against valid and invalid serialized graph data
## References
- docs/architecture/schema.md — SerializedGraph factory, FlowGraphSerialized variants, edge key convention
## Notes
> To be filled by implementation agent
## Summary
> To be filled on completion