logo
pub trait ApiResponse: Sized {
    const BAD_REQUEST_HANDLER: bool = false;

    fn meta() -> MetaResponses;
    fn register(registry: &mut Registry);

    fn from_parse_request_error(err: Error) -> Self { ... }
}
Expand description

Represents a OpenAPI responses object.

Provided Implementations

  • Binary<T: Type>

    A binary response with content type application/octet-stream.

  • Json<T: Type>

    A JSON response with content type application/json.

  • PlainText<T: Type>

    A utf8 string response with content type text/plain.

  • Attachment<T: Type>

    A file download response, the content type is application/octet-stream.

  • Response<T: Type>

    A response type use it to modify the status code and HTTP headers.

  • ()

    It means that this API does not have any response body.

  • poem::Result<T: ApiResponse>

    It means that an error may occur in this API.

  • Any type derived from the ApiResponse macro

    A complex response derived from the ApiResponse macro.

Provided Associated Constants

If true, it means that the response object has a custom bad request handler.

Required Methods

Gets metadata of this response.

Register the schema contained in this response object to the registry.

Provided Methods

Convert poem::Error to this response object.

Implementations on Foreign Types

Implementors