pub struct Operation { /* private fields */ }Expand description
One documented operation: a method on a path.
Everything is optional. An operation with nothing set still appears in the document, which is the point of seeding from the router: an undocumented endpoint shows up as an endpoint rather than as nothing.
Implementations§
Source§impl Operation
impl Operation
Sourcepub fn summary(self, text: impl Into<String>) -> Self
pub fn summary(self, text: impl Into<String>) -> Self
A one-line summary, shown as the operation’s title in most viewers.
Sourcepub fn description(self, text: impl Into<String>) -> Self
pub fn description(self, text: impl Into<String>) -> Self
A longer description. CommonMark is allowed by the specification.
Sourcepub fn operation_id(self, id: impl Into<String>) -> Self
pub fn operation_id(self, id: impl Into<String>) -> Self
An explicit operationId.
Client generators use it for the generated method name. Left unset, one is derived from the method and path, which is stable as long as the route is.
Sourcepub fn deprecated(self) -> Self
pub fn deprecated(self) -> Self
Mark the operation deprecated.
Sourcepub fn query(self, name: impl Into<String>, required: bool) -> Self
pub fn query(self, name: impl Into<String>, required: bool) -> Self
Document a query parameter.
Sourcepub fn query_described(
self,
name: impl Into<String>,
required: bool,
description: impl Into<String>,
) -> Self
pub fn query_described( self, name: impl Into<String>, required: bool, description: impl Into<String>, ) -> Self
Document a query parameter with a description.
Sourcepub fn accepts(self, media_type: impl Into<String>) -> Self
pub fn accepts(self, media_type: impl Into<String>) -> Self
Document the request body’s media type, with no schema.
Sourcepub fn schema(self, media_type: impl Into<String>, schema: Value) -> Self
pub fn schema(self, media_type: impl Into<String>, schema: Value) -> Self
Document the request body with a JSON Schema.
The schema is any serde_json::Value, so one produced by schemars or
written by hand fits equally well.