mirror of
https://github.com/mailscope/kumomta.git
synced 2026-08-19 10:58:17 +00:00
a8163b6e48
This commit changes how the various http endpoints are registered; previously we had to define the handler function in one place, then in another, explicitly register that handler with a path and operation type with the router. If we wanted to also export documentation about that method, we would need to annotate the handler with a duplicate of the path and method type. There was a decent amount of boiler plate and it was very easy to omit some of that registration information, or for it to potentially drift or be mistranscribed. This commit eliminates most of the boiler plate; now we require that every endpoint be annotated with the utoipa::path macro, which centralizes the handler, path and method type definition in one place. To register the route and docs we now have a much simpler `router_and_docs!` macro that can register both the with the axum router and with the openapi docs machinery.