fix(os-mapping): getFieldMappingAsMap must return the neutral (ES-shaped) map (#36501)#36559
fix(os-mapping): getFieldMappingAsMap must return the neutral (ES-shaped) map (#36501)#36559fabrizzio-dotCMS wants to merge 1 commit into
Conversation
…ped) map (#36501) MappingOperationsOS.getFieldMappingAsMap serialized the whole OpenSearch FieldMapping object, producing the wrapper shape {"full_name":"...","mapping":{"<field>":{...}}}. The vendor-neutral contract — established by MappingOperationsES which returns sourceAsMap() keyed by the leaf field name ({"<field>":{...}}) — was violated, so callers doing map.get(fieldVariable) got null and NPE'd under migration phase 2 (mapping reads route to OS). Return the inner "mapping" sub-map so the OS result matches the ES shape. (Fixes FieldAPITest.test_SaveNewIndexedField_ShouldAddESMapping and test_SaveNewRelationshipField_ShouldAddESMapping under phase 2.) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude finished @fabrizzio-dotCMS's task in 3m 18s —— View job Rollback-Safety AnalysisDiff analyzed:
Result: ✅ Safe to rollback The change only reshapes a return value inside Why none of the categories apply:
Net effect: this is a same-JVM bug fix — the old wrapper-shaped map was actively causing NPEs for callers ( Label |
Proposed Changes
MappingOperationsOS.getFieldMappingAsMapserialized the whole OpenSearchFieldMapping, producing the wrapper shape{"full_name":"...","mapping":{"<field>":{...}}}. The vendor-neutral contract (established byMappingOperationsESreturningsourceAsMap(), keyed by the leaf field name) was violated, so callers doingmap.get(fieldVariable)got null and NPE'd under migration phase 2. Now returns the innermappingsub-map so the OS result matches the ES shape. Contributes to #36501.Verification
Phase 2, isolated env:
FieldAPITest97/0/0 (incl.test_SaveNewIndexedField_ShouldAddESMappingandtest_SaveNewRelationshipField_ShouldAddESMapping, previously NPE).Refs #36501, #36320.