FIWARE / context.Orion-LD

Context Broker and CEF building block for context data management which supports both the NGSI-LD and the NGSI-v2 APIs
https://www.etsi.org/deliver/etsi_gs/CIM/001_099/009/01.06.01_60/gs_CIM009v010601p.pdf
GNU Affero General Public License v3.0
50 stars 43 forks source link

@context specified by array gives an error #12

Closed jmcanterafonseca closed 5 years ago

jmcanterafonseca commented 5 years ago
{
  "id": "urn:ngsi-ld:Vehicle:A4567",
  "type": "Vehicle",
  "brandName": {
    "type": "Property",
    "value": "Mercedes"
  },
  "isParked": {
    "type": "Relationship",
    "object": "urn:ngsi-ld:OffStreetParking:Downtown1",
    "observedAt": "2017-07-29T12:00:04Z",
    "providedBy": {
      "type": "Relationship",
      "object": "urn:ngsi-ld:Person:Bob"
    }
  },
  "@context": [
    "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/coreContext/ngsi-ld-core-context.json",
    "http://example.org/cim/commonTerms.jsonld",
    "http://example.org/cim/vehicle.jsonld",
    "http://example.org/cim/parking.jsonld"
  ]
}
kzangeli commented 5 years ago

Contexts as arrays is implemented and working ... I implemented a functest creating the entity in the example above and ran into problems with the three last contexts:

kz@malika:context.Orion-LD> wget http://example.org/cim/commonTerms.jsonld
--2018-11-17 20:40:08--  http://example.org/cim/commonTerms.jsonld
Resolving example.org (example.org)... 93.184.216.34
Connecting to example.org (example.org)|93.184.216.34|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-11-17 20:40:09 ERROR 404: Not Found.

Replacing the last three contexts with ONE context: https://fiware.github.io/NGSI-LD_Tests/ldContext/testFullContext.jsonld, i.e. an Array with two contexts and the creation is successful.

wget got a 404 Bad Request. orionld reports this result:

orionldRequestSend.cpp[46]:writeCallback : Got a chunk of 1270 bytes: <!doctype html>
   ...

[ I imagine I don't even look at the HTTP Status Code. The error could definitely be better ].

Please perform a new test with working context URLs. This issue should be renamed to something like "Bad error reporting for contexts with an invalid URL ] And instead of bug this is a tech debt.

kzangeli commented 5 years ago

I did look at the error code (from curl_easy_perform). However, the function returns 0 (OK) for 404 Bad Request ... :( Thanks to SOF I found away to tell curl_easy_perform to complain on non-200 HTTP Status code, so, now the error response is better.

See commit https://github.com/Fiware/context.Orion-LD/commit/398d9bc32bf83a68a8e366c9c98f7bdc43e6f302