Generating skeleton JSON for APIs in BCD

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.

Sheppy

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

Sheppy

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

sorry for the newbie question what is BCD ?

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

1 Like

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.

Best,

Chris

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.

1 Like

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

BTW Eric @sheppy ,

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

Has not yet been done, no.

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
https://github.com/mdn/browser-compat-data/ , 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

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.

Sheppy

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

This got done at the Paris Hack on MDN event by Dominique Hazael-Massieux. Please find it here: https://github.com/dontcallmedom/webidl2mdnbcd

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

1 Like

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

Oh wonderful! I’m so stoked!

Sheppy

1 Like