Skip to main content

PathItem

Struct PathItem 

Source
pub struct PathItem {
Show 16 fields pub reference: Option<String>, pub summary: Option<String>, pub description: Option<String>, pub get: Option<Box<Operation>>, pub put: Option<Box<Operation>>, pub post: Option<Box<Operation>>, pub delete: Option<Box<Operation>>, pub options: Option<Box<Operation>>, pub head: Option<Box<Operation>>, pub patch: Option<Box<Operation>>, pub trace: Option<Box<Operation>>, pub query: Option<Box<Operation>>, pub additional_operations: Map<Box<Operation>>, pub servers: Vec<Server>, pub parameters: Vec<RefOr<Parameter>>, pub extensions: Extensions,
}
Expand description

The operations available on a single path.

The per-method slots are boxed. An Operation is over a kilobyte, and inlining nine of them made this type 8.7 KB — a cost every Paths entry paid on insert and on rehash. Use operation and set_operation rather than touching the fields, and the indirection stays invisible.

Fields§

§reference: Option<String>

A reference to an external Path Item.

The specification leaves the behaviour of fields adjacent to this undefined, so Kynos never emits one.

§summary: Option<String>

A summary applying to every operation on this path.

§description: Option<String>

A description applying to every operation on this path.

§get: Option<Box<Operation>>

The GET operation.

§put: Option<Box<Operation>>

The PUT operation.

§post: Option<Box<Operation>>

The POST operation.

§delete: Option<Box<Operation>>

The DELETE operation.

§options: Option<Box<Operation>>

The OPTIONS operation.

§head: Option<Box<Operation>>

The HEAD operation.

§patch: Option<Box<Operation>>

The PATCH operation.

§trace: Option<Box<Operation>>

The TRACE operation.

§query: Option<Box<Operation>>

The QUERY operation.

Introduced in OpenAPI 3.2.

§additional_operations: Map<Box<Operation>>

Operations for methods with no dedicated field.

Introduced in OpenAPI 3.2. Keys are HTTP methods with the exact capitalization sent on the wire, and must not duplicate a method that has its own field.

§servers: Vec<Server>

Servers serving this path, overriding the document-level list.

§parameters: Vec<RefOr<Parameter>>

Parameters applying to every operation on this path.

Hoisting shared parameters here rather than repeating them on each operation is what keeps a large description readable.

§extensions: Extensions

Specification extensions.

Implementations§

Source§

impl PathItem

Source

pub fn new() -> Self

Creates a path item with no operations.

Source

pub fn operation(&self, method: Method) -> Option<&Operation>

Returns the operation for a method, if declared.

Source

pub fn set_operation( &mut self, method: Method, operation: Operation, ) -> Option<Operation>

Sets the operation for a method, returning any operation it replaced.

Source

pub fn operations(&self) -> impl Iterator<Item = (Method, &Operation)>

Iterates over the declared operations and their methods.

Source

pub fn with_operation(self, method: Method, operation: Operation) -> Self

Sets the operation for a method, in builder style.

Trait Implementations§

Source§

impl Clone for PathItem

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 PathItem

Source§

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

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

impl Default for PathItem

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for PathItem

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 PathItem

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 PathItem

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 PathItem

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.