Allowed characters in keys #23
Replies: 5 comments 7 replies
-
That's one of the topics where I'd strongly recommend to start addressing issue right at the source (= in the editing applications), before adding such checks on API level only. Checks on API level implies that you have to include a list of non-permitted characters in /api/capabilities, so that editing apps can take those rules into account even before trying an upload. Simply returning HTTP 400 Bad request for uploads with non-permitted characters, without telling anyone what today's forbidden characters are, won't work. It's usually game over for your changeset, and you will have lots of unhappy users. I think this topic doesn't strictly require a version bump to API 0.7. Maybe talk to @simonpoole, he has relevant details to share on the topic. |
Beta Was this translation helpful? Give feedback.
-
These problematic characters are already monitored on Taginfo: https://taginfo.openstreetmap.org/reports/characters_in_keys#problem |
Beta Was this translation helpful? Give feedback.
-
I agree. This would be sensible to implement at the API side and is probably low risk. A version bump would be best, but if not one could envisage a 'strict' mode, similar to a 'use strict' kind of model, where the API expects things like this to cause a hard error. Strict mode could be off by default, but switched on by a certain date. |
Beta Was this translation helpful? Give feedback.
-
I find it rather difficult to justify doing anything at all on this topic, the number of keys in this category is minuscule, even minuscule compared to other problematic keys. Not to mention that the data consuming applications should be at least robust enough to ignore any input they can't deal with. That said, as @mmd-osm pointed out, simply enforcing this in the API is extremely user unfriendly, we should at least provide editing apps with a fighting chance of warning their users about "illegal" characters on entry, that is when errors can still be easily fixed. I suppose I could make a case for reserving certain characters for "future use" given that there is undoutably going to be even more pressure to structure and move values (in particular names, which can't really be restricted without some kind of agreement on normalisation) in to keys going forward. |
Beta Was this translation helpful? Give feedback.
-
I mentioned this discussion on https://wiki.openstreetmap.org/wiki/Talk:Proposed_features/Defaults#Problematic_characters_in_keys |
Beta Was this translation helpful? Give feedback.
-
The study's section 4.3 on "Limiting Length and Allowed Characters in Strings" talks about string length, but is mostly silent about allowed characters.
Personally, I feel that the consensus against certain characters in keys is quite strong and would justify enforcing such restrictions through the API. As evidence, I would like to point to:
Technologically, this would be a comparatively straightforward change with inexpensive server-side validation. Seeing how the API already rejects certain characters (for compatibility with XML), this change also would not impose any fundamentally new challenge for users of the API.
The benefits are proportional to the relatively low cost: small but tangible. In one example, not permitting the equals character to be used in keys would make the very common =-separated text representation of OSM tags unambiguous. This is beneficial for query languages, URLs, and similar human-readable interfaces to OSM data.
Beta Was this translation helpful? Give feedback.
All reactions