Conversation
cmd/speccheck/extended_types.go
Outdated
| ) | ||
|
|
||
| // ErrorObject represents a single error in an error group | ||
| type ErrorObject struct { |
There was a problem hiding this comment.
I think you might need to have an ErrorObjectOrRef as well as ErrorGroupOrRef.
for referennce for error object:
https://github.com/open-rpc/meta-schema/blob/master/openrpc_document.go#L467
this would then account for
x-error-groups: [ [{"$ref": "#/GasError1"}, {"$ref":"#/BlockError2"}], [{ code: 9999, message: "foobar"}], {"$ref":"#/AllUndefinedErrors} ]
where AllUndefinedErrors is of the type ErrorGroup
There was a problem hiding this comment.
Follow up comment here is that it looks like you want to throw on discovering refs, which makes sense.
| } | ||
|
|
||
| func readSpec(path string) (*openrpc.OpenrpcDocument, error) { | ||
| func readSpec(path string) (*ExtendedOpenrpcDocument, error) { |
There was a problem hiding this comment.
For the spec or this reading of the spec, I'm not sure if you'll have a dereferencer step already on the outside, that would make this easier as you wouldn't need to figure out how to resolve the json pointers, and so the ref types essentially wouldn't need to be specified.
It would just be a matter of general correctness, that you could then throw an error on, if someone passes you a ref vs the object, in the additional places. It might be nice to have those checks on the deserialiization like you have for the methodobject
Overall I think this makes sense
There was a problem hiding this comment.
Yea the spec should be fully de-referenced before passing on to the speccheck by this https://github.com/simsonraj/execution-apis/blob/error_groups/scripts/build.js#L145
I have also added additional validations, as you mentioned in the earlier comments
Notes:
eth_sendRawTransaction)https://github.com/simsonraj/rpctestgen/blob/error_groups_extension/testgen/generators.go
To Run:
go run github.com/lightclient/rpctestgen/cmd/speccheck -vResult:
Currently only warns, but continues, need to update once the Proposal is ironed out
