Expose data available in ReflectionMetadata via API

As a Roblox developer, it is currently too hard to utilize what information is available via ReflectionMetadata, and especially keeping it up to date.

If Roblox is able to address this issue, it would improve my development experience because it would allow me to fully utilize the information available via ReflectionMetadata without the need of updating a module with each release of Roblox. ReflectionMedata is comprised of an actual Roblox XML instance tree and can be loaded as an rbxmx. Exposing ReflectionMetadata or some of its information to scripts within the engine allows developers to utilize all of the information it offers, such as method listings, event listings, property listings, which ones can be read and written to and which ones cannot, which ones can load and save, and plenty more.

ReflectionMetadata allows a script to interpret information about the game which would otherwise be impossible to interpret, a classic use case being the ability to list off all available properties of a class for serialization. This sort of behaviour can be used to create snapshots of instances and export them elsewhere, which, would be painstaking to do without ReflectionMetadata’s trove of information.

Being able to access lists of methods or properties, and information about their usage in certain scripts is crucial to the serialization and deserialization of instances, and provides a huge amount of data to sandboxes which may be wanting to simulate a Roblox-like environment within Roblox, as well as information that can be used for the validation of certain things. I think it is important that it is made easier for code to access this information, whether it be through somehow truly exposing a copy of ReflectionMetadata in game, or via some sort of API.

8 Likes

You can already get this information fairly easily. ReflectionMetadata is not required.

local versionURL = "https://setup.rbxcdn.com/versionQTStudio"
local dumpURL = "https://setup.rbxcdn.com/%s-API-Dump.json"
local HttpService = game:GetService("HttpService")
function LoadAPI()
	local resp = HttpService:RequestAsync({Url = latestURL})
	if resp.StatusCode < 200 or resp.StatusCode >= 300 then
		error("failed to get latest build data", 2)
	end
	local version = resp.Body
	local resp = HttpService:RequestAsync({Url = string.format(dumpURL, version)})
	if resp.StatusCode < 200 or resp.StatusCode >= 300 then
		error("failed to get latest dump data", 2)
	end
	return HttpService:JSONDecode(resp.Body)
end

The only drawback is that the version URL points to the latest built version, not the latest released version, so the data is likely to be newer than expected.

9 Likes

I was actually completely unaware that you could do this. I would have assumed because you can’t access most Roblox domains you wouldn’t be able to access rbxcdn as well, but, turns out that’s not the case, which, is extremely nice to know.

I still believe that having an official API to do this makes sense, however, it seems rather hacky to be fetching it this way (despite extremely useful to be able to do so).

Thanks for pointing this out! :smile:

You can’t access those domains to prevent potentially malicious writing of data. The cdn is inherently readonly, thus safe to be accessible.

1 Like

Doesn’t this also mean its then possible to request raw asset content since it can be done without the https://roblox.com/asset endpoint? The ThreeJS code on the website has code which produces the rbxcdn subdomain for an asset hash. Interesting… :thinking:

HttpService and parsing the api dump really shouldn’t be necessary when an API could give it to you in a more practical structure and more reliably.