Skip to content

Commit

Permalink
Merge pull request #1480 from telefonicaid/fix/ensure_entity_id_string
Browse files Browse the repository at this point in the history
Fix/ensure entity id string
  • Loading branch information
fgalan authored Oct 2, 2023
2 parents 5c35736 + 0b521bc commit e0ecc66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions lib/services/ngsi/entities-NGSI-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ function sendUpdateValueNgsi2(entityName, attributes, typeInformation, token, ca
let url = '/v2/op/update';

if (typeInformation && typeInformation.type) {
payload.entities[0].type = typeInformation.type;
// CB entity type should be always a String
payload.entities[0].type = String(typeInformation.type);
}

payload.actionType = 'append';
Expand Down Expand Up @@ -833,10 +834,10 @@ function sendUpdateValueNgsi2(entityName, attributes, typeInformation, token, ca
payload
);
}

// CB entity id and type should be always a String
let newEntity = {
id: newEntityName ? newEntityName : payload.entities[0].id,
type: attr.entity_type ? attr.entity_type : payload.entities[0].type
id: newEntityName ? String(newEntityName) : String(payload.entities[0].id),
type: attr.entity_type ? String(attr.entity_type) : String(payload.entities[0].type)
};
// Check if there is already a newEntity created
const alreadyEntity = payload.entities.find((entity) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "iotagent-node-lib",
"license": "AGPL-3.0-only",
"description": "IoT Agent library to interface with NGSI Context Broker",
"version": "3.4.2",
"version": "3.4.3",
"homepage": "https://github.com/telefonicaid/iotagent-node-lib",
"keywords": [
"fiware",
Expand Down

0 comments on commit e0ecc66

Please sign in to comment.