Function validate_flat

Source
pub fn validate_flat(
    schemas: &IndexMap<String, IfcxSchema>,
    nodes: &IndexMap<String, FlatNode>,
) -> ValidationReport
Expand description

Checks flattened nodes, as flatten or flatten_owned return them, against schemas. This is what upstream validates: one merged node per path, in the flattened order.

use openbim_ifcx::{flatten_owned, validate_flat, IfcxFile};

let file = IfcxFile::from_json_str(r#"{
    "header": {"id": "demo", "ifcxVersion": "ifcx_alpha", "dataVersion": "1.0.0",
               "author": "someone", "timestamp": "2026-10-03"},
    "imports": [],
    "schemas": {"x::height": {"value": {"dataType": "Real"}}},
    "data": [{"path": "w", "attributes": {"x::height": "tall"}},
             {"path": "w", "attributes": {"x::height": 3.0}}]
}"#)?;
// Only the value that wins is checked.
assert!(validate_flat(&file.schemas, &flatten_owned(file.data.clone())).is_valid());