|
I have my routes prefixed with What I'm looking to accomplish is to have Axum listening on the I've found #153, but that issue never got an answer. Any help would be greatly appreciated! Thank you! |
Answered by
zedseven
Feb 26, 2026
Replies: 1 comment
|
Once again, I figured out the answer shortly after asking the question. I was able to accomplish this using the following code in my fn transform_openapi(openapi: TransformOpenApi) -> TransformOpenApi {
let api_version_prefix: String = format!("/{API_VERSION}");
let mut openapi = openapi
.title(PROGRAM_PROPER_NAME)
.summary(env!("CARGO_PKG_DESCRIPTION"))
.version(env!("CARGO_PKG_VERSION"))
.server(Server {
url: api_version_prefix.clone(),
description: Some(format!("API {API_VERSION}.")),
variables: IndexMap::default(),
extensions: IndexMap::default(),
});
// Strip the API version prefix from all paths
if let Some(paths: &mut Paths) = &mut openapi.inner_mut().paths {
for (path: &mut String, _) in paths.paths.iter_mut2() {
if let Some(stripped_path: &str) = path.strip_prefix(api_version_prefix.as_str()) {
*path = stripped_path.to_owned();
}
}
}
openapi
} |
0 replies
Answer selected by
zedseven
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Once again, I figured out the answer shortly after asking the question.
I was able to accomplish this using the following code in my
OpenAPItransformation function: