server-js icon indicating copy to clipboard operation
server-js copied to clipboard

JSONRPCResponse: id doesn't allow null

Open zmeyc opened this issue 4 years ago • 0 comments

Describe the bug

According to https://www.jsonrpc.org/specification section 5 Response object when there was an error in detecting the id in the Request object (e.g. Parse error/Invalid Request), id MUST be Null.

But in JSONRPCResponse in https://github.com/open-rpc/server-js/blob/master/src/transports/server-transport.ts id is defined as string or undefined:

export interface JSONRPCResponse {
  jsonrpc: string;
  id?: string;
  result?: any;
  error?: JSONRPCErrorObject;
}

Should it be defined as id: string | null instead?

zmeyc avatar Aug 18 '20 19:08 zmeyc