Derive Macro poem_openapi::ResponseContent

source ·
#[derive(ResponseContent)]
{
    // Attributes available to this derive:
    #[oai]
}
Expand description

Define a OpenAPI response content.

Item parameters

AttributeDescriptionTypeOptional
content_typeSpecify the content type.stringY
actual_typeSpecifies the actual response typestringY

Examples

use poem_openapi::{
    payload::{Binary, Json, PlainText},
    ApiResponse, ResponseContent,
};

#[derive(ResponseContent)]
enum MyResponseContent {
    A(Json<i32>),
    B(PlainText<String>),
    C(Binary<Vec<u8>>),
}

#[derive(ApiResponse)]
enum MyResponse {
    #[oai(status = 200)]
    Ok(MyResponseContent),
}