refactor(openapi): add openapi support for generating v2 api-reference (#5580)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sai Harsha Vardhan
2024-08-09 20:30:59 +05:30
committed by GitHub
parent 942e63d9cd
commit 92d76a361a
14 changed files with 17853 additions and 15 deletions

View File

@ -1,13 +1,23 @@
#[cfg(feature = "v1")]
mod openapi;
#[cfg(feature = "v2")]
mod openapi_v2;
mod routes;
fn main() {
#[cfg(feature = "v1")]
let relative_file_path = "api-reference/openapi_spec.json";
#[cfg(feature = "v2")]
let relative_file_path = "api-reference/openapi_spec_v2.json";
let mut file_path = router_env::workspace_path();
file_path.push(relative_file_path);
#[cfg(feature = "v1")]
let openapi = <openapi::ApiDoc as utoipa::OpenApi>::openapi();
#[cfg(feature = "v2")]
let openapi = <openapi_v2::ApiDoc as utoipa::OpenApi>::openapi();
#[allow(clippy::expect_used)]
std::fs::write(