mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-04 05:59:48 +08:00
refactor(openapi_v2): add merchant account v2 openapi (#5588)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -10,9 +10,12 @@ fn main() {
|
||||
let relative_file_path = "api-reference/openapi_spec.json";
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
let relative_file_path = "api-reference/openapi_spec_v2.json";
|
||||
let relative_file_path = "api-reference-v2/openapi_spec.json";
|
||||
|
||||
#[cfg(any(feature = "v1", feature = "v2"))]
|
||||
let mut file_path = router_env::workspace_path();
|
||||
|
||||
#[cfg(any(feature = "v1", feature = "v2"))]
|
||||
file_path.push(relative_file_path);
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
@ -21,6 +24,7 @@ fn main() {
|
||||
let openapi = <openapi_v2::ApiDoc as utoipa::OpenApi>::openapi();
|
||||
|
||||
#[allow(clippy::expect_used)]
|
||||
#[cfg(any(feature = "v1", feature = "v2"))]
|
||||
std::fs::write(
|
||||
file_path,
|
||||
openapi
|
||||
@ -28,5 +32,10 @@ fn main() {
|
||||
.expect("Failed to serialize OpenAPI specification as JSON"),
|
||||
)
|
||||
.expect("Failed to write OpenAPI specification to file");
|
||||
|
||||
#[cfg(any(feature = "v1", feature = "v2"))]
|
||||
println!("Successfully saved OpenAPI specification file at '{relative_file_path}'");
|
||||
|
||||
#[cfg(not(any(feature = "v1", feature = "v2")))]
|
||||
println!("No feature enabled to generate OpenAPI specification, please enable either 'v1' or 'v2' feature");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user