pub struct FieldResolver { /* private fields */ }Expand description
Resolves fixture field paths to language-specific accessor expressions.
Implementations§
Source§impl FieldResolver
impl FieldResolver
Sourcepub fn new(
fields: &HashMap<String, String>,
optional: &HashSet<String>,
result_fields: &HashSet<String>,
array_fields: &HashSet<String>,
) -> Self
pub fn new( fields: &HashMap<String, String>, optional: &HashSet<String>, result_fields: &HashSet<String>, array_fields: &HashSet<String>, ) -> Self
Create a new resolver from the e2e config’s fields aliases,
fields_optional set, result_fields set, and fields_array set.
Sourcepub fn resolve<'a>(&'a self, fixture_field: &'a str) -> &'a str
pub fn resolve<'a>(&'a self, fixture_field: &'a str) -> &'a str
Resolve a fixture field path to the actual struct path. Falls back to the field itself if no alias exists.
Sourcepub fn is_optional(&self, field: &str) -> bool
pub fn is_optional(&self, field: &str) -> bool
Check if a resolved field path is optional.
Sourcepub fn has_alias(&self, fixture_field: &str) -> bool
pub fn has_alias(&self, fixture_field: &str) -> bool
Check if a fixture field has an explicit alias mapping.
Sourcepub fn is_valid_for_result(&self, fixture_field: &str) -> bool
pub fn is_valid_for_result(&self, fixture_field: &str) -> bool
Check whether a fixture field path is valid for the configured result type.
When result_fields is non-empty, this returns true only if the
first segment of the resolved field path appears in that set.
When result_fields is empty (not configured), all fields are
considered valid (backwards-compatible).
Sourcepub fn has_map_access(&self, fixture_field: &str) -> bool
pub fn has_map_access(&self, fixture_field: &str) -> bool
Check if a resolved field path ends with a map access (e.g., foo[key]).
This is needed because Go map access returns a value type (not a pointer),
so nil checks and pointer dereferences don’t apply.