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 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: ResponsesThe 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: ExtensionsSpecification extensions.
Implementations§
Source§impl Operation
impl Operation
Sourcepub fn new(operation_id: impl Into<String>) -> Self
pub fn new(operation_id: impl Into<String>) -> Self
Creates an operation identified by operation_id.
Sourcepub fn with_summary(self, summary: impl Into<String>) -> Self
pub fn with_summary(self, summary: impl Into<String>) -> Self
Sets the summary.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Sets the description.
Sourcepub fn with_parameter(self, parameter: Parameter) -> Self
pub fn with_parameter(self, parameter: Parameter) -> Self
Adds a parameter.
Sourcepub fn with_request_body(self, body: RequestBody) -> Self
pub fn with_request_body(self, body: RequestBody) -> Self
Sets the request body.
Sourcepub fn with_responses(self, responses: Responses) -> Self
pub fn with_responses(self, responses: Responses) -> Self
Sets the responses.
Sourcepub fn with_security(self, requirement: SecurityRequirement) -> Self
pub fn with_security(self, requirement: SecurityRequirement) -> Self
Adds a security requirement.
Sourcepub fn deprecated(self) -> Self
pub fn deprecated(self) -> Self
Marks the operation deprecated.