Format of Type Object Changing in Function Call


#1

The structure of my object is changing in the .js method that I have implemented.

Question: Why does the structure change to ObjMapp? How can I stop that (if it’s possible to stop)?

// function definition
hdpMigrateCDXBatch: function(objs: [Obj], info: [Obj]): boolean js server

// How it is called in the map function of Stage2ProdMigrationJob.js
HDPPipeline.hdpMigrateCDXBatch(upserted.objs, hdpAnnInfo);

// Sample contents of hdpAnnInfo right before the function call
[{“srcField”:“claimID”,“tarType”:“HubClaim”,“tarField”:“claimID”,“hubOrsat”:“hub”},{“srcField”:“fromDate”,“tarType”:“satClaim”,“tarField”:“fromDate”,“hubOrsat”:“sat”},{“srcField”:“admitDate”,“tarType”:“satClaim”,“tarField”:“admitDate”,“hubOrsat”:“sat”}]

// Sample contents of what the info variable from the hdpMigrateCDXBatch argument looks like inside the function
[{“type”:“ObjMapp”,“value”:{“srcField”:{“type”:“String”,“value”:“claimID”},“tarType”:{“type”:“String”,“value”:“HubClaim”},“tarField”:{“type”:“String”,“value”:“claimID”},“hubOrsat”:{“type”:“String”,“value”:“hub”}}},{“type”:“ObjMapp”,“value”:{“srcField”:{“type”:“String”,“value”:“fromDate”},“tarType”:{“type”:“String”,“value”:“satClaim”},“tarField”:{“type”:“String”,“value”:“fromDate”},“hubOrsat”:{“type”:“String”,“value”:“sat”}}}]


#2

yes this is expected that an arbitrary JavaScript object will get “auto boxed” using ObjMap type (that mixes Obj)

If is a not a best practice to define apis using generic types like Obj - however if intension is that info suppose to be untyped / unstructured then json value type should be used - again bad idea and it’s much better to define the c3typ you wish to employ directly.