openactive / realtime-paged-data-exchange

OpenActive Realtime Paged Data Exchange Specification
https://www.openactive.io/realtime-paged-data-exchange/
Other
6 stars 1 forks source link

Enforce integer `modified` date and afterTimestamp as MUSTs. #89

Open nickevansuk opened 6 years ago

nickevansuk commented 6 years ago

Proposer

ODI

Use Case

Make RPDE easier to consume by enforcing integer modified date and afterTimestamp. Allowing modified to be either string or integer causes issues when using the modified date for cache invalidation, as both cases must be considered in the data store and application layer.

Proposal

Enforce integer modified date and afterTimestamp as MUSTs.

Examples

{
  "next": "http://api.letsride.co.uk/public/v1/rides?afterTimestamp=1453931925&afterId=2710",
  "items": [
    {
      "state": "updated",
      "id": 2710,
      "kind": "event",
      "modified": 1453931925,
      "data": {}
    }
  ],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}
nickevansuk commented 5 years ago

Now depends on https://github.com/openactive/opportunity-api/issues/10

lukehesluke commented 11 months ago

@nickevansuk are you aware of any implementations that use strings for modified (discounting cases where the string is something like "1234" which should actually be an integer)? Perhaps someone puts dates (e.g. ISO-8601) in here?

nickevansuk commented 11 months ago

Although the 1.0 spec does support both, we have been strongly encouraging implementations to converge on integer modified values, pending the next spec version which will include this change, to make data consumption easier for data users.

The libraries only support integer:

And the RPDE validator will return a warning to encourage integer to be used:

The model validator still allows strings (however could easily be updated so that it does not):

I believe British Cycling (the first ever RPDE implementation) was the only implementation to have adopted a string, however as this thread shows, they quickly moved to the integer approach based on implementation feedback. Since then I don't believe any other implementations have made use of a string for this purpose.

I think it's safe to assume that this will be included in the next version of the RPDE spec given all of the above, and so implementers can assume that modified is an integer for all implementations.