Browser-compat-data: [Schema] Naming of user agent

Created on 16 Jan 2017  路  11Comments  路  Source: mdn/browser-compat-data

Hi!

How should we name the different user agents in the json.

E.g
{
"id1":{
"id2":{
"__compat": {
"Internet Explorer": {...}
"Firefox": {...}
}

Proposal 1:
Use a real name (even if it isn't the displayed one) like "Internet Explorer", "Firefox".
Proposal 2:
Use a more id-like name: "internet_explorer", "firefox", ... to make it clear it is not the displayed name.

Also do we want to make the list of values part of the schema (mandatory, able to be validated to allow the schema), or not (missing values will be considered as 'false')?

schema

Most helpful comment

I think we have consensus about have ids here. I will try to have them in a separate JSON file so that we can extend it with classification data in the future and also to see if I can use this new files to validate the browser compat json files (as proposed by @elchi3)

All 11 comments

I'm leaning towards more id-like names and thus the data consumers can decide how to display the user agent's names in their application.

To avoid mistakes (like spelling/duplicates), I think we should validate the user agent's IDs. I think that a compat entry should not require listing all of them (maybe one user agent entry is required but not more). So each of the following is optional, but at least 1 of them would be required.

Proposal for user agent IDs:
android_webview
android_chrome
android_firefox
android_opera
chrome
edge
ie
opera
safari
ios_safari
ios_firefox
ios_opera
nodejs
servo

Sometimes needed, due to OS-specific support limitations:
windows_chrome
macos_chrome
windows_firefox
macos_firefox
etc.

This avoids the terms "mobile" or "desktop" and focuses on the OS and/or environment. If data consumers want to display user agents in categories like "mobile", "desktop", "server" or something else, then they can do the mapping based on our user agent IDs themselves.

The valid user agent IDs could be another JSON file in the repository, perhaps as a map of IDs to "friendly" names, with classification data (desktop, engine name, etc.), version numbers, etc.

Another benefit of using id-like names is that you can more easily get them into class names, to allow CSS styling on HTML representations, or transform them into filenames for icons, images, and other JSON files.

I think we have consensus about have ids here. I will try to have them in a separate JSON file so that we can extend it with classification data in the future and also to see if I can use this new files to validate the browser compat json files (as proposed by @elchi3)

Can you add android_webview to your list? Android is way too overloaded. I have for the last two years been treating 'Android' as a catch-all for all the various Android flavors before android used Chromium for it's webview. It's also separate from android_chrome because there are differences between that and the webview, particularly where service workers are concerned.

Thanks Joe, that makes sense to me.
I've updated my list above to replace android with android_webview.

When I broached this subject 2 years ago I was told we couldn't get rid of android because people were still using it. I don't object to getting rid of android, but you might get some pushback from within your own house.

Rude of me not to say thank you. Thank you.

Responding late on this. Just wanted to say that the user agent IDs should be explained somewhere (e.g. in the MDN meta-documentation). Especially the different Android flavors are hard to distinguish.

Sebastian

+1

Give me a location and I'll write descriptions of the Android flavors.

Sorry for the long delay again! Too busy lately.

I'd say the user agent IDs could be added to the Compatibility tables guideline.
If someone has a better place, please post it here!

Sebastian

IDs won here, see in the new schema: https://github.com/mdn/browser-compat-data/blob/master/compat-data.schema.json#L65

Let's open new issues about adding other UAs or changing what the new schema does. Thanks for everyone's valuable input here!

Was this page helpful?
0 / 5 - 0 ratings