rdkcentral / firebolt-apis

The Firebolt API OpenRPC schemas and SDK artifact configurations.
Apache License 2.0
13 stars 21 forks source link

Provider method that does not return anything results in invalid provider response RPC #301

Open kpears201 opened 1 month ago

kpears201 commented 1 month ago

Author a provider class like:

class MyProvider {
   function action(actionParams) {
       console.log(actionParams)
   }
}

When action method is called and returns it generates rpc method like:

{
    "jsonrpc": "2.0",
    "method": "MyProvider.actionResponse",
    "params": {
        "correlationId": "abcdef-123-1111-111-1234234234"
    }
}

It is missing result which is a required field in the generated specification for provider responses.

If changed to:

class MyProvider {
   function action(actionParams) {
       console.log(actionParams)
       return null
   }
}

It should work as the result field gets set to null.

The Firebolt SDK should allow a provider method with no return. When result is undefined, set to null.