pub struct E2eConfig {Show 23 fields
pub fixtures: String,
pub output: String,
pub test_documents_dir: String,
pub languages: Vec<String>,
pub call: CallConfig,
pub calls: HashMap<String, CallConfig>,
pub packages: HashMap<String, PackageRef>,
pub harness_extras: HashMap<String, ManifestExtras>,
pub extra_system_libs: HashMap<String, Vec<String>>,
pub format: HashMap<String, String>,
pub fields: HashMap<String, String>,
pub fields_optional: HashSet<String>,
pub fields_array: HashSet<String>,
pub fields_method_calls: HashSet<String>,
pub result_fields: HashSet<String>,
pub exclude_categories: HashSet<String>,
pub fields_c_types: HashMap<String, String>,
pub fields_enum: HashSet<String>,
pub fields_display_as_text: HashSet<String>,
pub env: HashMap<String, String>,
pub harness: HarnessConfig,
pub dep_mode: DependencyMode,
pub registry: RegistryConfig,
}Expand description
Root e2e configuration from [e2e] section of alef.toml.
Fields§
§fixtures: StringDirectory containing fixture JSON files (default: “fixtures”).
output: StringOutput directory for generated e2e test projects (default: “e2e”).
test_documents_dir: StringRepo-root-relative directory holding binary file fixtures referenced by
file_path / bytes fixture args (default: “test_documents”).
Backends that emit chdir / setup hooks for file-based fixtures resolve
the relative path from the test-emission directory via
E2eConfig::test_documents_relative_from. The default matches the
sample_core convention; downstream crates whose fixtures don’t reference
files (e.g. sample-llm, which uses pure mock-server fixtures) can leave
the default in place — backends conditionally emit the setup only when
fixtures actually need it.
languages: Vec<String>Languages to generate e2e tests for. Defaults to top-level languages list.
call: CallConfigDefault function call configuration.
calls: HashMap<String, CallConfig>Named additional call configurations for multi-function testing.
Fixtures reference these via the call field, e.g. "call": "embed".
packages: HashMap<String, PackageRef>Per-language package reference overrides.
harness_extras: HashMap<String, ManifestExtras>Per-language extra dependencies to splice into the e2e harness’s
language-native manifest (e2e/<lang>/package.json for node/wasm,
e2e/python/pyproject.toml for Python, etc.). Distinct from the
Rust-binding extra_dependencies knob — this one targets the
host-language test-harness manifest. Keys are canonical language
names (node, wasm, python, …).
extra_system_libs: HashMap<String, Vec<String>>Per-language extra system libraries to link into the generated e2e harness’s native build alongside the FFI library.
Keyed by canonical language name (zig, …); the value is the list of
bare system-library names (no lib prefix, no extension) to link, e.g.
["heif"]. Currently only the Zig e2e generator consumes this: when the
linked FFI crate is built with feature sets that pull in additional
native libraries (e.g. libheif via the all feature), the strict
linker on some targets (notably aarch64) cannot resolve those undefined
symbols unless the e2e build links them explicitly. The libraries must
already be installed on the build host.
Default is empty, so consumers that do not need extra links are unaffected.
Example:
[e2e.extra_system_libs]
zig = ["heif"]format: HashMap<String, String>Per-language formatter commands.
fields: HashMap<String, String>Field path aliases: maps fixture field paths to actual API struct paths.
E.g., “metadata.title” -> “metadata.document.title”
Supports struct access (foo.bar), map access (foo[key]), direct fields.
fields_optional: HashSet<String>Fields that are Optional/nullable in the return type. Rust generators use .as_deref().unwrap_or(“”) for strings, .is_some() for structs.
fields_array: HashSet<String>Fields that are arrays/Vecs on the result type.
When a fixture path like json_ld.name traverses an array field, the
accessor adds [0] (or language equivalent) to index into the first element.
fields_method_calls: HashSet<String>Fields where the accessor is a method call (appends ()) rather than a field access.
Rust-specific: Java always uses (), Python/PHP use field access.
Listed as the full resolved field path (after alias resolution).
E.g., "metadata.format.excel" means .excel should be emitted as .excel().
result_fields: HashSet<String>Known top-level fields on the result type.
When non-empty, assertions whose resolved field path starts with a
segment that is NOT in this set are emitted as comments (skipped)
instead of executable assertions. This prevents broken assertions
when fixtures reference fields from a different operation (e.g.,
batch.completed_count on a ScrapeResult).
exclude_categories: HashSet<String>Fixture categories excluded from cross-language e2e codegen.
Fixtures whose resolved category matches an entry in this set are
skipped by every per-language e2e generator — no test is emitted at
all (no skip directive, no commented-out body). The fixture files stay
on disk and remain available to Rust integration tests inside the
consumer crate’s own tests/ directory.
Use this to keep fixtures that exercise internal middleware (cache, proxy, budget, hooks, etc.) out of bindings whose public surface does not expose those layers.
Example:
[e2e]
exclude_categories = ["cache", "proxy", "budget", "hooks"]fields_c_types: HashMap<String, String>C FFI accessor type chain: maps "{parent_snake_type}.{field}" to the
PascalCase return type name (without prefix).
Used by the C e2e generator to emit chained FFI accessor calls for
nested field paths. The root type is always conversion_result.
Example:
[e2e.fields_c_types]
"conversion_result.metadata" = "HtmlMetadata"
"html_metadata.document" = "DocumentMetadata"fields_enum: HashSet<String>Fields whose resolved type is an enum in the generated bindings.
When a contains / contains_all / etc. assertion targets one of these
fields, language generators that cannot call .contains() directly on an
enum (e.g., Java) will emit a string-conversion call first. For Java,
the generated assertion calls .getValue() on the enum — the @JsonValue
method that all alef-generated Java enums expose — to obtain the lowercase
serde string before performing the string comparison.
Both the raw fixture field path (before alias resolution) and the resolved
path (after alias resolution via [e2e.fields]) are accepted, so you can
use either form:
# Raw fixture field:
fields_enum = ["links[].link_type", "assets[].category"]
# …or the resolved (aliased) field name:
fields_enum = ["links[].link_type", "assets[].asset_category"]fields_display_as_text: HashSet<String>Optional fields whose inner type carries a text accessor rather than
being a plain String.
When a contains / equals assertion targets one of these fields,
language generators call the language-idiomatic text accessor:
- Go:
field.Text()instead ofstring(*field) - Java:
.map(v -> v.text()).orElse("")instead ofObjects::toString - C#:
field?.Text()?.Trim()instead offield?.ToString()?.Trim() - PHP:
$result->getText()instead of raw property access
Use this for fields like content whose Rust type is Option<RichTextContent>
(a multimodal union) rather than Option<String>. The inner type must
expose a text() / Text() method that returns the textual representation.
Example:
[e2e]
fields_display_as_text = ["content", "choices[0].message.content"]env: HashMap<String, String>Environment variables every generated e2e suite’s setup must set before the binding’s engine is constructed. Keyed by env-var name; values are passed through verbatim.
Each per-language test-harness emitter consumes this map at
suite-setup time (conftest.py for Python, spec_helper.rb for Ruby,
TestMain for Go, bootstrap.php for PHP, test_helper.exs for Elixir,
globalSetup.ts for WASM, assembly fixture for C#, XCTestCase
classSetUp for Swift, etc.). The injection point sits next to where
MOCK_SERVER_URL is exported so the binding’s first call already
sees the configured environment.
Motivating use case: a binding may require an environment flag to allow loopback mock-server calls in e2e tests while keeping production URL validation strict by default. The map is intentionally generic so consumers can pass any binding-side env-var (feature flags, observability toggles, etc.) the same way.
Example:
[crates.e2e.env]
ALLOW_PRIVATE_NETWORK = "true"harness: HarnessConfigServer-shaped e2e harness configuration for HTTP fixtures. Knobs for code generation that spawn the SUT app and register handlers.
dep_mode: DependencyModeDependency mode: Local (default) or Registry.
Set at runtime via --registry CLI flag; not serialized from TOML.
registry: RegistryConfigRegistry-mode configuration from [e2e.registry].
Implementations§
Source§impl E2eConfig
impl E2eConfig
Sourcepub fn resolve_call(&self, call_name: Option<&str>) -> &CallConfig
pub fn resolve_call(&self, call_name: Option<&str>) -> &CallConfig
Resolve the call config for a fixture. Uses the named call if specified,
otherwise falls back to the default [e2e.call].
Sourcepub fn resolve_call_for_fixture(
&self,
call_name: Option<&str>,
fixture_id: &str,
fixture_category: &str,
fixture_tags: &[String],
fixture_input: &Value,
) -> &CallConfig
pub fn resolve_call_for_fixture( &self, call_name: Option<&str>, fixture_id: &str, fixture_category: &str, fixture_tags: &[String], fixture_input: &Value, ) -> &CallConfig
Resolve the call config for a fixture, applying select_when auto-routing.
When the fixture has an explicit call name, that named config is returned
(same as Self::resolve_call). When the fixture has no explicit call, the method
scans named calls for a super::selection::SelectWhen condition that matches the fixture’s
shape (id, category, tags, input) and returns the first match. If no condition
matches, it falls back to the default [e2e.call].
All non-None discriminators on a SelectWhen must match (logical AND) for
the condition to fire. A SelectWhen with every field None never matches —
at least one discriminator must be set.
Sourcepub fn resolve_package(&self, lang: &str) -> Option<PackageRef>
pub fn resolve_package(&self, lang: &str) -> Option<PackageRef>
Resolve the effective package reference for a language.
In registry mode, entries from [e2e.registry.packages] are merged on
top of the base [e2e.packages] — registry overrides win for any field
that is Some.
Sourcepub fn effective_result_fields<'a>(
&'a self,
call: &'a CallConfig,
) -> &'a HashSet<String>
pub fn effective_result_fields<'a>( &'a self, call: &'a CallConfig, ) -> &'a HashSet<String>
Return the effective result_fields for call.
Returns call.result_fields when non-empty, otherwise the global
self.result_fields.
Sourcepub fn effective_fields<'a>(
&'a self,
call: &'a CallConfig,
) -> &'a HashMap<String, String>
pub fn effective_fields<'a>( &'a self, call: &'a CallConfig, ) -> &'a HashMap<String, String>
Return the effective fields alias map for call.
Sourcepub fn effective_fields_optional<'a>(
&'a self,
call: &'a CallConfig,
) -> &'a HashSet<String>
pub fn effective_fields_optional<'a>( &'a self, call: &'a CallConfig, ) -> &'a HashSet<String>
Return the effective fields_optional for call.
Sourcepub fn effective_fields_array<'a>(
&'a self,
call: &'a CallConfig,
) -> &'a HashSet<String>
pub fn effective_fields_array<'a>( &'a self, call: &'a CallConfig, ) -> &'a HashSet<String>
Return the effective fields_array for call.
Sourcepub fn effective_fields_method_calls<'a>(
&'a self,
call: &'a CallConfig,
) -> &'a HashSet<String>
pub fn effective_fields_method_calls<'a>( &'a self, call: &'a CallConfig, ) -> &'a HashSet<String>
Return the effective fields_method_calls for call.
Sourcepub fn effective_fields_enum<'a>(
&'a self,
call: &'a CallConfig,
) -> &'a HashSet<String>
pub fn effective_fields_enum<'a>( &'a self, call: &'a CallConfig, ) -> &'a HashSet<String>
Return the effective fields_enum for call.
Sourcepub fn effective_fields_display_as_text<'a>(
&'a self,
call: &'a CallConfig,
) -> &'a HashSet<String>
pub fn effective_fields_display_as_text<'a>( &'a self, call: &'a CallConfig, ) -> &'a HashSet<String>
Return the effective fields_display_as_text for call.
Sourcepub fn effective_fields_c_types<'a>(
&'a self,
call: &'a CallConfig,
) -> &'a HashMap<String, String>
pub fn effective_fields_c_types<'a>( &'a self, call: &'a CallConfig, ) -> &'a HashMap<String, String>
Return the effective fields_c_types for call.
Sourcepub fn effective_output(&self) -> &str
pub fn effective_output(&self) -> &str
Return the effective output directory: registry.output in registry
mode, output otherwise.
Sourcepub fn extra_system_libs_for(&self, lang: &str) -> &[String]
pub fn extra_system_libs_for(&self, lang: &str) -> &[String]
Extra system libraries to link for a given language’s e2e harness build.
Returns an empty slice when none are configured for lang.
Sourcepub fn test_documents_relative_from(&self, emission_depth: usize) -> String
pub fn test_documents_relative_from(&self, emission_depth: usize) -> String
Relative path from a backend’s emission directory to the
test_documents_dir at the repo root.
emission_depth counts the number of additional ../ segments needed
to reach <output>/<lang>/ from where the file is being emitted:
0— emitted directly ate2e/<lang>/(e.g. dart, zigbuild.zig)1— emitted ate2e/<lang>/<sub>/(e.g. rubyspec/, Rtests/)2— emitted ate2e/<lang>/<sub1>/<sub2>/
The base prefix is two segments above <output>/<lang>/ (i.e.
../../), matching the canonical layout where <output> (default
"e2e") sits at the repo root next to the configured
test_documents_dir.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for E2eConfig
impl<'de> Deserialize<'de> for E2eConfig
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>,
Source§impl JsonSchema for E2eConfig
impl JsonSchema for E2eConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for E2eConfig
impl RefUnwindSafe for E2eConfig
impl Send for E2eConfig
impl Sync for E2eConfig
impl Unpin for E2eConfig
impl UnsafeUnpin for E2eConfig
impl UnwindSafe for E2eConfig
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