Coder Social home page Coder Social logo

[Schema] ID proposal about browser-compat-data HOT 7 CLOSED

mdn avatar mdn commented on April 28, 2024 1
[Schema] ID proposal

from browser-compat-data.

Comments (7)

SebastianZ avatar SebastianZ commented on April 28, 2024

You say that the ID will be stored within the JSON, though in the examples they are missing. Also, it's unclear to me, what you mean with "bottom of the ID".

Sebastian

from browser-compat-data.

wbamberg avatar wbamberg commented on April 28, 2024

1 file for a large set of features (like WebExtensions). We privileges here the simplicity to do batch changes.

This isn't the main reason WE has one massive file. The main reason is that I want to be able to generate pages like this: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Browser_support_for_JavaScript_APIs. It's not clear to me how I could do this if the compat data was split up into lots of individual files.

I don't think I really understand this proposal either. At the moment WE JSON looks something like this:

{
  "i18n": {
    "getUILanguage": {
        ...[compat data]
    },
    "LanguageCode": {
       ...[compat data]
    },
   ...[more i18n APIs]
  },
  "cookies": {
    "getAllCookieStores": { 
       ...[compat data]
    },
...[etc]

So I guess the "ID" would be i18n/getUILanguage etc., and all i18n APIs are properties of i18n: this makes it easy for code to do "get compat data for i18n", to build tables like https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/i18n#Browser_compatibility.

How would this differ under the current proposal, and how would I build these aggregate tables?

from browser-compat-data.

teoli2003 avatar teoli2003 commented on April 28, 2024

@SebastianZ: sorry I've not been clear enough. The id of line-height would be css.properties.line-height.

@wbamberg: the proposal is not fundamentally different than the one of WE. The main difference is that the ID will be unique through all the files, being one, or being multiple. This means that the id must be unique not only inside a file, but throughout all the files. This is enforces at review time, helped by a simple id scheme.

The possibility to use one large file, or several small files, is left to the curator of each area. Ideally, in the future macros will use a DB and the notion of file will disappear.

In the case of WebExtensions, there will still be one large file, with similar ids. The ids will be a bit longer.

Instead of: i18.cookies, it will be webextensions.i18.cookies (or similar):
{
"webextensions": {
"i18n": {
"getUILanguage": {
...[compat data]
},
"LanguageCode": {
...[compat data]
},
...[more i18n APIs]
},
"cookies": {
"getAllCookieStores": {
...[compat data]
},
...[etc]
}
}

That way we can easily merge different files, or separate them as the id scheme is universal throughout all browser compat data.

from browser-compat-data.

wbamberg avatar wbamberg commented on April 28, 2024

Thanks for the clarification @teoli2003 ! I'm +1 on this proposal now.

from browser-compat-data.

SebastianZ avatar SebastianZ commented on April 28, 2024

@SebastianZ: sorry I've not been clear enough. The id of line-height would be css.properties.line-height.

Ah, I see. You call the JSON path down to an entry the "ID". 😄 With your description I would have expected a key "id" containing "css.properties.line-height".

So, yes, your proposal is fine for me.

Sebastian

from browser-compat-data.

jwhitlock avatar jwhitlock commented on April 28, 2024

I like the proposal.

The _compat element is vital for code to be able to walk the tree of data, so that the data walker knows it should expect compatibility data, rather than look for new child elements. I think you'll need to describe in more detail how that is used.

If it is just "_compat": true, you can't mix ID and compatibility data. For example, you can't add support information to "webextensions.i18n", only to "webexetensions.i18n.getUILanguage". You'll have to use a trick like "webextensions.i18n.basic_support" if you want to talk about support in a more general way:

{
  "webextensions": {
    "i18n": {
      "basicSupport": {
        "_compat": true,
        [generic, caniuse-style compat data]
      },
      "getUILanguage" {
        "_compat": true,
        [specific, MDN-style compat data]
      }
    }
  }
}

Alternatively, you compatibility data could appear under the _compat element, so you know there is compat data attached to that node.

{
  "webextensions": {
    "i18n": {
      "_compat": [generic, caniuse-style compat data],
      "getUILanguage" {
        "_compat": [specific, MDN-style compat data],
      }
    }
  }
}

Update: Issue #114 specifies the second form, that data appears under the __compat element.

from browser-compat-data.

Elchi3 avatar Elchi3 commented on April 28, 2024

I think we've come to an agreement here and the new schema reflects that. Please open new issues if you have new feedback on identifiers.

from browser-compat-data.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.