bevyengine / bevyengine/bevy

Revisit BRP naming strategy for consistency with Rust types

Open
#23,182 0 comments 1 reaction 0 assignees View on GitHub
A-Dev-Tools C-Usability S-Needs-Design X-Contentious
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

> It is a bit weird that this is deviating from componentInfo's field names for some fields and matching for others.

> The issue I faced was the unserializability of ComponentInfo and its fields.
> I was torn between:
>
> Wanting to mirror data from ComponentInfo 1 to 1.
> Slightly adapting the fields to a similar format.
> I decided to rename fields/structs to reflect this "almost the same but not quite", hence the "Type into Kind". And then I forgot this when I named the ComponentMetadata::storageType field, which should probably be ComponentInfo::storageKind if follow my logic. Or maybe not since StorageKind is actually equal to StorageType ...
>
> But do you have suggestions on how to better handle this? Should StorageKind be changed into some sort of new type tuple? What are best practices for serializing an unserializable type?

> I don't think this needs to be solved in this PR. My understanding is that the whole rest of the BRP API surface does the same thing so it would be a big refactor to change that. I just wanted to call out for documentation purposes that this is happening.

Originally discussed by @ChristopherBiscardi and @splo in https://github.com/bevyengine/bevy/pull/23102#pullrequestreview-3870715097_

Contributor guide

Open the contributing guide

Research direction

Start with the naming discussion linked from PR #23102 and compare the BRP names with the referenced ComponentInfo fields and Rust types. Determine whether the API should mirror ComponentInfo, adapt its names, or introduce distinct serialized types; done means a documented, consistent naming strategy and an agreed scope for any refactor.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.