Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- Set Nodejs 20 as minimum version in packages.json (effectively removing Nodev16 and Nodev18 from supported versions)
- Fix attribute loss during device update when both name and object_id are defined by filtering only object_id (#1660)
2 changes: 1 addition & 1 deletion lib/services/ngsi/entities-NGSI-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ function sendUpdateValueNgsi2(entityName, originMeasures, originTypeInformation,
}
//remove measures that has been shadowed by an alias (some may be left and managed later)
//Maybe we must filter object_id if there is name == object_id
Comment on lines 468 to 469
Copy link
Preview

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] This comment is now outdated since the filter only removes by object_id; please update or remove it to match the new logic.

Suggested change
//remove measures that has been shadowed by an alias (some may be left and managed later)
//Maybe we must filter object_id if there is name == object_id
//remove measures that have been shadowed by an alias (some may be left and managed later)
//Filter measures by removing items where name matches object_id

Copilot uses AI. Check for mistakes.

measures = measures.filter((item) => item.name !== currentAttr.object_id && item.name !== currentAttr.name);
measures = measures.filter((item) => item.name !== currentAttr.object_id);

if (
currentAttr.expression !== undefined &&
Expand Down
71 changes: 71 additions & 0 deletions test/functional/testCases.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,77 @@ const testCases = [
}
]
},
{
describeName: '0021c - Simple group with active attributes with special names in object_id',
provision: {
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
method: 'POST',
json: {
services: [
{
resource: '/iot/json',
apikey: globalEnv.apikey,
entity_type: globalEnv.entity_type,
commands: [],
lazy: [],
attributes: [
{
object_id: 'fdt',
name: 'fireDetectionThreshold',
type: 'Number'
},
{
object_id: 'fireDetectionThreshold',
name: 'fireDetectionThreshold3',
type: 'Number'
}
],
static_attributes: []
}
]
},
headers: {
'fiware-service': globalEnv.service,
'fiware-servicepath': globalEnv.servicePath
}
},
should: [
{
shouldName:
'A - WHEN sending defined object_ids with special format names in attributes through http IT should send measures to Context Broker preserving value types, name mappings and metadatas',
type: 'single',
measure: {
url: 'http://localhost:' + config.http.port + '/iot/json',
method: 'POST',
qs: {
i: globalEnv.deviceId,
k: globalEnv.apikey
},
json: {
fdt: 10,
fireDetectionThreshold2: 20,
fireDetectionThreshold: 30
}
},
expectation: {
id: globalEnv.entity_name,
type: globalEnv.entity_type,
fireDetectionThreshold: {
type: 'Number',
value: 10
},
fireDetectionThreshold2: {
type: 'Text',
value: 20
},
fireDetectionThreshold3: {
type: 'Number',
value: 30
}
}
}
]
},
{
describeName: '0022 - Simple group with active attributes and multimeasures',
provision: {
Expand Down