Skip to main content

validate

Function validate 

Source
pub fn validate(
    config: &mut ServerConfig,
    base_dir: Option<&Path>,
) -> Result<(), ServerError>
Expand description

Validates a fully loaded server configuration before startup.

Validation is intentionally limited to deterministic semantic checks and filesystem inspection. It does not bind sockets, connect to peers, or perform any other network I/O. Beyond the semantic checks it also resolves and loads each channel’s schema_ref from disk (relative to base_dir, or verbatim for absolute paths), parses the JSON Schema document, and stores it on the channel so the channel can later be built with a real schema. A missing, unreadable, or non-JSON schema file is an accumulated validation error like any other.

base_dir is the directory the config file was loaded from; relative schema_ref paths resolve against it. When it is None (e.g. a config assembled in memory), relative paths resolve against the process working directory, so callers that construct a config directly should use absolute schema_ref paths.

§Errors

Returns ServerError::ConfigValidation containing all discovered validation errors when the configuration is not safe to use for startup.