validate_widget_versions

Function validate_widget_versions 

Source
pub fn validate_widget_versions(
    document: &DampenDocument,
) -> Vec<ValidationWarning>
Expand description

Validate that all widgets in the document are compatible with the declared schema version.

Returns warnings (not errors) for widgets that require a higher version than declared. This is non-blocking validation to help developers identify potential compatibility issues.

§Arguments

  • document - The parsed document to validate

§Returns

A vector of ValidationWarning for widgets requiring higher versions. Empty vector means all widgets are compatible with the declared version.

§Examples

use dampen_core::{parse, validate_widget_versions};

let xml = r#"<dampen version="1.0"><canvas width="400" height="200" program="{chart}" /></dampen>"#;
let doc = parse(xml).unwrap();
let warnings = validate_widget_versions(&doc);
assert_eq!(warnings.len(), 1); // Canvas requires v1.1