mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 11:06:50 +08:00
doc: update openapi (#453)
Co-authored-by: Sangamesh <sangamesh.kulkarni@juspay.in> Co-authored-by: dracarys18 <karthikey.hegde@juspay.in> Co-authored-by: bernard eugine <bernard.eugine@bernard.eugine-MacBookPro> Co-authored-by: Abhishek Marrivagu <abhi.codes10@gmail.com>
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
use router::{
|
||||
configs::settings::{CmdLineConf, Settings, Subcommand},
|
||||
configs::settings::{CmdLineConf, Settings},
|
||||
core::errors::{ApplicationError, ApplicationResult},
|
||||
logger,
|
||||
};
|
||||
@ -8,18 +8,23 @@ use router::{
|
||||
async fn main() -> ApplicationResult<()> {
|
||||
// get commandline config before initializing config
|
||||
let cmd_line = <CmdLineConf as clap::Parser>::parse();
|
||||
if let Some(Subcommand::GenerateOpenapiSpec) = cmd_line.subcommand {
|
||||
let file_path = "openapi/generated.json";
|
||||
#[allow(clippy::expect_used)]
|
||||
std::fs::write(
|
||||
file_path,
|
||||
<router::openapi::ApiDoc as utoipa::OpenApi>::openapi()
|
||||
.to_pretty_json()
|
||||
.expect("Failed to generate serialize OpenAPI specification as JSON"),
|
||||
)
|
||||
.expect("Failed to write OpenAPI specification to file");
|
||||
println!("Successfully saved OpenAPI specification file at '{file_path}'");
|
||||
return Ok(());
|
||||
|
||||
#[cfg(feature = "openapi")]
|
||||
{
|
||||
use router::configs::settings::Subcommand;
|
||||
if let Some(Subcommand::GenerateOpenapiSpec) = cmd_line.subcommand {
|
||||
let file_path = "openapi/generated.json";
|
||||
#[allow(clippy::expect_used)]
|
||||
std::fs::write(
|
||||
file_path,
|
||||
<router::openapi::ApiDoc as utoipa::OpenApi>::openapi()
|
||||
.to_pretty_json()
|
||||
.expect("Failed to generate serialize OpenAPI specification as JSON"),
|
||||
)
|
||||
.expect("Failed to write OpenAPI specification to file");
|
||||
println!("Successfully saved OpenAPI specification file at '{file_path}'");
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::expect_used)]
|
||||
|
||||
Reference in New Issue
Block a user