#[derive(ApiErrorComponent)]
{
// Attributes available to this derive:
#[openapi_error]
}
Expand description
Generates a reusable OpenAPI error schema.
This #[derive]
macro should be used in combination with api_operation.
The macro only supports one openapi_error
.
use apistos::ApiErrorComponent;
#[derive(Clone, ApiErrorComponent)]
#[openapi_error(
status(code = 403),
status(code = 404),
status(code = 405, description = "Invalid input"),
status(code = 409)
)]
pub enum ErrorResponse {
MethodNotAllowed(String),
NotFound(String),
Conflict(String),
Unauthorized(String),
}
ยง#[openapi_error(...)]
options:
status(...)
a list of possible error status withcode = 000
a required http status codedescription = "..."
an optional description, default is the canonical reason of the given status code