Closed itsbalamurali closed 9 months ago
You can with something like this
let mut api = OpenApi::default();
let app1 = ApiRouter::new()
.api_route("/api/test_fn", routing::post(test_fn1))
.nest_api_service("/api/docs", docs_routes())
.finish_api_with(&mut api, api_docs)
.layer(Extension(Arc::new(Mutex::new(api))));
let mut api = OpenApi::default();
let app2 = ApiRouter::new()
.api_route("/api2/test_fn", routing::post(test_fn2))
.nest_api_service("/api2/docs", docs2_routes())
.finish_api_with(&mut api, api_docs)
.layer(Extension(Arc::new(Mutex::new(api))));
let app = axum::Router::new()
.merge(app1)
.merge(app2);
let tcp_listener = tokio::net::TcpListener::bind("0.0.0.0:3001").await?;
axum::serve(tcp_listener, app).await?;
Is this what you needed? Or did I misunderstand you?
@y-haidar yes! thanks a lot!!
Currently, the aide library does not seem to support hosting multiple OpenAPI schemas within the same Axum application.
This limitation restricts the flexibility of the application, especially when it comes to managing and documenting larger projects with multiple APIs.
The ability to host multiple OpenAPI schemas would allow developers to better organize their APIs, especially in microservice architectures or in applications with distinct sections requiring separate API documentation.
This feature request is to add support for hosting multiple OpenAPI schemas within the same Axum application.
This would involve modifying the ApiRouter struct and related functions to handle multiple schemas, and ensuring that each schema can be accessed and managed independently.
This feature would greatly enhance the flexibility and scalability of applications built with aide and Axum.