-
Notifications
You must be signed in to change notification settings - Fork 296
GBFS ID type definition #541
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
Comments
Just to explain Entur's usage of See https://enturas.atlassian.net/wiki/spaces/PUBLIC/pages/728563782/General+information+NeTEx#Definitions and https://enturas.atlassian.net/wiki/spaces/PUBLIC/pages/1883439205/Mobility+Data+Collection+-+GBFS+v2.2-v2.3#IDs |
Thank you @tdelmas for the thorough analysis of the known feeds and for the detailed suggestions! |
This PR clarify and restrict the characters allowed in IDs. See MobilityData#541 for additional details. Those edits have multiple goals: - Clarify the current specification that is too vague - Ensure interoperability, it MUST be possible to store and compare IDs simply - Ensure that IDs are easy to manipulate by humans, because even if the format is design for machines, IDs are often used by humans to debug, so they SHOULD be easy to read and write, regardless of the keyboard layout or system used. With that specification, all IDs present in `system.cvs` should stay compliant (excepts those using spaces `0x20`, who are already not compliant with the current specification). Also, all other shared mobility systems that I have seen (GBFS or not) are compatible with both restrictions (again, except for spaces in a case that looks like an error). Does anyone think that IDs should be restricted further, such as `A-Za-z0-9_-:`? (And consider that existing system that are using `.@/` are compliant because "SHOULD" means "that there may exist valid reasons in particular circumstances to ignore a particular item", and at least "legacy" may fit into that. Fix MobilityData#541
Closing this thread since a PR has been opened for this at #545, please continue the discussion there! |
What is the issue and why is it an issue?
The current definition of
ID
in https://github.com/MobilityData/gbfs/blob/master/gbfs.md#field-types is:This definition is the same since the first draft in 2016 #5 :
There are multiple problems with that definition:
A precision problem: What is a space? It's not defined here, and as any character that JSON can encode is valid, the definition is not straightforward:
0x20
(ASCII space)A purpose problem: Why spaces are forbidden? What was the goal?
The fact that allowing any characters (except spaces) may cause compatibility problems:
\uXXXX\uXXXX
Current usage of IDs (based on
system.cvs
)Of the 826 system declared, I've analyzed 798 (others are dead or broken)
IDs from
free_bike_status
,station_status
,vehicle_types
andsystem_pricing_plans
were analyzed.The IDs of those systems are composed of:
.
(dot) for 1 system (sharedmobility.ch
)@
(AT) for HelBiz 2 systems ("bike_id"
like"P8S0C2149C0011@SD02"
in https://gbfs.helbiz.com/v2.2/miamilakes/free_bike_status.json)publicbikesystem.net
invehicle_type
(ex. :"vehicle_type_id": "E Scooter"
)openov.nl
instation_information
(one station has the id"GR002 "
, which is probably an error as all other station follow the same pattern without space in https://gbfs.openov.nl/ovfiets/station_information.json)sharedmobility.ch
inplan_id
such asemobility:83106 return"
andemobility:2306 oneway
:
for 34 systems (sharedmobility.ch
andentur
)0-9
,a-z
,A-Z
,-
and_
Please describe some potential solutions you have considered (even if they aren’t related to GBFS).
The specification should clearly state what constitute a valid ID. Some solutions are presented below:
[A-Z][a-z][0-9]_-.:@
[A-Z][a-z][0-9]_-:
(789/798 : 98.8%)[A-Z][a-z][0-9]_-
(756/798: 94.7%)As 3.0 is a major breaking version, it is the perfect moment to restrict the character range of IDs.
Restricting them to the strictest proposition
[A-Z][a-z][0-9]_-
seams to be a reasonable choice:A least restrictive choice, regarding current usage, could be
[A-Z][a-z][0-9]_-.:@
or something in between. (:
and@
are mostly safe in most situation, but may be interpreted differently in URIs).Comparisons with IDs in other systems:
https://gtfs.org/schedule/reference/
https://datatracker.ietf.org/doc/html/rfc7946#appendix-B.1
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
References:
Base64 encoding require
[a-z][0-9]+/=
Base64url require
[a-z][0-9]_-
Is your potential solution a breaking change?
The text was updated successfully, but these errors were encountered: