Attribute Macro dropshot::endpoint

source ·
#[endpoint]
Expand description

This attribute transforms a handler function into a Dropshot endpoint suitable to be used as a parameter to ApiDescription::register(). It encodes information relevant to the operation of an API endpoint beyond what is expressed by the parameter and return types of a handler function.

#[endpoint {
    // Required fields
    method = { DELETE | HEAD | GET | OPTIONS | PATCH | POST | PUT },
    path = "/path/name/with/{named}/{variables}",

    // Optional tags for the operation's description
    tags = [ "all", "your", "OpenAPI", "tags" ],
    // Specifies the media type used to encode the request body
    content_type = { "application/json" | "application/x-www-form-urlencoded" | "multipart/form-data" }
    // A value of `true` marks the operation as deprecated
    deprecated = { true | false },
    // A value of `true` causes the operation to be omitted from the API description
    unpublished = { true | false },
}]

See the dropshot documentation for how to specify an endpoint or a description of the attribute parameters