Frontmatter
| id | 8936 |
| title | Fix: RecordFactory mapping logic not triggering for missing source keys |
| state | Closed |
| labels | bugcore |
| assignees | tobiu |
| createdAt | Feb 1, 2026, 5:25 PM |
| updatedAt | Feb 1, 2026, 5:33 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8936 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | 8930 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Feb 1, 2026, 5:33 PM |
Fix: RecordFactory mapping logic not triggering for missing source keys
tobiu added parent issue #8930 on Feb 1, 2026, 5:25 PM
tobiu assigned to @tobiu on Feb 1, 2026, 5:26 PM

tobiu
Feb 1, 2026, 5:32 PM
Input from Gemini 3 Pro:
✦ I have implemented the fix for
RecordFactorymapping logic.The Fix
I modified
assignDefaultValuesinsrc/data/RecordFactory.mjs. It now iterates over mapped fields and, if the field is missing from the inputdataobject, it attempts to resolve the value using themappingpath from thedataobject itself.This effectively "pre-populates" the mapped fields in the config object before
setRecordFieldsiterates over them, ensuring that the mapping is applied and the value is set on the record.Verification
This change ensures that
y2025(mapped toyears.2025) in the DevRank model will be correctly populated from the source JSON, even thoughy2025is not a key in the source JSON.I have pushed the changes to
dev.
tobiu closed this issue on Feb 1, 2026, 5:33 PM
This task fixes a bug in
Neo.data.RecordFactorywhere model fields using themappingconfiguration are not populated if the field name itself is missing from the input data object.The Issue
Currently,
setRecordFieldsiterates overObject.entries(fields)(the input data). If a field likey2025relies on a mappingyears.2025, buty2025is not in the input data,setRecordFieldsnever processes it, and the mapping logic insideparseRecordValueis never triggered.The Fix
Modify
Neo.data.RecordFactory.assignDefaultValuesto also handle mapped fields.mappingand the field key is missing in the data object:data[fieldName] = undefined(or the default value).setRecordFieldswill visit the field, triggeringparseRecordValue, which then correctly resolves the mapping from the source data.Acceptance Criteria
mappingare correctly populated even if their key is missing in the source data.