Skip to content

Schema types metadata #19524

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

Leinnan
Copy link
Contributor

@Leinnan Leinnan commented Jun 7, 2025

Objective

  • Currently there is predefinied list of supported DataTypes that can be detected on Bevy JSON Schema generation and mapped as reflect_types array elements.
  • Make it possible to register custom reflectTypes mappings for Bevy JSON Schema.

Solution

  • Create a SchemaTypesMetadata Resource that will hold mappings for TypeId of TypeData. List is bigger from beggining and it is possible to expand it without forking package.

Testing

  • I use it for quite a while in my game, I have a fork of bevy_remote with more changes that later I want to merge to main as well.

@Leinnan
Copy link
Contributor Author

Leinnan commented Jun 7, 2025

@mweatherley @splo Could be interested in this :) It is a first step towards bigger refactor- namely proper JSON Schema support. But that is a much bigger change and I want to clean up my code from here a lot more: https://github.com/Leinnan/bevy_remote_ext

Comment on lines 18 to 19
/// Holds mapping of reflect data types to strings,
/// later on used in Bevy Json Schema.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of "strings"? Are these the schemas themselves? Type paths? Might be worth clarifying.

Same goes for other mentions of "string" in this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have idea how to make it more clear ATM. If you have, please suggest 😅

let t = reg.type_info();
let binding = t.type_path_table();

let short_path = binding.short_path();
let type_path = binding.path();
let mut typed_schema = JsonSchemaBevyType {
reflect_types: get_registered_reflect_types(reg),
reflect_types: metadata.get_registered_reflect_types(reg),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, didn't realize this field was just called reflect_types when it really just holds simplified names of type data. I wonder if it should be renamed to reflect_type_data or type_data or something? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to change the structure of schema a bit, so that if possible I would leave for next PR 😅

Leinnan and others added 2 commits June 7, 2025 19:37
Co-authored-by: Gino Valente <[email protected]>
Co-authored-by: Gino Valente <[email protected]>
@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible A-Dev-Tools Tools used to debug Bevy applications. S-Needs-Review Needs reviewer attention (from anyone!) to move forward S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 7, 2025
@Leinnan Leinnan requested a review from MrGVSV June 8, 2025 08:48
@Leinnan
Copy link
Contributor Author

Leinnan commented Jun 8, 2025

@MrGVSV Updated with almost all feedback applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Dev-Tools Tools used to debug Bevy applications. C-Feature A new feature, making something new possible S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants