Skip to main content

parse_model

Function parse_model 

Source
pub fn parse_model(path: &Path) -> ForgeResult<ParsedModel>
Expand description

Parse a Forge model file (v1.0.0 array format) and return a ParsedModel.

This is the main entry point for parsing Forge YAML files.

§Arguments

  • path - Path to the Forge YAML file

§Returns

  • Ok(ParsedModel) - Successfully parsed model with tables and scalars
  • Err(ForgeError) - Parse error with detailed context

§Errors

Returns an error if the file cannot be read, contains invalid YAML, or fails schema validation.

§Example

use mollendorff_forge::parser::parse_model;
use std::path::Path;

let model = parse_model(Path::new("model.yaml"))?;
println!("Tables: {}", model.tables.len());