Skip to main content

proto_path_to_axum

Function proto_path_to_axum 

Source
pub fn proto_path_to_axum(path: &str) -> String
Expand description

Convert a google.api.http path template to axum 0.8 path syntax.

The proto {param} form IS axum 0.8’s native capture syntax, so plain single-segment params pass through verbatim. Only field-path templates and bare wildcards need rewriting (axum 0.7 used :param; 0.8 uses {param} and rejects any segment starting with :):

  • {name=*} (single segment) -> {name}
  • {name=**} (multi-segment) -> {*name} (axum catch-all)
  • bare * segment -> {wildcardN}
  • bare ** segment -> {*wildcardN} (axum catch-all)