Build the merged TOML table for `driver` by overlaying inheritable `[openshell.gateway]` defaults onto `[openshell.drivers. ]`. The returned [`toml::Value`] is a Table ready to feed into the driver's `Deserialize` impl — keys present in `raw` win over the gateway defaults. Keys outside [`inheritable_keys`] for this driver are never copied from the gateway section, which keeps each driver's `
(
driver_name: &str,
gateway: &GatewayFileSection,
raw: Option<&toml::Value>,
)
| 231 | /// the gateway section, which keeps each driver's `deny_unknown_fields` |
| 232 | /// invariant intact. |
| 233 | pub fn driver_table( |
| 234 | driver_name: &str, |
| 235 | gateway: &GatewayFileSection, |
| 236 | raw: Option<&toml::Value>, |
| 237 | ) -> toml::Value { |
| 238 | let mut merged = match raw { |
| 239 | Some(toml::Value::Table(table)) => table.clone(), |
| 240 | _ => toml::Table::new(), |
| 241 | }; |
| 242 | |
| 243 | for key in inheritable_keys(driver_name) { |
| 244 | if merged.contains_key(*key) { |
| 245 | continue; |
| 246 | } |
| 247 | if let Some(value) = gateway_inherited_value(gateway, key) { |
| 248 | merged.insert((*key).to_string(), value); |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | toml::Value::Table(merged) |
| 253 | } |
| 254 | |
| 255 | /// Inheritance allowlist (the Q4 "high-overlap set"). Each driver opts in |
| 256 | /// to a specific subset so a gateway-wide default does not accidentally land |