Skip to main content

ap_handler

Macro ap_handler 

Source
macro_rules! ap_handler {
    (
        method: $method:expr,
        path: $path:expr,
        handler: $handler:ident,
        description: $desc:expr,
        tags: [$($tag:expr),* $(,)?],
        input_schema: $input:expr,
        output_schema: $output:expr $(,)?
    ) => { ... };
}
Expand description

Convenience macro for registering an Axum handler with apcore metadata.

§Example

use axum_apcore::ap_handler;
use serde_json::json;

ap_handler! {
    method: "GET",
    path: "/api/users/:id",
    handler: get_user,
    description: "Get a user by ID",
    tags: ["users"],
    input_schema: json!({"type": "object", "properties": {"id": {"type": "string"}}}),
    output_schema: json!({"type": "object", "properties": {"name": {"type": "string"}}}),
}