Generating skeleton JSON for APIs in BCD

(Eric Shepherd) #1

Anyone game to try creating a tool that takes as input the WebIDL for an API interface and outputs a skeleton JSON file for adding it to BCD?

There are a few WebIDL parsers available on npm that would provide almost everything that’s needed. Since all you need are the names of attributes and methods, and no other information, you can spit out the framework quite easily.

For each item, simply use null as the value for the support version, indicating “unknown”. Then we can use the tool to generate the structure of the JSON and all we have to do is go in and fill in the details.


(Eric Shepherd) #2

OK, I’m giving it a shot to create this. I think it will save a ton of time over the long haul.


(Chris Mills) #3

Nice, thanks sheppy! And sorry for not commenting earlier. I only just saw this thread.

(Julien Tane) #4

sorry for the newbie question what is BCD ?

(Julien Tane) #5

ok I found the answer myself after I used the discourse search field :slight_smile:

(Chris Mills) #6

No need to apologize! There are no stupid or newbie questions here - all are welcome. Let us know if you have any more Q’s.



(Janet Swisher) #7

For the benefit of others: BCD on MDN means Browser Compatibility Data. Though part of my brain still reads that as Binary Coded Decimal, because I am old.

(Eric Shepherd) #8

I also still read it as Binary Coded Decimal, because I do 8- and 16-but assembly programming for fun on the side.

(Julien Tane) #9

BTW Eric @sheppy ,

did you implement it yourself. or do you still need it to be implemented.

(Eric Shepherd) #10

Has not yet been done, no.

(Julien Tane) #11

Hi @sheppy

ok. In which repository should the code go ?
I guess from your reference to npm that it is as a nodejs project.

the target data should look like the one in , right?

would you give me the details for this.
I guess a number of idls to start working on are in dom/… in firefox repo.

I haven’t yet looked at the other projects chromium… and co

(Eric Shepherd) #12

Anywhere, really. Just create a project on Github for it for now. If it comes along well, we can always consider migrating it elsewhere. I don’t generally c are what language it’s done in – except that NodeJS means it’s portable and compatible, and because it’s JavaScript, working with JSON is a lot easier than it might be otherwise.

Yes, that’s correct.

Obviously you can look at any of the files in the browser-compat-data repo, but there’s also some documentation there as well as on MDN itself:

So, as a general rule what we’ll actually do is pull the WebIDL from the specifications, since that’s the “official” source, then update it based on the deviations in the browsers. There are Node modules available that are able to locate and extract WebIDL from specifications.


(Julien Tane) #13

ok. Thanks…
I believe I can get a good start with this :slight_smile:

(Florian Scholz) #14

This got done at the Paris Hack on MDN event by Dominique Hazael-Massieux. Please find it here:

We were already able to create around 50 pull request adding skeletons from various specifications to the browser-compat-data. Stay tuned for more.

(Julien Tane) #15

Good. I will take a look. I unfortunately did not come around to do it…
But if it is already done… Good :slight_smile:

(Eric Shepherd) #16

Oh wonderful! I’m so stoked!