Skip to main content

Crate apimock_config

Crate apimock_config 

Source
Expand description

Configuration model for apimock.

§Responsibilities

  • Read apimock.toml and every file it references.
  • Resolve relative paths against the config file’s parent directory.
  • Validate that paths exist, rules are consistent, etc.
  • (Stage 2) apply structured edit commands from a GUI, and save the result back to disk preserving structure as much as possible.

§What is deliberately not here

  • Compiling Rhai middlewares — that’s apimock-server’s job. This crate only records the paths listed under service.middlewares.
  • HTTP response construction. Fully in apimock-server.
  • Rule-set parsing. Delegated to apimock-routing::RuleSet::new.

§Stage-1 surface

The view module defines the stage-1 GUI-facing API shape (WorkspaceSnapshot etc.). In 5.0.0 these types carry their definition and rustdoc but no populating logic; the stage-2 work fills in construction + edit / save behaviour.

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::ConfigError;
pub use error::ConfigResult;
pub use view::ApplyResult;
pub use view::ConfigFileView;
pub use view::ConfigNodeView;
pub use view::Diagnostic;
pub use view::DiagnosticSeverity;
pub use view::EditCommand;
pub use view::EditTarget;
pub use view::EditValue;
pub use view::NodeKind;
pub use view::ReloadHint;
pub use view::SaveResult;
pub use view::WorkspaceSnapshot;

Modules§

config
The Config struct: orchestrates loading, validation, and relative-path resolution for apimock.toml and every file it references.
error
Errors surfaced by the config crate.
path_util
view
Read-only + edit-command views on config state for GUI tooling.