pub struct HttpResponse {
pub status: StatusCode,
pub description: String,
pub headers: BTreeMap<String, Header>,
pub contents: BTreeMap<ContentType, Option<RefOr<Schema>>>,
}Expand description
Normalized representation of an OpenAPI response for template generation.
HttpResponse captures the status code, body schemas grouped by content type,
a human-readable description, and response headers. It is consumed by the
TypeScript generators to drive return-type and transformer creation.
Fields§
§status: StatusCode§description: String§headers: BTreeMap<String, Header>§contents: BTreeMap<ContentType, Option<RefOr<Schema>>>Implementations§
Source§impl HttpResponse
impl HttpResponse
Sourcepub fn from_openapi(status: StatusCode, response: &Response) -> HttpResponse
pub fn from_openapi(status: StatusCode, response: &Response) -> HttpResponse
Construct an HttpResponse from the resolved OpenAPI Response.
The method copies metadata we need during code generation while preserving any referenced schemas for later resolution.
pub fn is_success(&self) -> bool
pub fn is_default(&self) -> bool
pub fn json_schema(&self) -> Option<&RefOr<Schema>>
pub fn content_types(&self) -> impl Iterator<Item = &ContentType>
pub fn has_body(&self) -> bool
pub fn has_json_body(&self) -> bool
Trait Implementations§
Source§impl Clone for HttpResponse
impl Clone for HttpResponse
Source§fn clone(&self) -> HttpResponse
fn clone(&self) -> HttpResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HttpResponse
impl Debug for HttpResponse
Source§impl<'de> Deserialize<'de> for HttpResponse
impl<'de> Deserialize<'de> for HttpResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for HttpResponse
impl RefUnwindSafe for HttpResponse
impl Send for HttpResponse
impl Sync for HttpResponse
impl Unpin for HttpResponse
impl UnwindSafe for HttpResponse
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more