Skip to main content

Module procedure_route

Module procedure_route 

Expand description

Canonical REST route path for a procedure, including its @api_version prefix.

The server mounts a procedure declared @api_version("v2") at /v2/$procs/<name> and every other procedure at /$procs/<name>, so a schema can serve v1 and v2 of an API side by side. Until this module existed that shape was derived in one place (cratestack-macros’s axum::procedure::route_attrs) and re-derived, without the version, in five more: the server’s own RouteTransportDescriptor (which the REST idempotency and rate-limit resolvers match MatchedPath against), the generated Rust, TypeScript and Dart clients, and the WireMock stub generator. Every versioned call from a generated client therefore missed with a 404. Same failure shape, and same fix, as cratestack#345’s crate::route_naming for model routes.

Do not reimplement these. Anything that needs a procedure’s REST path calls procedure_rest_route_path. Callers that embed the path in another language’s string literal escape it afterwards (Dart: $).

transport rpc does not use this path. There a procedure’s op id is procedure.<name> on the server and in every generated client, and @api_version does not enter it: procedure names are unique per schema (the parser rejects duplicates), so the op id is already unambiguous.

Functions§

procedure_api_version
The @api_version("...") value a procedure declares, if any.
procedure_rest_route_path
The HTTP path the server mounts procedure at on transport rest: /<version>/$procs/<name> when it declares @api_version, and /$procs/<name> otherwise. Relative to the router, so a consumer’s mount prefix (Router::nest, a client base path) goes in front.