ocsf_codegen/
other.rs

1use serde::Deserialize;
2
3use crate::*;
4
5#[derive(Deserialize)]
6struct VersionFile {
7    version: String,
8}
9
10pub fn add_version_element(
11    paths: &DirPaths,
12    output_scope: &mut codegen::Scope,
13) -> Result<(), Box<dyn Error>> {
14    let version_file = read_file_to_value(&format!("{}version.json", paths.schema_path))?;
15
16    let schema_version: VersionFile = serde_json::from_value(version_file)?;
17    debug!("OCSF Schema Version: {}", schema_version.version);
18    output_scope.raw(format!(
19        "/// This was the schema version that the code was generated from ({}).",
20        &schema_version.version
21    ));
22    output_scope.raw(format!(
23        "pub static OCSF_SCHEMA_VERSION: &str = {:?};\n\n",
24        schema_version.version
25    ));
26
27    Ok(())
28}
29
30// pub fn generate_other(paths: &DirPaths) -> Result<(), Box<dyn Error>> {
31//     let mut output_scope = codegen::Scope::new();
32
33//     output_scope.writeln(
34//         "//* I'm not saying it's the junk drawer, but it's also *not* *not* the junk drawer.",
35//     );
36//     output_scope.add_generation_timestamp_comment();
37
38//     add_version_element(paths, &mut output_scope)?;
39
40//     write_source_file(
41//         &format!("{}src/other.rs", paths.destination_path),
42//         &output_scope.to_string(),
43//     )
44// }