pub struct OperationSpec {
pub method: Method,
pub path_template: String,
pub operation_id: Option<String>,
pub parameters: Vec<ParameterSpec>,
pub request_body_schema: Option<Value>,
pub request_body_required: bool,
pub responses: Vec<ResponseSpec>,
pub callbacks: Vec<CallbackSpec>,
}Expand description
Operation model.
Fields§
§method: MethodHTTP method.
path_template: StringPath template.
operation_id: Option<String>Operation id (if present).
parameters: Vec<ParameterSpec>Parameters.
request_body_schema: Option<Value>Request body schema.
request_body_required: boolWhether request body is required.
responses: Vec<ResponseSpec>Declared responses.
callbacks: Vec<CallbackSpec>OpenAPI callbacks (outbound requests fired after response).
Implementations§
Source§impl OperationSpec
impl OperationSpec
Sourcepub fn validate_request(
&self,
path_params: &HashMap<String, String>,
query_params: &HashMap<String, Vec<String>>,
headers: &HeaderMap,
body_json: Option<&Value>,
) -> Vec<ValidationIssue>
pub fn validate_request( &self, path_params: &HashMap<String, String>, query_params: &HashMap<String, Vec<String>>, headers: &HeaderMap, body_json: Option<&Value>, ) -> Vec<ValidationIssue>
Validate request parts.
Sourcepub fn mock_response(
&self,
seed: u64,
prefer: &PreferDirectives,
) -> Result<MockHttpResponse, RuntimeError>
pub fn mock_response( &self, seed: u64, prefer: &PreferDirectives, ) -> Result<MockHttpResponse, RuntimeError>
Build a mocked response from OpenAPI response entries.
The caller supplies [PreferDirectives] parsed from the request so the
engine can honour Prefer: code=…, Prefer: example=…, and
Prefer: dynamic=true.
Sourcepub fn response_schema_for_status(&self, status: u16) -> Option<&Value>
pub fn response_schema_for_status(&self, status: u16) -> Option<&Value>
Retrieve response schema by concrete status code with default fallback.
Trait Implementations§
Source§impl Clone for OperationSpec
impl Clone for OperationSpec
Source§fn clone(&self) -> OperationSpec
fn clone(&self) -> OperationSpec
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for OperationSpec
impl RefUnwindSafe for OperationSpec
impl Send for OperationSpec
impl Sync for OperationSpec
impl Unpin for OperationSpec
impl UnsafeUnpin for OperationSpec
impl UnwindSafe for OperationSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request