MobilityData / gbfs-json-schema

JSON Schema for GBFS feeds, managed by MobilityData. The versions are organized by folders. CC BY 4.0
Apache License 2.0
23 stars 24 forks source link

free_bike_status.available_until datetime regex too restrictive #95

Closed hbruch closed 8 months ago

hbruch commented 10 months ago

The current datetime regex for free_bike_status.available_until does neither support numeric offsets, nor milliseconds (not that this precision would be required but...).

As https://github.com/MobilityData/gbfs/pull/522 plans to introduce RFC3339 as timestamp format, the regex will surely be revised, but even now, I suggest to expand it to this stack overflow suggestion by Brock Adams:

(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))
richfab commented 10 months ago

Hello @hbruch,

I'm sorry for the delay. Thank you very much for this contribution! We all understand the importance of having an accurate JSON Schema.

Based on the GBFS spec definition:

Datetime (added in v2.3)- Combination of a date and a time following ISO 8601 notation. Attributes : year, month, day, hour, minute, second, and timezone.

  • I agree that the JSON-Schema should allow for the timezone to be included in free_bike_status.available_until.
  • I would recommend not allowing the milliseconds, to match the spec definition and because this level of precision is most likely not needed.

Please let me know:

  1. If you agree with these changes.
  2. If you would like to write the Pull Request, or if you would prefer that I take care of it.

Thank you! Fabien

richfab commented 8 months ago

Hi @hbruch, Just to let you know that we have updated the JSON Schemas (v2.3 and v3.0-RC) to allow timezones. Thank you for your contribution. Have a great!