bevy/crates/bevy_remote
MevLyshkin cae2da3cee
BRP registry JSON schema endpoint (#16882)
# Objective

Resolve #16745

## Solution

Provide a way to map `AppTypeRegistry` types into a JSON Schema that can
be used in other applications. I took code from
https://github.com/kaosat-dev/Blenvy as a starting point, cleaned up and
adapter more for `bevy_remote` needs. Based on feedback and needs it
could be improved, I could add some filtering options, etc.

## Testing

- I was comparing results with the ones from code in `blenvy`
- There is added unit test, could be added more
- I was testing it in my game with this code:
```rust
fn types_to_file(world: &mut World) {
    use bevy_remote::builtin_methods::export_registry_types;
    let Ok(Ok(types_schema)) = world.run_system_cached_with(export_registry_types, None) else {
        return;
    };
    let registry_save_path = std::path::Path::new("assets").join("registry.json");
    let writer =
        std::fs::File::create(registry_save_path).expect("should have created schema file");
    serde_json::to_writer_pretty(writer, &types_schema).expect("Failed to save types to file");
}
```
It can be run by adding it at startup 
```rust
app.add_systems(Startup, types_to_file);
```

---------

Co-authored-by: Gino Valente <49806985+MrGVSV@users.noreply.github.com>
2024-12-26 22:14:08 +00:00
..
src BRP registry JSON schema endpoint (#16882) 2024-12-26 22:14:08 +00:00
Cargo.toml remove reference to missing file in bevy_remote cargo.toml (#16057) 2024-10-22 20:21:19 +00:00