Struct hypers_openapi::Parameter
source · #[non_exhaustive]pub struct Parameter {
pub name: String,
pub parameter_in: ParameterIn,
pub description: Option<String>,
pub required: Required,
pub deprecated: Option<Deprecated>,
pub schema: Option<RefOr<Schema>>,
pub style: Option<ParameterStyle>,
pub explode: Option<bool>,
pub allow_reserved: Option<bool>,
pub extensions: Option<HashMap<String, Value>>,
/* private fields */
}Expand description
Implements OpenAPI Parameter Object for Operation.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringName of the parameter.
- For
ParameterIn::Paththis must in accordance to path templating. - For
ParameterIn::QueryContent-TypeorAuthorizationvalue will be ignored.
parameter_in: ParameterInParameter location.
description: Option<String>Markdown supported description of the parameter.
required: RequiredDeclares whether the parameter is required or not for api.
- For
ParameterIn::Paththis must and will beRequired::True.
deprecated: Option<Deprecated>Declares the parameter deprecated status.
schema: Option<RefOr<Schema>>Schema of the parameter. Typically Schema::Object is used.
style: Option<ParameterStyle>Describes how Parameter is being serialized depending on Parameter::schema (type of a content).
Default value is based on ParameterIn.
explode: Option<bool>When true it will generate separate parameter value for each parameter with array and object type.
This is also true by default for ParameterStyle::Form.
With explode false:
color=blue,black,brown
With explode true:
color=blue&color=black&color=brown
allow_reserved: Option<bool>Defines whether parameter should allow reserved characters defined by
RFC3986 :/?#[]@!$&'()*+,;=.
This is only applicable with ParameterIn::Query. Default value is false.
extensions: Option<HashMap<String, Value>>Optional extensions “x-something”
Implementations§
source§impl Parameter
impl Parameter
sourcepub fn new<S: Into<String>>(name: S) -> Self
pub fn new<S: Into<String>>(name: S) -> Self
Constructs a new required Parameter with given name.
sourcepub fn parameter_in(self, parameter_in: ParameterIn) -> Self
pub fn parameter_in(self, parameter_in: ParameterIn) -> Self
Add in of the Parameter.
sourcepub fn required(self, required: impl Into<Required>) -> Self
pub fn required(self, required: impl Into<Required>) -> Self
Add required declaration of the Parameter. If ParameterIn::Path is
defined this is always Required::True.
sourcepub fn description<S: Into<String>>(self, description: S) -> Self
pub fn description<S: Into<String>>(self, description: S) -> Self
Add or change description of the Parameter.
sourcepub fn deprecated<D: Into<Deprecated>>(self, deprecated: D) -> Self
pub fn deprecated<D: Into<Deprecated>>(self, deprecated: D) -> Self
Add or change Parameter deprecated declaration.
sourcepub fn schema<I: Into<RefOr<Schema>>>(self, component: I) -> Self
pub fn schema<I: Into<RefOr<Schema>>>(self, component: I) -> Self
Add or change Parameters schema.
sourcepub fn style(self, style: ParameterStyle) -> Self
pub fn style(self, style: ParameterStyle) -> Self
Add or change serialization style of Parameter.
sourcepub fn allow_reserved(self, allow_reserved: bool) -> Self
pub fn allow_reserved(self, allow_reserved: bool) -> Self
Add or change whether Parameter should allow reserved characters.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Parameter
impl<'de> Deserialize<'de> for Parameter
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>,
source§impl PartialEq for Parameter
impl PartialEq for Parameter
impl StructuralPartialEq for Parameter
Auto Trait Implementations§
impl Freeze for Parameter
impl RefUnwindSafe for Parameter
impl Send for Parameter
impl Sync for Parameter
impl Unpin for Parameter
impl UnwindSafe for Parameter
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)