Expand description
Configuration model for apimock.
§Responsibilities
- Read
apimock.tomland every file it references. - Resolve relative paths against the config file’s parent directory.
- Validate that paths exist, rules are consistent, etc.
- Provide the
Workspacefaçade that a GUI uses to edit a loaded configuration by domain-level commands instead of TOML text.
§What is deliberately not here
- Compiling Rhai middlewares — that’s
apimock-server’s job. This crate only records the paths listed underservice.middlewares. - HTTP response construction. Fully in
apimock-server. - Rule-set parsing. Delegated to
apimock-routing::RuleSet::new.
§5.1.0 — GUI-facing API
5.0.0 defined the shape of the types a future GUI would depend
on; 5.1 makes the Workspace value that wraps them actually
loadable and introspectable. Per the spec’s §12 step plan, 5.1.0
implements Steps 1–3 (load + snapshot + validate), leaving Step 4
(save + diff) and Step 5 (richer routing snapshot) for 5.2+.
Re-exports§
pub use config::Config;pub use config::constant::LISTENER_DEFAULT_IP_ADDRESS;pub use config::constant::LISTENER_DEFAULT_PORT;pub use config::listener_config::ListenerConfig;pub use config::log_config::LogConfig;pub use config::service_config::ServiceConfig;pub use error::ApplyError;pub use error::ConfigError;pub use error::ConfigResult;pub use error::SaveError;pub use error::WorkspaceError;pub use view::ApplyResult;pub use view::ConfigFileKind;pub use view::ConfigFileView;pub use view::ConfigNodeView;pub use view::DiffItem;pub use view::DiffKind;pub use view::Diagnostic;pub use view::EditCommand;pub use view::EditValue;pub use view::NodeId;pub use view::NodeKind;pub use view::NodeValidation;pub use view::ReloadHint;pub use view::RespondPayload;pub use view::RootSettingKey;pub use view::RulePayload;pub use view::SaveResult;pub use view::Severity;pub use view::ValidationIssue;pub use view::ValidationReport;pub use view::WorkspaceSnapshot;pub use workspace::Workspace;
Modules§
- config
- The
Configstruct: orchestrates loading, validation, and relative-path resolution forapimock.tomland every file it references. - error
- Errors surfaced by the config crate.
- path_
util - view
- Read-only views on workspace state, and the command + result types the editing API uses.
- workspace
- The editable workspace: loaded TOML + stable node IDs + edit API.