pub trait ToResponse {
    fn response() -> (String, Response);
}
Expand description

This trait is implemented to document a type which represents a single response which can be referenced or reused as a component in multiple operations.

Examples

use utoipa::{
    openapi::{Response, ResponseBuilder},
    ToResponse,
};

struct MyResponse;

impl ToResponse for MyResponse {
    fn response() -> (String, Response) {
        (
            "MyResponse".to_string(),
            ResponseBuilder::new().description("My Response").build(),
        )
    }
}

Required Methods

Returns a map of response component name (to be referenced) to a response.

Implementors