OAS: yaml to json

This commit is contained in:
realaravinth
2021-04-01 15:23:36 +05:30
parent 55dd3fffe5
commit e83ed3d8ea
9 changed files with 92 additions and 424 deletions

View File

@@ -16,6 +16,7 @@
*/
use std::process::Command;
fn main() {
// note: add error checking yourself.
let output = Command::new("git")
@@ -24,4 +25,11 @@ fn main() {
.unwrap();
let git_hash = String::from_utf8(output.stdout).unwrap();
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
let yml = include_str!("./openapi.yaml");
let api_json: serde_json::Value = serde_yaml::from_str(yml).unwrap();
println!(
"cargo:rustc-env=OPEN_API_DOCS={}",
serde_json::to_string(&api_json).unwrap()
);
}