apimock_config/lib.rs
1//! Configuration model for apimock.
2//!
3//! # Responsibilities
4//!
5//! - Read `apimock.toml` and every file it references.
6//! - Resolve relative paths against the config file's parent directory.
7//! - Validate that paths exist, rules are consistent, etc.
8//! - Provide the [`Workspace`] façade that a GUI uses to edit a
9//! loaded configuration by domain-level commands instead of TOML
10//! text.
11//!
12//! # What is deliberately *not* here
13//!
14//! - Compiling Rhai middlewares — that's `apimock-server`'s job. This
15//! crate only records the paths listed under `service.middlewares`.
16//! - HTTP response construction. Fully in `apimock-server`.
17//! - Rule-set parsing. Delegated to `apimock-routing::RuleSet::new`.
18//!
19//! # 5.1.0 — GUI-facing API
20//!
21//! 5.0.0 defined the *shape* of the types a future GUI would depend
22//! on; 5.1 makes the `Workspace` value that wraps them actually
23//! loadable and introspectable. Per the spec's §12 step plan, 5.1.0
24//! implements Steps 1–3 (load + snapshot + validate), leaving Step 4
25//! (save + diff) and Step 5 (richer routing snapshot) for 5.2+.
26
27pub mod config;
28pub mod error;
29pub mod path_util;
30pub mod view;
31pub mod workspace;
32
33pub use config::{
34 Config,
35 constant::{LISTENER_DEFAULT_IP_ADDRESS, LISTENER_DEFAULT_PORT},
36 listener_config::ListenerConfig,
37 log_config::LogConfig,
38 service_config::ServiceConfig,
39};
40pub use error::{ApplyError, ConfigError, ConfigResult, SaveError, WorkspaceError};
41pub use view::{
42 ApplyResult, ConfigFileKind, ConfigFileView, ConfigNodeView, DiffItem, DiffKind, Diagnostic,
43 EditCommand, EditValue, NodeId, NodeKind, NodeValidation, ReloadHint, RespondPayload,
44 RootSettingKey, RulePayload, SaveResult, Severity, ValidationIssue, ValidationReport,
45 WorkspaceSnapshot,
46};
47pub use workspace::Workspace;