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: ExtensionsSpecification extensions.
Implementations§
Source§impl PathItem
impl PathItem
Sourcepub fn operation(&self, method: Method) -> Option<&Operation>
pub fn operation(&self, method: Method) -> Option<&Operation>
Returns the operation for a method, if declared.
Sourcepub fn set_operation(
&mut self,
method: Method,
operation: Operation,
) -> Option<Operation>
pub fn set_operation( &mut self, method: Method, operation: Operation, ) -> Option<Operation>
Sets the operation for a method, returning any operation it replaced.
Sourcepub fn operations(&self) -> impl Iterator<Item = (Method, &Operation)>
pub fn operations(&self) -> impl Iterator<Item = (Method, &Operation)>
Iterates over the declared operations and their methods.
Sourcepub fn with_operation(self, method: Method, operation: Operation) -> Self
pub fn with_operation(self, method: Method, operation: Operation) -> Self
Sets the operation for a method, in builder style.