pub struct ConformanceTap { /* private fields */ }Expand description
A passive conformance tap over one loaded spec.
Implementations§
Source§impl ConformanceTap
impl ConformanceTap
Sourcepub fn from_spec_value(spec: Value, strict: bool) -> Result<Self, String>
pub fn from_spec_value(spec: Value, strict: bool) -> Result<Self, String>
Build a tap from a raw OpenAPI 3.x document (JSON or YAML already parsed to a Value).
pub fn is_strict(&self) -> bool
Sourcepub fn match_template(
&self,
method: &str,
concrete_path: &str,
) -> Option<(String, HashMap<String, String>)>
pub fn match_template( &self, method: &str, concrete_path: &str, ) -> Option<(String, HashMap<String, String>)>
Match a concrete request path against spec templates.
Returns (template, extracted path params).
Sourcepub async fn validate_request(
&self,
method: &str,
concrete_path: &str,
query: Option<&str>,
headers: &HeaderMap,
body: Option<&[u8]>,
) -> Option<(u16, Value)>
pub async fn validate_request( &self, method: &str, concrete_path: &str, query: Option<&str>, headers: &HeaderMap, body: Option<&[u8]>, ) -> Option<(u16, Value)>
Validate an inbound request against the matched route.
Violations are recorded into the shared conformance buffer inside
run_validation_with_recording_ex. Returns Some((status, payload))
only in STRICT mode when validation fails, so the caller can reject
instead of forwarding.
Sourcepub async fn validate_response(
&self,
method: &str,
concrete_path: &str,
status: u16,
body: Option<&[u8]>,
)
pub async fn validate_response( &self, method: &str, concrete_path: &str, status: u16, body: Option<&[u8]>, )
Validate a response received from upstream against the matched route’s declared responses:
- undeclared status code (and no default) →
response-shapeviolation; - declared JSON schema → body validated via
validate_json_value, errors collapsed into oneresponse-shapeviolation.
Always observational; never mutates the response.
Auto Trait Implementations§
impl Freeze for ConformanceTap
impl RefUnwindSafe for ConformanceTap
impl Send for ConformanceTap
impl Sync for ConformanceTap
impl Unpin for ConformanceTap
impl UnsafeUnpin for ConformanceTap
impl UnwindSafe for ConformanceTap
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