open-rpc / spec

The OpenRPC specification
https://spec.open-rpc.org
Apache License 2.0
166 stars 49 forks source link

Examples should allow error results #363

Open BelfordZ opened 2 years ago

BelfordZ commented 2 years ago

This would also make automated testing tools able to test against failing cases.

BelfordZ commented 3 months ago

Since all result & param reference ExampleObjects, and example objects aren't really structured to be examples of errors, im wondering what the value for examplePairings.error should be?

BelfordZ commented 3 months ago

Should you be able to ref an ErrorObject? ie:

{
  "name": "examplepair",
  "params": [...],
  "error": { "$ref": "components/errors/bigbad" }
}
BelfordZ commented 3 months ago

Should it be the same as the others, use ExampleObject.value and provide the whole error object?

{
  "name": "examplepair",
  "params": [...],
  "error": { 
    "name": "big bad example", 
    "value": {
      "code": 404, 
      "message": "dog ate homework", 
      "data": {}
     }
   }
}
BelfordZ commented 3 months ago

either?

shanejonas commented 3 months ago

hm maybe value itself should be the raw error or a ref?