# ADR-014: Repository stores dereferenced entry schemas ## Status Accepted ## Context When a Module entry uses `Module.Import()`, the entry's JSON Schema embeds the referenced Module's `$defs`. For example, `CallGraph` importing `FlowGraph.Import("CallStatus")` includes all of `FlowGraph`'s definitions in the JSON Schema output. Storing this in every `node_types` row would duplicate the entire referenced Module. ## Decision The repository layer stores **dereferenced entry schemas** — each `node_types` row gets its entry's resolved JSON Schema with just the transitive `$defs` it needs, not the entire importing Module's definitions. This avoids storage bloat and version coupling between packages. ## Consequences - Each DB row stores 1–3 KB of JSON Schema (just its own entry + transitive refs) - A full graph type's schemas total ~10–50 KB in the DB, negligible compared to node/edge data - No version coupling — a `FlowGraph` version change doesn't require updating all CallGraph rows - `moduleToDbSchema()` performs the dereferencing at write time ## References - [metagraph-module.md](../metagraph-module.md)