pub struct Fixture {Show 21 fields
pub id: String,
pub category: Option<String>,
pub description: String,
pub docs: Option<FixtureDocs>,
pub requirements: Vec<String>,
pub tags: Vec<String>,
pub skip: Option<SkipDirective>,
pub env: Option<FixtureEnv>,
pub setup: Vec<SetupCall>,
pub call: Option<String>,
pub input: Value,
pub preserve_input_urls: bool,
pub mock_response: Option<MockResponse>,
pub visitor: Option<VisitorSpec>,
pub args: Vec<ArgMapping>,
pub assertion_recipes: Vec<String>,
pub assertions: Vec<Assertion>,
pub source: String,
pub http: Option<HttpFixture>,
pub asyncapi: Option<AsyncApiFixture>,
pub websocket: Option<WebSocketFixture>,
}Expand description
A single e2e test fixture.
Fields§
§id: StringUnique identifier (used as test function name).
category: Option<String>Optional category (defaults to parent directory name).
description: StringHuman-readable description.
docs: Option<FixtureDocs>§requirements: Vec<String>Declarative capabilities required to publish this fixture as a snippet.
skip: Option<SkipDirective>§env: Option<FixtureEnv>Environment variable requirements (used by smoke/live tests).
setup: Vec<SetupCall>Setup calls executed before the main call (used to register backends, etc).
call: Option<String>Named call config to use (references [e2e.calls.<name>]).
When omitted, uses the default [e2e.call].
input: ValueInput data passed to the function under test.
preserve_input_urls: boolPass this fixture’s declared URLs to the call verbatim instead of substituting the mock server address.
~keep mock_url and mock_url_list arguments normally ignore input.url /
input.urls entirely and bind the per-fixture mock server address, because
almost every fixture wants a live server to talk to. A minority of fixtures
are testing the address itself — SSRF policy, scheme rejection, host parsing
— and for those the substitution silently replaces the subject of the test, so
several fixtures declaring different addresses all end up exercising one
trivial case and passing for the wrong reason.
This is opt-in per fixture rather than inferred: an “is it absolute?” heuristic would reclassify existing fixtures that legitimately declare an absolute URL next to a mock server, changing their meaning without anyone editing them.
mock_response: Option<MockResponse>Optional mock HTTP response for testing HTTP clients.
visitor: Option<VisitorSpec>Optional visitor specification for visitor pattern tests.
args: Vec<ArgMapping>Fixture-level argument mappings. When non-empty, overrides call_config.args for this specific fixture (used for trait-bridge stubs and other per-fixture args).
assertion_recipes: Vec<String>Assertion recipes this fixture opts into.
Domain-shaped assertions such as embeddings, keyword extraction, tree-query helpers, and streaming pseudo-fields require an explicit recipe opt-in so generic e2e fixtures don’t silently inherit project-specific assumptions.
assertions: Vec<Assertion>List of assertions to check.
source: StringSource file path (populated during loading).
http: Option<HttpFixture>HTTP server test specification. When present, this fixture tests an HTTP handler rather than a function call.
asyncapi: Option<AsyncApiFixture>§websocket: Option<WebSocketFixture>Implementations§
Source§impl Fixture
impl Fixture
Sourcepub fn docs_client(&self) -> Option<&FixtureDocsClient>
pub fn docs_client(&self) -> Option<&FixtureDocsClient>
The client construction this fixture’s documentation snippet must use, if it declares one.
This is docs-only and is deliberately not folded into
Fixture::docs_call_fixture’s returned value: the fixture it returns is fed
to renderers that also serve the executable e2e suite, where retargeting the
client away from the mock server would silently turn a real test into a call
against the illustrative endpoint the prose is about. Generators must therefore
pass this value in explicitly from a documentation-only call site.
pub fn docs_call_fixture(&self) -> Self
pub fn docs_files_for_arg(&self, field: &str) -> Vec<FixtureDocsFileInput>
pub fn docs_file_path(&self, field: &str) -> Option<String>
pub fn has_docs_presentation(&self) -> bool
Sourcepub fn resolved_args<'a>(
&'a self,
call_config: &'a CallConfig,
) -> &'a [ArgMapping]
pub fn resolved_args<'a>( &'a self, call_config: &'a CallConfig, ) -> &'a [ArgMapping]
Resolve the effective args for this fixture, preferring fixture-level args when present.
When self.args is non-empty, returns a reference to it. Otherwise, returns
a reference to call_config.args. This allows fixtures to override the call’s
default args (e.g., for trait-bridge stubs that need per-fixture test backend setup).
Sourcepub fn is_http_test(&self) -> bool
pub fn is_http_test(&self) -> bool
Returns true if this is an HTTP server test fixture.
Sourcepub fn needs_mock_server(&self) -> bool
pub fn needs_mock_server(&self) -> bool
Returns true if this fixture requires a mock HTTP server.
This is true when the fixture declares a single mock response, an HTTP expected
response, or one or more entries in the generic input.mock_responses route array.
Sourcepub fn as_mock_response(&self) -> Option<MockResponse>
pub fn as_mock_response(&self) -> Option<MockResponse>
Returns the effective mock response for this fixture, bridging both schemas:
- call fixture schema:
mock_response: { status, body, stream_chunks } - HTTP fixture schema:
http.expected_response: { status_code, body, headers }
Returns None if neither schema is present.
Sourcepub fn is_streaming_mock(&self) -> bool
pub fn is_streaming_mock(&self) -> bool
Returns true if the mock response uses streaming (SSE).
Sourcepub fn has_host_root_route(&self) -> bool
pub fn has_host_root_route(&self) -> bool
Returns true if this fixture needs a dedicated origin-root listener.
Route-array fixtures are normally mounted under /fixtures/<id> in the shared
mock server. A dedicated listener is required when a route path or fixture body
makes the client under test resolve follow-up requests from the origin root rather
than the fixture namespace. Mirrors the is_host_root_path predicate in the
standalone mock-server binary (codegen/rust/mock_server.rs).
Origin-root fixtures get a dedicated per-fixture listener and their base URL is
published in the MOCK_SERVERS={"fixture_id":"http://..."} JSON line.
Sourcepub fn resolved_category(&self) -> String
pub fn resolved_category(&self) -> String
Get the resolved category (explicit or from source directory).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Fixture
impl<'de> Deserialize<'de> for Fixture
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Fixture
impl RefUnwindSafe for Fixture
impl Send for Fixture
impl Sync for Fixture
impl Unpin for Fixture
impl UnsafeUnpin for Fixture
impl UnwindSafe for Fixture
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more