okapi-operation 0.3.0

Procedural macro for generating OpenAPI operation specification (using okapi)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
/// Convert Axum path with templates to OpenAPI format.
pub(crate) fn convert_axum_path_to_openapi(path: &str) -> String {
    path.split('/')
        .map(|x| {
            if x.starts_with(':') {
                format!("{{{}}}", x.trim_matches(':'))
            } else {
                x.into()
            }
        })
        .collect::<Vec<_>>()
        .join("/")
}