-
-
Notifications
You must be signed in to change notification settings - Fork 331
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description of the feature
Implement Example
trait for ApiResponse
/ ResponseContent
Code example (if possible)
In a similar maner to how with the Object
macro you can specify
#[derive(Serialize, Deserialize, Object)]
#[oai(example)]
pub struct MyStruct {
...
}
You would be able to specify it for arbitrary (user defined) response types
#[derive(ResponseContent)]
#[oai(example)]
enum IcsContent {
#[oai(content_type = "text/calendar")]
Calendar(PlainText<String>),
}
#[derive(ApiResponse)]
enum CalendarResponse {
#[oai(status = 200)]
Ok(IcsContent),
}
const SAMPLE_ICS: &str = include_str!(".//sample.ics");
impl Example for IcsContent {
fn example() -> Self {
Self::Calendar(PlainText(SAMPLE_ICS.to_string()))
}
}
zexa
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request