Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Extra information about partial updates in responses #3499 #4097

Closed
wants to merge 4 commits into from
Closed
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,3 +1,4 @@
- Fix: extra information about partial updates in responses (#3499)
- Add: json field in httpCustom and mqttCustom subscriptions (#2560)
- Add: ${service}, ${servicePath} and ${authToken} macros in custom notifications (#4159)
- Fix: conditions.alterationTypes not working properly when conditions.attributes is used in entityUpdate case (#1494, reopened)
Expand Down
8 changes: 7 additions & 1 deletion src/lib/apiTypesV2/Attribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ void Attribute::fill(const QueryContextResponse& qcrs, const std::string& attrNa
contextAttributeP = NULL;
// Look for the attribute by name

std::string notExistingAtrr;
ContextElementResponse* cerP = qcrs.contextElementResponseVector[0];

for (std::size_t i = 0; i < cerP->entity.attributeVector.size(); ++i)
Expand All @@ -134,11 +135,16 @@ void Attribute::fill(const QueryContextResponse& qcrs, const std::string& attrNa
contextAttributeP = cerP->entity.attributeVector[i];
break;
}
else
{
notExistingAtrr = cerP->entity.id + "-" + cerP->entity.type + " : [" + attrName + "]";
}
}

if (contextAttributeP == NULL)
{
oeP->fill(SccContextElementNotFound, ERROR_DESC_NOT_FOUND_ATTRIBUTE, ERROR_NOT_FOUND);
std::string details = std::string("The entity does not have such an attribute: { " + notExistingAtrr + " }");
oeP->fill(SccContextElementNotFound, details, ERROR_NOT_FOUND);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ Date: REGEX(.*)
02. GET /v2/entities/E1/attrs/NONE
==================================
HTTP/1.1 404 Not Found
Content-Length: 79
Content-Length: 99
Content-Type: application/json
Fiware-Correlator: REGEX([0-9a-f\-]{36})
Date: REGEX(.*)

{
"description": "The entity does not have such an attribute",
"description": "The entity does not have such an attribute: { E1-T1 : [NONE] }",
"error": "NotFound"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ Date: REGEX(.*)
02. GET /v2/entities/E1/attrs/NONE/value
========================================
HTTP/1.1 404 Not Found
Content-Length: 79
Content-Length: 99
Content-Type: text/plain
Fiware-Correlator: REGEX([0-9a-f\-]{36})
Date: REGEX(.*)

{"error":"NotFound","description":"The entity does not have such an attribute"}
{"error":"NotFound","description":"The entity does not have such an attribute: { E1-T1 : [NONE] }"}


--TEARDOWN--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ Date: REGEX(.*)
02. Ask for E1/A2: GET /v2/entities/E1/attrs/A2/value
=====================================================
HTTP/1.1 404 Not Found
Content-Length: 79
Content-Length: 100
Content-Type: application/json
Fiware-Correlator: REGEX([0-9a-f\-]{36})
Date: REGEX(.*)

{
"description": "The entity does not have such an attribute",
"description": "The entity does not have such an attribute: { E1-Thing : [A2] }",
"error": "NotFound"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@ Date: REGEX(.*)
04. Query E1/A2 in CB, using NGSIv2
===================================
HTTP/1.1 404 Not Found
Content-Length: 79
Content-Length: 97
Content-Type: application/json
Fiware-Correlator: REGEX([0-9a-f\-]{36})
Date: REGEX(.*)

{
"description": "The entity does not have such an attribute",
"description": "The entity does not have such an attribute: { E1-T1 : [A2] }",
"error": "NotFound"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ Date: REGEX(.*)
02. Query E1/A2, see error
==========================
HTTP/1.1 404 Not Found
Content-Length: 79
Content-Length: 97
Content-Type: application/json
Fiware-Correlator: REGEX([0-9a-f\-]{36})
Date: REGEX(.*)

{
"description": "The entity does not have such an attribute",
"description": "The entity does not have such an attribute: { E1-T1 : [A2] }",
"error": "NotFound"
}

Expand Down