OpenLogi Configuration Schema Version: Current Constants and Validation
The current OpenLogi configuration schema version is 7, defined as the public constant SCHEMA_VERSION in the core crate and required in all user TOML configuration files.
The AprilNEA/OpenLogi repository employs a strict versioning system to maintain compatibility between the Rust-based engine and user-defined settings. Understanding the OpenLogi configuration schema version is essential for ensuring your deployments run without validation errors or migration issues.
Current Schema Version Constant
As implemented in the master branch, the configuration schema version is hardcoded as a u32 constant in the core library. In crates/openlogi-core/src/config.rs at line 94, the version is defined as:
pub const SCHEMA_VERSION: u32 = 7;
All configuration loading operations compare user-provided values against this constant to determine compatibility and trigger migration logic when necessary.
Example Configuration File
The repository includes a reference implementation in docs/config.example.toml that demonstrates the required TOML field:
schema_version = 7
User configurations must include this exact value to pass validation during the loading process.
Validating the Schema Version Programmatically
The OpenLogi codebase provides explicit methods for verifying configuration compatibility at runtime. The loading logic in crates/openlogi-core/src/config/file.rs performs version checks against SCHEMA_VERSION during both load and save operations.
Loading and Verifying Existing Configurations
To load a configuration from the default location and assert that its schema version matches the current constant:
use openlogi_core::config::{Config, ConfigFile};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Load configuration from the default location (or a custom path)
let cfg: Config = ConfigFile::load_default()?;
// Verify the schema version
assert_eq!(cfg.schema_version, openlogi_core::config::SCHEMA_VERSION);
println!("Config schema version: {}", cfg.schema_version);
Ok(())
}
Creating New Configurations
When generating new configuration instances programmatically, the Default trait implementation automatically sets the correct schema version:
use openlogi_core::config::{Config, ConfigFile};
fn new_config() -> Config {
// `Config::default()` automatically sets `schema_version` to the current constant
Config::default()
}
This ensures that newly created configurations always match the current OpenLogi configuration schema version without manual field assignment.
Implementation Details and File Locations
The schema version system spans three critical files in the repository:
crates/openlogi-core/src/config.rs— Defines thepub const SCHEMA_VERSION: u32 = 7constant and the coreConfigstruct that deserializes the TOML representation.docs/config.example.toml— Provides the canonical example showingschema_version = 7as the expected user-facing value.crates/openlogi-core/src/config/file.rs— Implements the I/O logic that reads configuration files from disk, validates theschema_versionfield againstSCHEMA_VERSION, and handles migration paths for outdated configurations.
Summary
- The current OpenLogi configuration schema version is 7.
- The version is defined as a public constant
SCHEMA_VERSION: u32incrates/openlogi-core/src/config.rs. - All user configuration files must specify
schema_version = 7in their TOML headers. - The
Config::default()constructor automatically initializes new configurations with the correct version. - Runtime validation occurs in
file.rs, which compares user configurations against theSCHEMA_VERSIONconstant.
Frequently Asked Questions
What is the current OpenLogi configuration schema version?
The current version is 7. This integer value is defined as the constant SCHEMA_VERSION in crates/openlogi-core/src/config.rs and represents the latest supported configuration format for the master branch.
Where does OpenLogi validate the configuration schema version?
Validation occurs in crates/openlogi-core/src/config/file.rs, which handles all configuration I/O operations. This module compares the schema_version field from the user's TOML file against the SCHEMA_VERSION constant to determine if the configuration requires migration or is compatible with the current engine build.
How do I ensure my configuration file uses the correct schema version?
Set schema_version = 7 in the root of your TOML configuration file, following the example in docs/config.example.toml. When creating configurations programmatically, use Config::default() rather than manual struct initialization to automatically inherit the current SCHEMA_VERSION value.
What happens if my configuration uses an outdated schema version?
The loader in file.rs uses the SCHEMA_VERSION constant to detect version mismatches and execute appropriate migration logic or validation checks. Configurations that do not match the expected version may trigger errors or automatic conversion procedures depending on the specific version difference and the implementation in the core crate.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →