KDL Schema document validation.
Library usage:
use kdl_schema::Schema;
use kdl_schema_check::CheckExt;
let schema_kdl = r#"
document {
info {
title "Sample Schema" lang="en"
description "An example schema" lang="en"
author "boringcactus"
}
node "name" {
value {
type "string"
}
}
node "age" {
value {
type "number"
}
}
}
"#;
let schema = Schema::parse(schema_kdl).unwrap();
let document = r#"
name "Joe"
age 69
"#;
schema.check_text_matches("<sample document>", document)
.expect("document validation failed");
Binary usage:
$ cargo install kdl-schema-check
$ kdl-schema-check schema.kdl document.kdl
Validation succeeded!