kdl-schema

KDL Schema types and parsing.

examples

building a schema

rust use kdl_schema::*; let schema = Schema { document: Document { info: Info { title: vec![TextValue { text: "Sample Schema".to_string(), lang: Some("en".to_string()), }], ..Info::default() }, nodes: vec![Node { name: Some("name".to_string()), values: vec![Value { validations: vec![Validation::Type("string".to_string())], ..Value::default() }], ..Node::default() }] } }; println!("{:?}", schema);

parsing a schema KDL

```rust

[cfg(feature = "parse-knuffel")] {

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 matchingdocument = r#" name "Joe" age 69 "#; let schema = kdlschema::Schema::parse(schemakdl).unwrap(); assert_eq!(schema.document.info.title[0].text, "Sample Schema"); } ```

referencing the schema schema

rust assert_eq!(kdl_schema::SCHEMA_SCHEMA.document.info.title[0].text, "KDL Schema");

cargo features

conditions blocking version 1.0.0

license

Blue Oak Model License 1.0.0.