mirror of
https://github.com/openai/codex.git
synced 2026-11-11 21:10:39 +00:00
Centralize TOML config deserialization (#58198)
## What changed - Add a non-inlined `TryFrom<toml::Value>` implementation for `ConfigToml` and route callers through it to share the generated deserializer in `codex-config`. - Reuse the ignored-field deserialization helper for strict validation, returning path-aware errors while preserving existing fallbacks for CLI validation and ignored-config warnings. GitOrigin-RevId: 0208b314416ad4d3d7fbf3a30560a0c8c4035abd
This commit is contained in:
committed by
copyberry
parent
2f1e4f99e0
commit
b91cedc080
@@ -663,6 +663,7 @@ fn validate_cli_overrides_strictly(
|
||||
) -> io::Result<()> {
|
||||
let _guard = AbsolutePathBufGuard::new(base_dir);
|
||||
let ignored_path = ignored_toml_value_fields::<ConfigToml>(cli_overrides_layer.clone())
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.chain(unknown_tui_toml_value_path(cli_overrides_layer))
|
||||
.next()
|
||||
@@ -1634,7 +1635,7 @@ pub fn resolve_relative_paths_in_config_toml(
|
||||
}
|
||||
// The typed round trip resolves AbsolutePathBuf fields against this layer's directory.
|
||||
let _guard = AbsolutePathBufGuard::new(base_dir);
|
||||
let Ok(resolved) = value_from_config_toml.clone().try_into::<ConfigToml>() else {
|
||||
let Ok(resolved) = ConfigToml::try_from(value_from_config_toml.clone()) else {
|
||||
return Ok(value_from_config_toml);
|
||||
};
|
||||
drop(_guard);
|
||||
|
||||
Reference in New Issue
Block a user