Skip to content

Commit e0ecc66

Browse files
authored
Merge pull request #1480 from telefonicaid/fix/ensure_entity_id_string
Fix/ensure entity id string
2 parents 5c35736 + 0b521bc commit e0ecc66

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/services/ngsi/entities-NGSI-v2.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ function sendUpdateValueNgsi2(entityName, attributes, typeInformation, token, ca
352352
let url = '/v2/op/update';
353353

354354
if (typeInformation && typeInformation.type) {
355-
payload.entities[0].type = typeInformation.type;
355+
// CB entity type should be always a String
356+
payload.entities[0].type = String(typeInformation.type);
356357
}
357358

358359
payload.actionType = 'append';
@@ -833,10 +834,10 @@ function sendUpdateValueNgsi2(entityName, attributes, typeInformation, token, ca
833834
payload
834835
);
835836
}
836-
837+
// CB entity id and type should be always a String
837838
let newEntity = {
838-
id: newEntityName ? newEntityName : payload.entities[0].id,
839-
type: attr.entity_type ? attr.entity_type : payload.entities[0].type
839+
id: newEntityName ? String(newEntityName) : String(payload.entities[0].id),
840+
type: attr.entity_type ? String(attr.entity_type) : String(payload.entities[0].type)
840841
};
841842
// Check if there is already a newEntity created
842843
const alreadyEntity = payload.entities.find((entity) => {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "iotagent-node-lib",
33
"license": "AGPL-3.0-only",
44
"description": "IoT Agent library to interface with NGSI Context Broker",
5-
"version": "3.4.2",
5+
"version": "3.4.3",
66
"homepage": "https://github.com/telefonicaid/iotagent-node-lib",
77
"keywords": [
88
"fiware",

0 commit comments

Comments
 (0)