c2pa-rs

A fork of https://github.com/contentauth/c2pa-rs/
git clone git://archive.git.mtrnord.blog/mtrnords-photography-manager/c2pa-rs.git
Log | Files | Refs | README

main.rs (757B)


      1 use std::{fs, path::Path};
      2 
      3 use anyhow::Result;
      4 use c2pa::ManifestStore;
      5 use schemars::gen::SchemaSettings;
      6 
      7 fn main() -> Result<()> {
      8     println!("Exporting JSON schema");
      9     let settings = SchemaSettings::draft07();
     10     let gen = settings.into_generator();
     11     let schema = gen.into_root_schema_for::<ManifestStore>();
     12     let output = serde_json::to_string_pretty(&schema).expect("Failed to serialize schema");
     13     let output_dir = Path::new("./target/schema");
     14     fs::create_dir_all(output_dir).expect("Could not create schema directory");
     15     let output_path = output_dir.join("ManifestStore.schema.json");
     16     fs::write(&output_path, output).expect("Unable to write schema");
     17     println!("Wrote schema to {}", output_path.display());
     18     Ok(())
     19 }