Skip to main content

E2eConfig

Struct E2eConfig 

Source
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: String

Directory containing fixture JSON files (default: “fixtures”).

§output: String

Output directory for generated e2e test projects (default: “e2e”).

§test_documents_dir: String

Repo-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: CallConfig

Default 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 of string(*field)
  • Java: .map(v -> v.text()).orElse("") instead of Objects::toString
  • C#: field?.Text()?.Trim() instead of field?.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: HarnessConfig

Server-shaped e2e harness configuration for HTTP fixtures. Knobs for code generation that spawn the SUT app and register handlers.

§dep_mode: DependencyMode

Dependency mode: Local (default) or Registry. Set at runtime via --registry CLI flag; not serialized from TOML.

§registry: RegistryConfig

Registry-mode configuration from [e2e.registry].

Implementations§

Source§

impl E2eConfig

Source

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].

Source

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.

Source

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.

Source

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.

Source

pub fn effective_fields<'a>( &'a self, call: &'a CallConfig, ) -> &'a HashMap<String, String>

Return the effective fields alias map for call.

Source

pub fn effective_fields_optional<'a>( &'a self, call: &'a CallConfig, ) -> &'a HashSet<String>

Return the effective fields_optional for call.

Source

pub fn effective_fields_array<'a>( &'a self, call: &'a CallConfig, ) -> &'a HashSet<String>

Return the effective fields_array for call.

Source

pub fn effective_fields_method_calls<'a>( &'a self, call: &'a CallConfig, ) -> &'a HashSet<String>

Return the effective fields_method_calls for call.

Source

pub fn effective_fields_enum<'a>( &'a self, call: &'a CallConfig, ) -> &'a HashSet<String>

Return the effective fields_enum for call.

Source

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.

Source

pub fn effective_fields_c_types<'a>( &'a self, call: &'a CallConfig, ) -> &'a HashMap<String, String>

Return the effective fields_c_types for call.

Source

pub fn effective_output(&self) -> &str

Return the effective output directory: registry.output in registry mode, output otherwise.

Source

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.

Source

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 at e2e/<lang>/ (e.g. dart, zig build.zig)
  • 1 — emitted at e2e/<lang>/<sub>/ (e.g. ruby spec/, R tests/)
  • 2 — emitted at e2e/<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 Clone for E2eConfig

Source§

fn clone(&self) -> E2eConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for E2eConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for E2eConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for E2eConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for E2eConfig

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for E2eConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more