1
0
Fork 0

add openapi parsing

This commit is contained in:
Cyborus 2024-01-10 22:09:06 -05:00
parent cf70a331d7
commit b9ba6e60d1
No known key found for this signature in database
6 changed files with 24721 additions and 22 deletions

17
generator/src/main.rs Normal file
View file

@ -0,0 +1,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)
}