Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added bevy/components method to BRP, which lists all world components #16626

Closed

Conversation

Lommix
Copy link

@Lommix Lommix commented Dec 3, 2024

New BRP method to list all available fully qualified components in the active world.

After using the newly added BRP feature and trying to build tools around it, I encountered a common issue. There is no way to get all available fully qualified component names from bevy and user space without accumulating them over each entity. Which has an insane cost attached to it.

This is a Problem If you want to provided auto complete for a query API or just want to know what is available without looking into the source code.

This should not be part of the user space, rather be a common method in bevy_remote itself.

Solution

  • Added a new method that returns a list of all fully qualified component names, active on the current world.
  • method: bevy/components
  • params: None
  • result: An array of fully-qualified type names of all world components

Testing

  • Tested on the new server example with curl and JSON-RPC.

Showcase

start the server example

cargo run --example server --features="bevy_remote"

get the list result from the new bevy/components method

curl --silent --no-buffer -X POST -H 'Content-Type: application/json' -d '{"id": 0 ,"jsonrpc":"2.0", "method": "bevy/components", "params": {}}' http://127.0.0.1:15702

Result

remote_component_list_response.json

Copy link
Contributor

github-actions bot commented Dec 3, 2024

Welcome, new contributor!

Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨

@Leinnan
Copy link
Contributor

Leinnan commented Dec 3, 2024

@Lommix Isn't that essentialy the same as bevy/list? Example to check:

curl -X POST -d '{ "jsonrpc": "2.0", "id": 1, "method": "bevy/list" }' 127.0.0.1:15702 | jq .    

@Lommix
Copy link
Author

Lommix commented Dec 3, 2024

@Leinnan

Thank you for the enlightenment, you are correct. I did not read correctly.
This is an unnecessary change. Once again, the biggest bug is not in the code, but sitting in front of it xD

I'll close this silently in shame =)

@Lommix Lommix closed this Dec 3, 2024
@Lommix Lommix deleted the brp-world-component-list-method branch December 3, 2024 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants