diff --git a/jsonrpc2.go b/jsonrpc2.go index 29ae130..45c367e 100644 --- a/jsonrpc2.go +++ b/jsonrpc2.go @@ -37,8 +37,13 @@ type Request struct { Method string `json:"method"` Params *json.RawMessage `json:"params,omitempty"` ID ID `json:"id"` - Meta *json.RawMessage `json:"meta,omitempty"` Notif bool `json:"-"` + + // Meta optionally provides metadata to include in the request. + // + // NOTE: It is not part of spec. However, it is useful for propogating + // tracing context, etc. + Meta *json.RawMessage `json:"meta,omitempty"` } // MarshalJSON implements json.Marshaler and adds the "jsonrpc":"2.0" @@ -126,6 +131,12 @@ type Response struct { Result *json.RawMessage `json:"result"` Error *Error `json:"error,omitempty"` + // Meta optionally provides metadata to include in the response. + // + // NOTE: It is not part of spec. However, it is useful for propogating + // tracing context, etc. + Meta *json.RawMessage `json:"meta,omitempty"` + // SPEC NOTE: The spec says "If there was an error in detecting // the id in the Request object (e.g. Parse error/Invalid // Request), it MUST be Null." If we made the ID field nullable,