Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe committed Jul 11, 2024
1 parent 6fda912 commit 9b80d76
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/server/schema.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//! Dump schema of the REST API server.
use std::{fs::File, io::{self, Write}};
use std::{
fs::File,
io::{self, Write},
};

use utoipa::OpenApi as _;

Expand Down Expand Up @@ -34,15 +37,14 @@ pub fn run(args_common: &crate::common::Args, args: &Args) -> Result<(), anyhow:
tracing::info!("args_common = {:?}", &args_common);
tracing::info!("args = {:?}", &args);

let schema_yaml = ApiDoc::openapi().to_yaml().map_err(|e| {
anyhow::anyhow!("Failed to convert OpenAPI to YAML: {}", e)
})?;
let mut output = args.get_output().map_err(|e| {
anyhow::anyhow!("Failed to open output file: {}", e)
})?;
write!(output, "{}", &schema_yaml).map_err(|e| {
anyhow::anyhow!("Failed to write output: {}", e)
})?;
let schema_yaml = ApiDoc::openapi()
.to_yaml()
.map_err(|e| anyhow::anyhow!("Failed to convert OpenAPI to YAML: {}", e))?;
let mut output = args
.get_output()
.map_err(|e| anyhow::anyhow!("Failed to open output file: {}", e))?;
write!(output, "{}", &schema_yaml)
.map_err(|e| anyhow::anyhow!("Failed to write output: {}", e))?;

tracing::info!("All done. Have a nice day!");
Ok(())
Expand Down

0 comments on commit 9b80d76

Please sign in to comment.