Skip to main content

CallConfig

Struct CallConfig 

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

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

The module/package where the function lives.

§result_var: String

Variable 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: bool

Whether 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: bool

Whether 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: bool

Whether 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: bool

When 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: bool

When 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: bool

When true (combined with result_is_simple), the simple return is a slice/array (e.g., Vec<String> → string[] in TS).

§result_is_bytes: bool

When 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 like stream.items / stream.items.length are treated as plain field accessors on the result, not streaming adapters.
  • None (default): auto-detect — treat as streaming when either the fixture provides a streaming mock_response or any assertion references a neutral streaming-virtual-field name.
§result_is_option: bool

When true, the function returns Option<T>.

§result_element_is_string: bool

When 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

Source

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.

Source

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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> Self

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 CallConfig

Source§

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

Formats the value using the given formatter. Read more
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

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for CallConfig

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 CallConfig

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 CallConfig

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> ErasedDestructor for T
where T: 'static,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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