open-rpc / inspector

🕵️‍♂️ OpenRPC Inspector is a simple tool to create, modify and execute JSON-RPC requests.
https://inspector.open-rpc.org/
Apache License 2.0
21 stars 8 forks source link

fix: fetch schema ref stated by rpc.discover #332

Closed ivy-rew closed 7 months ago

ivy-rew commented 8 months ago

fixes https://github.com/open-rpc/inspector/issues/331 fixed discovery

ivy-rew commented 8 months ago

can you check this open-rpc inspector fix @shanejonas ?

shanejonas commented 8 months ago

It seems there's a misunderstanding about rpc.discover. The link you mentioned actually outlines the OpenRPC method description for service discovery. It's meant to return the OpenRPC document directly, detailing the service's API. Here’s what it looks like in action:

--> {"jsonrpc": "2.0", "method": "rpc.discover", "params": [], "id": 1}
<-- {"jsonrpc": "2.0", "result": {"info": {}, "methods": [], "components": {}}, "id": 1}

This shows the direct retrieval of the OpenRPC document.

ivy-rew commented 7 months ago

It seems there's a misunderstanding about rpc.discover. The link you mentioned actually outlines the OpenRPC method description for service discovery. It's meant to return the OpenRPC document directly, detailing the service's API. Here’s what it looks like in action:

--> {"jsonrpc": "2.0", "method": "rpc.discover", "params": [], "id": 1}
<-- {"jsonrpc": "2.0", "result": {"info": {}, "methods": [], "components": {}}, "id": 1}

This shows the direct retrieval of the OpenRPC document.

Thanks a lot for your explanation @shanejonas. Now I see that I got the concept wrong and as I couldn't quickly find a real-world example with the 'rpc.discover' method implemented, so I invented one with my confused understanding :sweat_smile:

However, for my service it would make things a little easier if I could defer the service description. I assumed that deferred external schema refs are always allowed just as they are in json-schema in general. :thinking:

--> {"jsonrpc": "2.0", "method": "rpc.discover", "params": [], "id": 1}
<-- {"jsonrpc": "2.0", "result": {"$ref": "https://json-schema.axonivy.com/openrpc/11.3.0/inscription.json"}, "id": 1}
ivy-rew commented 7 months ago

my change isn't foreseen in the openrpc spec, so it makes no sense to add it.