Roblox API Dump Review

So, as a preface, I truly do not know which category I should be getting review from for this, as the code is not native to the Roblox runtime (This code is not meant to be executed on Roblox) although it is very related to Roblox.

I’ve been on the fence if this goes in #help-and-feedback:scripting-support but considering that my code works (tests found here) I figured this was the best place.

I have spent the past week or so scraping many, many projects both on Roblox and GitHub by Anaminus, CloneTrooper1019, and the like (great people; great code) for the Roblox API Dump. I remember the way back when the old Roblox reference had documentation for it (heaven forbid!).

I’ve done my best to make a package that allows others to retrieve the Roblox API Dump as-is. That’s simple enough, since it’s only JSON, but the types of each dump item is what I’m concerned about. I’m unsure about the fidelity of this code.

For those of you familiar to TypeScript, please review my typings for the API Dump here if you are familiar:

For those of you not-so-familiar, perhaps you could share any known references to proper documentation for the API Dump? It would certainly help.

The Version field is meant to be incremented when the schema of the JSON structure changes. Since the ApiDump type already fully describes the version 1 structure, the Version field can be omitted.

If the schema changes in the future, the Version field would be used to map the data to the proper type. For example, version 1 would map to ApiDump, and version 2 might map to a ApiDumpV2, and so on. I don’t know much about TypeScript, so I can’t comment on how this would be implemented.

Since there’s currently only version 1, you can get away with not doing this. On the other hand, implementing this now will future-proof the case where the version does change, and the package can at least emit “version not supported” rather than some arbitrary type error.


Additionally, I would recommend fetching from https://setup.rbxcdn.com/ instead of http://setup.roblox.com/, since it allows HTTPS.

3 Likes

Thanks for your help!

I’ve switched over from http://setup.roblox.com/ to https://setup.rbxcdn.com/ and narrowed the ApiDump.Version field from number to 1 in the event I need to make a discriminated union of the different API Dump schemas.

I’ve also made the package as a greater whole more defensive, throwing specific errors when data is malformed or can’t be got after (some) retries.