pub struct CallConfig {Show 31 fields
pub result_fields: HashSet<String>,
pub fields: HashMap<String, String>,
pub fields_optional: HashSet<String>,
pub fields_array: HashSet<String>,
pub fields_method_calls: HashSet<String>,
pub fields_enum: HashSet<String>,
pub fields_display_as_text: HashSet<String>,
pub fields_c_types: HashMap<String, String>,
pub fields_json_scalar: HashSet<String>,
pub assertion_recipes: HashSet<String>,
pub function: String,
pub module: String,
pub result_var: String,
pub async: bool,
pub path: Option<String>,
pub method: Option<String>,
pub args: Vec<ArgMapping>,
pub overrides: HashMap<String, CallOverride>,
pub returns_result: bool,
pub returns_void: bool,
pub skip_languages: Vec<String>,
pub unsupported_in: HashMap<String, String>,
pub result_is_simple: bool,
pub result_is_vec: bool,
pub result_is_array: bool,
pub result_is_bytes: bool,
pub streaming: Option<StreamingConfig>,
pub result_is_option: bool,
pub result_element_is_string: bool,
pub select_when: Option<SelectWhen>,
pub options_type: Option<String>,
}Expand description
Configuration for the function call in each test.
Fields§
§result_fields: HashSet<String>Per-call override for result_fields.
When non-empty, this set replaces the global [e2e].result_fields for
fixtures routed to this call. Use this when different API functions return
differently-shaped structs so each call can gate its own field set.
Example:
[e2e.calls.crawl]
result_fields = ["pages", "final_url", "stayed_on_domain"]fields: HashMap<String, String>Per-call override for [e2e].fields alias map.
When non-empty, replaces (not merges with) the global fields map for
fixtures routed to this call.
fields_optional: HashSet<String>Per-call override for [e2e].fields_optional.
fields_array: HashSet<String>Per-call override for [e2e].fields_array.
fields_method_calls: HashSet<String>Per-call override for [e2e].fields_method_calls.
fields_enum: HashSet<String>Per-call override for [e2e].fields_enum.
fields_display_as_text: HashSet<String>Per-call override for [e2e].fields_display_as_text.
fields_c_types: HashMap<String, String>Per-call override for [e2e].fields_c_types.
fields_json_scalar: HashSet<String>Per-call override for [e2e].fields_json_scalar.
assertion_recipes: HashSet<String>Assertion recipes enabled for all fixtures routed to this call.
Recipes intentionally gate domain-shaped assertion shortcuts such as
embeddings_*, keywords, tree parser helpers, and streaming
pseudo-fields. Generic recursive field/text/JSON assertions do not
require a recipe.
function: StringThe language-neutral function name (alef applies language naming conventions).
Do not read this field to decide anything. It is legitimately empty when a call
names itself only per language, so a direct read yields "" and every derived
decision — adapter lookups, IR lookups, name-prefix classifiers, “does this call
exist” gates — fails silently rather than loudly. Go through
CallConfig::effective_function for the symbol a binding must emit, or
CallConfig::core_lookup_name for the key into a Rust-side table. The only reads
that belong here are those two resolvers and the per-language override chains they
are replacing.
module: StringThe module/package where the function lives.
result_var: StringVariable name for the return value (default: “result”).
Do not read this field to emit an identifier. A TOML-loaded call always carries a
name — the serde default below supplies one — but a programmatically built call or an
explicit result_var = "" leaves it blank, and every emitter that splices it straight
into a binding then writes the binding with no identifier at all (val = ...), which
is not valid source in any target language. Read CallConfig::effective_result_var
instead; it is the only place the blank-means-default rule is decided.
async: boolWhether the function is async.
path: Option<String>HTTP endpoint path for mock server routing (e.g., "/v1/chat/completions").
Required when fixtures use mock_response. The Rust e2e generator uses
this to build the MockRoute that the mock server matches against.
method: Option<String>HTTP method for mock server routing (default: "POST").
Used together with path when building MockRoute entries.
args: Vec<ArgMapping>How fixture input fields map to function arguments.
overrides: HashMap<String, CallOverride>Per-language overrides for module/function/etc.
returns_result: boolWhether the function returns Result<T, E> in its native binding.
Defaults to true. When false, generators that distinguish Result-returning
from non-Result-returning calls (currently Rust) will skip the
.expect("should succeed") unwrap and bind the raw return value directly.
returns_void: boolWhether the function returns only an error/unit — i.e., Result<(), E>.
When combined with returns_result = true, Go generators emit err := func()
(single return value) rather than _, err := func() (two return values).
This is needed for functions like validate_host that return only error in Go.
skip_languages: Vec<String>skip_languages
unsupported_in: HashMap<String, String>Per-backend exclusion: backends listed here will emit a skip comment instead of a failing test, with the documented reason that the call is unsupported on that backend (e.g., “brew: interact requires complex JSON serialization of PageAction enums”).
Use this when a backend structurally cannot support a call (e.g., CLI-based
backends that lack certain features). Unlike skip_languages, unsupported calls
are documented in the generated test files with rationale comments.
Example:
[e2e.calls.interact]
unsupported_in = { brew = "interact requires serializing Vec<PageAction> enums to JSON CLI args" }result_is_simple: boolWhen true, the function returns a primitive (e.g. String, bool,
i32) rather than a struct. Generators that would otherwise emit
result.<field> will fall back to the bare result variable.
This is a property of the Rust core’s return type and therefore identical
across every binding — set it on the call, not in per-language overrides.
The same flag is also accepted under [e2e.calls.<name>.overrides.<lang>]
for backwards compatibility, but the call-level value takes precedence.
result_is_vec: boolWhen true, the function returns Vec<T> / Array<T>. Generators that
support per-element field assertions (rust, csharp) iterate or index into
the result; the typescript codegen indexes [0] to mirror csharp.
As with result_is_simple, this is a Rust-side property — set it on the
call, not on per-language overrides. Per-language overrides remain
supported for backwards compatibility.
result_is_array: boolWhen true (combined with result_is_simple), the simple return is a
slice/array (e.g., Vec<String> → string[] in TS).
result_is_bytes: boolWhen true, the function returns a raw byte array (Vec<u8> →
Uint8Array / []byte / byte[]).
streaming: Option<StreamingConfig>Three-valued opt-in/out for streaming-virtual-field auto-detection.
Some(true): force streaming semantics regardless of fixture shape.Some(false): disable streaming auto-detection — assertions referencing neutral stream fields likestream.items/stream.items.lengthare treated as plain field accessors on the result, not streaming adapters.None(default): auto-detect — treat as streaming when either the fixture provides a streamingmock_responseor any assertion references a neutral streaming-virtual-field name.
result_is_option: boolWhen true, the function returns Option<T>.
result_element_is_string: boolWhen true (combined with result_is_simple + result_is_array),
signals that the result is Vec<String> returned to the host as a
native string array (e.g., Swift [String]) rather than an opaque
RustVec<RustString> requiring .asStr().toString() per element.
Generators that emit per-element coercion for opaque RustVec types (currently Swift) drop the coercion and operate on the elements as native strings when this flag is set.
select_when: Option<SelectWhen>Automatic fixture-routing condition.
When set, a fixture whose call field is None is routed to this named call config
if the condition is satisfied. This avoids the need to tag every fixture with
"call": "batch_scrape" when the fixture shape already identifies the call.
Example (alef.toml):
[e2e.calls.batch_scrape]
select_when = { input_has = "batch_urls" }options_type: Option<String>Call-level constructor type for json_object config args.
This is the type of the function’s config parameter (e.g. EmbeddingConfig
vs ExtractionConfig) and is therefore identical across every binding — set
it on the call, not in per-language overrides. Per-language overrides
([e2e.calls.<name>.overrides.<lang>].options_type) still take precedence
when a binding exposes a language-specific wrapper type (e.g. JsExtractionConfig).
Implementations§
Source§impl CallConfig
impl CallConfig
Sourcepub fn effective_result_var(&self) -> &str
pub fn effective_result_var(&self) -> &str
The identifier a generated binding must bind this call’s return value to.
Blank counts as unset rather than as the empty identifier: a call built in code, or one
that spells result_var = "" in alef.toml, carries no name, and every emitter that
splices the raw field into a binding writes val = ... / let = ... — source that no
target language parses. Four emitters had each re-derived this fallback locally and the
other thirty-odd had not, so the same call rendered under two different names depending
on which emitter you read.
Every consumer that needs “what is this call’s result called here” must resolve it through this one method, including the ones that only compare the name against a literal — a comparison against the raw blank field silently answers for a name the generated code never uses.
Sourcepub fn effective_result_is_simple(&self, language: &str) -> bool
pub fn effective_result_is_simple(&self, language: &str) -> bool
Whether this call’s result is a scalar/collection value rather than a struct with
member accessors, for language.
The flag is a property of the Rust return type and belongs on the call, but a
per-language overrides.<language> spelling is still accepted for backwards
compatibility (and is genuinely per-language where a binding flattens the return type
only in one target), so both have to be consulted — every backend that reads it already
ORs the two inline. ~keep
Sourcepub fn effective_result_is_bytes(&self, language: &str) -> bool
pub fn effective_result_is_bytes(&self, language: &str) -> bool
Whether this call returns a raw byte buffer for language. Resolved the same way
Self::effective_result_is_simple is, and separate from it because a byte buffer has
its own length/emptiness idioms in every backend.
Sourcepub fn effective_function(&self, language: &str) -> Option<&str>
pub fn effective_function(&self, language: &str) -> Option<&str>
The function identity this call names for language, or None when it names none.
A per-language [e2e.calls.<name>.overrides.<language>] function outranks the base
function, and a blank value on either counts as absent rather than as the empty
symbol: a call may deliberately carry function = "" and place the real name in every
per-language override, because the bindings spell it differently and there is no
language-neutral name to put at the base.
Every consumer that needs “which function does this call name here” must resolve it
through this one method. A second resolution that reads self.function directly sees
the empty base and reports the call as nameless.
Sourcepub fn core_lookup_name(&self, language: &str) -> Option<Cow<'_, str>>
pub fn core_lookup_name(&self, language: &str) -> Option<Cow<'_, str>>
The name to match this call against tables keyed by the Rust core’s own function
names: [[crates.adapters]] (AdapterConfig::name) and the IR FunctionDef list.
Those tables spell a function the way Rust does, so the base function is the key
whenever it names anything — a populated base resolves exactly as reading the field
directly did, which is why adopting this method cannot move an existing consumer.
It is the empty base that needs help: when the name lives only in
overrides.<language>.function that override is the sole name available, and it is
snake-cased on the way out because an override spells the symbol the way its binding
does (ClearValidators, clearValidators) while these tables spell it the Rust way.
None means the call names no function at all for language. Callers must treat it
as “no match” rather than looking up "", which silently matches nothing and lets
downstream naming derive types from the empty string.
Sourcepub fn streaming_enabled(&self) -> Option<bool>
pub fn streaming_enabled(&self) -> Option<bool>
Effective streaming opt-in/out flag, preserving the legacy
streaming = true/false behavior while allowing
streaming = { item_type = "Event" } recipes.
Sourcepub fn streaming_item_type(&self) -> Option<&str>
pub fn streaming_item_type(&self) -> Option<&str>
Explicit stream item type configured on the call recipe, if any.
Trait Implementations§
Source§impl Clone for CallConfig
impl Clone for CallConfig
Source§impl Debug for CallConfig
impl Debug for CallConfig
Source§impl Default for CallConfig
Hand-written rather than derived because one field — result_var — has a serde default that
is not its type’s default, and a derived Default would hand every programmatically built
call an empty name while a TOML-loaded one got “result”. Two derivations of the same default
disagreeing is exactly how val = ... reached the Kotlin emitter. Listing the fields makes
the compiler demand an entry for each new one, and default_matches_the_serde_defaults in
tests.rs pins the two against each other for every field, not just this one. ~keep
impl Default for CallConfig
Hand-written rather than derived because one field — result_var — has a serde default that
is not its type’s default, and a derived Default would hand every programmatically built
call an empty name while a TOML-loaded one got “result”. Two derivations of the same default
disagreeing is exactly how val = ... reached the Kotlin emitter. Listing the fields makes
the compiler demand an entry for each new one, and default_matches_the_serde_defaults in
tests.rs pins the two against each other for every field, not just this one. ~keep
Source§impl<'de> Deserialize<'de> for CallConfig
impl<'de> Deserialize<'de> for CallConfig
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 CallConfig
impl JsonSchema for CallConfig
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 CallConfig
impl RefUnwindSafe for CallConfig
impl Send for CallConfig
impl Sync for CallConfig
impl Unpin for CallConfig
impl UnsafeUnpin for CallConfig
impl UnwindSafe for CallConfig
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>,
impl<T> ErasedDestructor for Twhere
T: 'static,
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