dendryform_core/lib.rs
1//! # dendryform-core
2//!
3//! Core schema types, validation, theme, and layout plan for dendryform.
4//!
5//! This crate defines the data model for describing software architecture
6//! diagrams: nodes, edges, tiers, connectors, containers, and the theme
7//! system. All types use private fields with validated constructors to
8//! ensure invalid states are unrepresentable.
9//!
10//! ## Key Types
11//!
12//! - [`NodeId`] — validated slug identifier for nodes
13//! - [`Node`] — a card in the diagram, built via [`NodeBuilder`]
14//! - [`Edge`] — a semantic relationship between nodes
15//! - [`Tier`] — a horizontal band of nodes
16//! - [`Diagram`] — the validated top-level document
17//!
18//! ## Construction Patterns
19//!
20//! Types are constructed either programmatically (via builders and
21//! constructors) or by deserializing YAML/JSON. Deserialization of
22//! [`Diagram`] validates cross-cutting invariants automatically via
23//! `#[serde(try_from)]`.
24
25mod color;
26mod connector;
27mod container;
28mod diagram;
29mod edge;
30mod error;
31mod id;
32mod kind;
33mod layer;
34mod layout;
35mod legend;
36mod metadata;
37mod node;
38mod tech;
39mod theme;
40mod tier;
41
42// Re-export all public types at crate root for ergonomic imports.
43pub use color::Color;
44pub use connector::{Connector, ConnectorStyle};
45pub use container::{Container, ContainerBorder};
46pub use diagram::{Diagram, DiagramHeader, RawDiagram, Title};
47pub use edge::Edge;
48pub use error::ValidationError;
49pub use id::NodeId;
50pub use kind::{EdgeKind, NodeKind};
51pub use layer::{FlowLabels, Layer};
52pub use layout::TierLayout;
53pub use legend::LegendEntry;
54pub use metadata::Metadata;
55pub use node::{Node, NodeBuilder};
56pub use tech::Tech;
57pub use theme::{
58 Backgrounds, Borders, ColorSet, Fonts, Spacing, TextColors, Theme, ThemeOverrides, ThemePalette,
59};
60pub use tier::Tier;
61
62/// Returns the version of the dendryform-core crate.
63pub fn version() -> &'static str {
64 env!("CARGO_PKG_VERSION")
65}
66
67#[cfg(test)]
68mod tests {
69 use super::*;
70
71 #[test]
72 fn test_version_is_set() {
73 assert_eq!(version(), "0.1.0");
74 }
75}