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

Valid ISO8601 date for observedAt is rejected with 400-Bad request #1010

Closed
wistefan opened this issue Feb 1, 2022 · 3 comments
Closed

Valid ISO8601 date for observedAt is rejected with 400-Bad request #1010

wistefan opened this issue Feb 1, 2022 · 3 comments

Comments

@wistefan
Copy link
Member

wistefan commented Feb 1, 2022

Orion rejects objects with time-properties with fraction >=5.
Reproduce(fraction is .123456789):

curl --location --request POST 'http://localhost:1026/ngsi-ld/v1/entities' \
--header 'Content-Type: application/json' \
--data-raw '{ "id" : "urn:ngsi-ld:myentity:1",
  "type": "MyEntity",
  "location" : {
    "type" : "GeoProperty",
    "value" : {
      "type" : "Point",
      "coordinates" : [ 52.78, 13.27 ]
    },
    "observedAt" : "2022-02-01T03:20:00.123456789Z"
  }
}'

Response:

{
    "type": "https://uri.etsi.org/ngsi-ld/errors/BadRequestData",
    "title": "The 'observedAt' attribute must have a valid ISO8601 as value",
    "detail": "observedAt"
}

When the request is(fraction is .12345678):

curl --location --request POST 'http://localhost:1026/ngsi-ld/v1/entities' \
--header 'Content-Type: application/json' \
--data-raw '{ "id" : "urn:ngsi-ld:myentity:1",
  "type": "MyEntity",
  "location" : {
    "type" : "GeoProperty",
    "value" : {
      "type" : "Point",
      "coordinates" : [ 52.78, 13.27 ]
    },
    "observedAt" : "2022-02-01T03:20:00.12345678Z"
  }
}'

It succeeds.

@kzangeli kzangeli mentioned this issue Feb 1, 2022
8 tasks
@kzangeli kzangeli self-assigned this Feb 1, 2022
@kzangeli
Copy link
Collaborator

kzangeli commented Feb 1, 2022

Hopefully fixed in #1012

@jason-fox
Copy link
Member

The POST request succeeds, but the ISO date is truncated.

curl --location --request GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:myentity:1'
{
  "id": "urn:ngsi-ld:myentity:1",
  "type": "MyEntity",
  "location": {
    "type": "GeoProperty",
    "value": {
      "type": "Point",
      "coordinates": [
        52.78,
        13.27
      ]
    },
    "observedAt": "2022-02-01T03:20:00.123Z"
  }
}

Tested with latest:

{
    "orionld version": "post-v1.0.0",
    "orion version": "1.15.0-next",
    "uptime": "0 d, 0 h, 6 m, 43 s",
    "git_hash": "nogitversion",
    "compile_time": "Thu Feb 24 03:09:29 UTC 2022",
    "compiled_by": "root",
    "compiled_in": "",
    "release_date": "Thu Feb 24 03:09:29 UTC 2022",
    "doc": "https://fiware-orion.readthedocs.org/en/master/"
}

@kzangeli
Copy link
Collaborator

kzangeli commented Feb 25, 2022

Yeah, only milliseconds are supported.
Sorry, but that's what we have right now.
It's not like the broker is really able to give any more precision in its timestamps ...
observedAt is user supplied, so, could make sense. createdAt/modifiedAt though are created by the broker and as it's not a real-time system, we can't really give any more precision than that. "observedAt" is treated the same, being of the same "type of property".

The issue is solved.
If another issue should be created - about "more than millisecond precision for observedAt", well, then let's open an issue about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants