Skip to main content

generate_from_schema

Function generate_from_schema 

Source
pub fn generate_from_schema(
    schema_path: &str,
    output_path: &str,
) -> Result<(), Box<dyn Error>>
Expand description

Generate Rust types from a schema.yaml file.

Reads the schema at schema_path, generates typed Rust code, and writes the output to output_path. This is intended to be called from a build.rs build script.

ยงExample

// In build.rs:
grounddb_codegen::generate_from_schema("schema.yaml", "src/generated.rs").unwrap();