pub struct Operation { /* private fields */ }Expand description
Description of one operation (method + path)
Implementations§
Source§impl Operation
impl Operation
pub fn new(summary: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
pub fn tag(self, tag: impl Into<String>) -> Self
pub fn operation_id(self, id: impl Into<String>) -> Self
pub fn deprecated(self) -> Self
Sourcepub fn secured_by_api_key(self, header: impl Into<String>) -> Self
pub fn secured_by_api_key(self, header: impl Into<String>) -> Self
Requires an API key in the given header (e.g. x-api-key)
Sourcepub fn path_param(self, name: &str, schema: Value, description: &str) -> Self
pub fn path_param(self, name: &str, schema: Value, description: &str) -> Self
Describe a path parameter (undeclared ones default to string)
pub fn query_param( self, name: &str, schema: Value, description: &str, required: bool, ) -> Self
pub fn header_param( self, name: &str, schema: Value, description: &str, required: bool, ) -> Self
Sourcepub fn request_json(self, schema: Value) -> Self
pub fn request_json(self, schema: Value) -> Self
JSON request body with the given schema
Sourcepub fn request_form(self, schema: Value) -> Self
pub fn request_form(self, schema: Value) -> Self
application/x-www-form-urlencoded request body
Sourcepub fn response(self, status: u16, description: &str) -> Self
pub fn response(self, status: u16, description: &str) -> Self
Response without a body description
pub fn response_json( self, status: u16, description: &str, schema: Value, ) -> Self
Sourcepub fn error_response(self, status: u16, description: &str) -> Self
pub fn error_response(self, status: u16, description: &str) -> Self
Response using the framework’s error body { "error": "...", "status": 404 }
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Operation
impl RefUnwindSafe for Operation
impl Send for Operation
impl Sync for Operation
impl Unpin for Operation
impl UnsafeUnpin for Operation
impl UnwindSafe for Operation
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