pub fn apply_projection(
records: Vec<RowRecord>,
fields: &Option<FieldSelector>,
schema: &SchemaConfig,
) -> Result<Vec<RowRecord>, MiniAppError>Expand description
Apply field projection to a list of RowRecords.
This is the single shared post-materialization, pre-serialization boundary
for field projection across the list, get, and alias_run operations
(Crux #1: one function, called by all three handlers).
NoneorSome(FieldSelector::All)→ returnsrecordsunchanged (backward-compatible).Some(FieldSelector::List { fields })→ validates field names againstschema(Crux #2), then projects each row’sdataobject to the listed fields. The row’sid,created_at, andupdated_atare always preserved.
§Errors
Returns MiniAppError::Validation (VALIDATION_ERROR) if any field name in
FieldSelector::List is not present in the schema’s canonical field definitions.