summaryrefslogtreecommitdiffstats
path: root/generator/src/main.rs
blob: 3d5900c8588024290f5d016bc0db8de8b0e7a94e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::ffi::OsString;

mod openapi;

fn main() -> eyre::Result<()> {
    let spec = get_spec()?;
    dbg!(spec);
    Ok(())
}

fn get_spec() -> eyre::Result<openapi::OpenApiV2> {
    let path = std::env::var_os("FORGEJO_API_SPEC_PATH")
        .unwrap_or_else(|| OsString::from("./api_spec.json"));
    let file = std::fs::read(path)?;
    let spec = serde_json::from_slice::<openapi::OpenApiV2>(&file)?;
    Ok(spec)
}