Expand description
§poem-openapi-problemdetails-macro
This crate provides an integration layer between the problemdetails and poem_openapi.
§Usage
To use the provided macro, first implement [std::error::StdError] for you like. Use the
ApiProblemDetails macro.
#[derive(Debug, thiserror::Error, poem_openapi_problemdetails::ApiProblemDetails)]
enum EndpointError {
#[error("An invalid value was provided")]
#[oai_problemdetails(
status = 422,
title = "An invalid value was provided",
ty = "https://example.net/validation-error"
)]
InvalidValue
}Doing so adds the response to the generated openapi specification.
§Fields
The following fields can be provided at this moment
| Name | Field name | Required | Description |
|---|---|---|---|
| status | status | true | The HTTP status code generated by the origin server for this occurrence of the problem |
| title | title | false | A short, human-readable summary of the problem type |
| ty | type | false | A URI reference [RFC3986] that identifies the problem type. |
| detail | detail | false | A human-readable explanation specific to this occurrence of the problem. |
Re-exports§
pub use poem;pub use poem_openapi;pub use problemdetails;pub use serde_json;
Derive Macros§
- ApiProblem
Details - Macro to generate problemdetails responses based on the provided macro input. See the root libary for documentation.