Skip to main content

Operation

Struct Operation 

Source
pub struct Operation {
Show 13 fields pub tags: Vec<String>, pub summary: Option<String>, pub description: Option<String>, pub external_docs: Option<ExternalDocumentation>, pub operation_id: Option<String>, pub parameters: Vec<RefOr<Parameter>>, pub request_body: Option<RefOr<RequestBody>>, pub responses: Responses, pub callbacks: Map<RefOr<Callback>>, pub deprecated: Option<bool>, pub security: Option<Vec<SecurityRequirement>>, pub servers: Vec<Server>, pub extensions: Extensions,
}
Expand description

A single API operation on a path.

Fields§

§tags: Vec<String>

Tags for grouping this operation.

§summary: Option<String>

A short summary of what the operation does.

§description: Option<String>

A verbose explanation. CommonMark syntax may be used.

§external_docs: Option<ExternalDocumentation>

Additional external documentation.

§operation_id: Option<String>

A case-sensitive identifier, unique across the whole description.

Optional per the specification, but Kynos always emits one: it is what client generators name their methods after, and what a Link refers to.

§parameters: Vec<RefOr<Parameter>>

Parameters applying to this operation.

An entry here with the same name and location as one on the enclosing PathItem overrides it, but cannot remove it.

§request_body: Option<RefOr<RequestBody>>

The request body.

§responses: Responses

The responses this operation may return.

§callbacks: Map<RefOr<Callback>>

Out-of-band requests made as part of this operation.

§deprecated: Option<bool>

Whether this operation is deprecated.

§security: Option<Vec<SecurityRequirement>>

The security requirements, overriding the document-level list.

An empty vector is not the same as absent: it removes the document-level requirement, making the operation anonymous.

§servers: Vec<Server>

Servers serving this operation, overriding wider declarations.

§extensions: Extensions

Specification extensions.

Implementations§

Source§

impl Operation

Source

pub fn new(operation_id: impl Into<String>) -> Self

Creates an operation identified by operation_id.

Source

pub fn with_summary(self, summary: impl Into<String>) -> Self

Sets the summary.

Source

pub fn with_description(self, description: impl Into<String>) -> Self

Sets the description.

Source

pub fn with_tag(self, tag: impl Into<String>) -> Self

Adds a tag.

Source

pub fn with_parameter(self, parameter: Parameter) -> Self

Adds a parameter.

Source

pub fn with_request_body(self, body: RequestBody) -> Self

Sets the request body.

Source

pub fn with_responses(self, responses: Responses) -> Self

Sets the responses.

Source

pub fn with_security(self, requirement: SecurityRequirement) -> Self

Adds a security requirement.

Source

pub fn deprecated(self) -> Self

Marks the operation deprecated.

Trait Implementations§

Source§

impl Clone for Operation

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Operation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Operation

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Operation

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Operation

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Operation

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Operation

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.