Skip to main content

serialize_linkml

Function serialize_linkml 

Source
pub fn serialize_linkml(
    model: DataModel,
    out: Option<&PathBuf>,
) -> Result<String, Box<dyn Error>>
Expand description

Serializes a DataModel to LinkML YAML format and writes it to a file.

This function takes a DataModel instance and converts it to LinkML schema format, then serializes it to YAML. If an output path is provided, the YAML will be written to that file. The function returns the serialized YAML string regardless of whether it was written to a file.

§Arguments

  • model - The DataModel to serialize
  • out - Optional output path to write the YAML to

§Returns

  • Ok(String) - The serialized YAML string
  • Err(Box<dyn Error>) - If serialization or file writing fails