RPC Discover endpoint with basic informations (#18068)
# Objective
It does not resolves issue for full support for OpenRPC for
`bevy_remote`, but it is a first step in that direction. Connected to
the #16744 issue.
## Solution
- Adds `rpc.discover` endpoint to the bevy_remote which follows
https://spec.open-rpc.org/#openrpc-document For now in methods array
only the name, which is the endpoint address is populated.
- Moves json_schema structs into new module inside `bevy_remote`.
## Testing
Tested the commands by running the BRP sample( cargo run --example
server --features="bevy_remote") and with these curl command:
```sh
curl -X POST -d '{ "jsonrpc": "2.0", "id": 1, "method": "rpc.discover"}' 127.0.0.1:15702 | jq .
```
The output is:
```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"info": {
"title": "Bevy Remote Protocol",
"version": "0.16.0-dev"
},
"methods": [
{
"name": "bevy/mutate_component",
"params": []
},
{
"name": "bevy/insert",
"params": []
},
{
"name": "bevy/get",
"params": []
},
{
"name": "bevy/spawn",
"params": []
},
{
"name": "bevy/get+watch",
"params": []
},
{
"name": "bevy/destroy",
"params": []
},
{
"name": "bevy/list",
"params": []
},
{
"name": "bevy/mutate_resource",
"params": []
},
{
"name": "bevy/reparent",
"params": []
},
{
"name": "bevy/registry/schema",
"params": []
},
{
"name": "bevy/get_resource",
"params": []
},
{
"name": "bevy/query",
"params": []
},
{
"name": "bevy/remove_resource",
"params": []
},
{
"name": "rpc.discover",
"params": []
},
{
"name": "bevy/insert_resource",
"params": []
},
{
"name": "bevy/list_resources",
"params": []
},
{
"name": "bevy/remove",
"params": []
},
{
"name": "bevy/list+watch",
"params": []
}
],
"openrpc": "1.3.2",
"servers": [
{
"name": "Server",
"url": "127.0.0.1:15702"
}
]
}
}
```
---------
Co-authored-by: Viktor Gustavsson <villor94@gmail.com>