Validates a plugin configuration document. This is a pure validation pass. It does not mutate the active runtime configuration. # Parameters - `config`: Plugin configuration to validate. # Returns A [`ConfigReport`] describing warnings and errors discovered during validation. # Notes Validation checks host policy, plugin multiplicity rules, unknown component kinds, and plugin-provided validati
(config: &PluginConfig)
| 864 | /// Validation checks host policy, plugin multiplicity rules, unknown component |
| 865 | /// kinds, and plugin-provided validation hooks. |
| 866 | pub fn validate_plugin_config(config: &PluginConfig) -> ConfigReport { |
| 867 | let _ = ensure_builtin_plugins_registered(); |
| 868 | let mut report = ConfigReport::default(); |
| 869 | |
| 870 | if config.version != 1 { |
| 871 | push_policy_diag( |
| 872 | &mut report.diagnostics, |
| 873 | config.policy.unsupported_value, |
| 874 | "plugin.unsupported_config_version", |
| 875 | None, |
| 876 | Some("version".to_string()), |
| 877 | format!("plugin config version {} is unsupported", config.version), |
| 878 | ); |
| 879 | } |
| 880 | |
| 881 | validate_plugin_multiplicity(&mut report, config); |
| 882 | |
| 883 | for component in &config.components { |
| 884 | let Some(plugin) = lookup_plugin(&component.kind) else { |
| 885 | push_policy_diag( |
| 886 | &mut report.diagnostics, |
| 887 | config.policy.unknown_component, |
| 888 | "plugin.unknown_component", |
| 889 | Some(component.kind.clone()), |
| 890 | None, |
| 891 | format!("plugin component kind '{}' is unsupported", component.kind), |
| 892 | ); |
| 893 | continue; |
| 894 | }; |
| 895 | report |
| 896 | .diagnostics |
| 897 | .extend(plugin.validate(&component.config)); |
| 898 | } |
| 899 | |
| 900 | report |
| 901 | } |
| 902 | |
| 903 | /// Layers `right` (higher precedence) onto `left` in place. |
| 904 | /// |