mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-11-04 05:59:48 +08:00 
			
		
		
		
	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:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							942e63d9cd
						
					
				
				
					commit
					92d76a361a
				
			@ -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(
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user