pub struct PathInfo {
pub method: String,
pub summary: String,
pub description: Option<String>,
pub tags: Vec<String>,
pub parameters: Vec<Value>,
pub request_body: Option<RequestBody>,
pub responses: HashMap<String, Value>,
pub security: Vec<SecurityRequirement>,
pub operation_id: Option<String>,
pub deprecated: Option<bool>,
}Expand description
Describes a single (path, method) operation in an OpenAPI spec.
Fields§
§method: String§summary: String§description: Option<String>§parameters: Vec<Value>§request_body: Option<RequestBody>§responses: HashMap<String, Value>§security: Vec<SecurityRequirement>§operation_id: Option<String>§deprecated: Option<bool>Implementations§
Source§impl PathInfo
impl PathInfo
pub fn new(method: &str, summary: &str) -> Self
pub fn with_response(self, code: &str, desc: &str) -> Self
Sourcepub fn with_response_schema(
self,
code: &str,
desc: &str,
schema_ref: &str,
) -> Self
pub fn with_response_schema( self, code: &str, desc: &str, schema_ref: &str, ) -> Self
Adds a response with a Schema
pub fn with_parameter(self, param: Value) -> Self
Sourcepub fn with_path_param(self, name: &str, desc: &str, required: bool) -> Self
pub fn with_path_param(self, name: &str, desc: &str, required: bool) -> Self
Adds a path parameter
Sourcepub fn with_query_param(self, name: &str, desc: &str, required: bool) -> Self
pub fn with_query_param(self, name: &str, desc: &str, required: bool) -> Self
Adds a query parameter
Sourcepub fn with_request_body(self, body: RequestBody) -> Self
pub fn with_request_body(self, body: RequestBody) -> Self
Sets the request body
Sourcepub fn with_request_body_ref(
self,
desc: &str,
schema_ref: &str,
required: bool,
) -> Self
pub fn with_request_body_ref( self, desc: &str, schema_ref: &str, required: bool, ) -> Self
Sets the request body (simplified: references a Schema)
Sourcepub fn with_operation_id(self, id: &str) -> Self
pub fn with_operation_id(self, id: &str) -> Self
Sets the operation ID
Sourcepub fn with_security(self, req: SecurityRequirement) -> Self
pub fn with_security(self, req: SecurityRequirement) -> Self
Sets the security requirement
Sourcepub fn deprecated(self) -> Self
pub fn deprecated(self) -> Self
Marks as deprecated
Sourcepub fn with_description(self, desc: &str) -> Self
pub fn with_description(self, desc: &str) -> Self
Sets the description
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PathInfo
impl<'de> Deserialize<'de> for PathInfo
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 PathInfo
impl RefUnwindSafe for PathInfo
impl Send for PathInfo
impl Sync for PathInfo
impl Unpin for PathInfo
impl UnsafeUnpin for PathInfo
impl UnwindSafe for PathInfo
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more