mirror of
https://github.com/sourcegraph/jsonrpc2.git
synced 2026-06-19 05:30:03 +02:00
Add Meta field to Response (#10)
This commit is contained in:
parent
7ea7528660
commit
955f217b74
1 changed files with 12 additions and 1 deletions
13
jsonrpc2.go
13
jsonrpc2.go
|
|
@ -37,8 +37,13 @@ type Request struct {
|
||||||
Method string `json:"method"`
|
Method string `json:"method"`
|
||||||
Params *json.RawMessage `json:"params,omitempty"`
|
Params *json.RawMessage `json:"params,omitempty"`
|
||||||
ID ID `json:"id"`
|
ID ID `json:"id"`
|
||||||
Meta *json.RawMessage `json:"meta,omitempty"`
|
|
||||||
Notif bool `json:"-"`
|
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"
|
// MarshalJSON implements json.Marshaler and adds the "jsonrpc":"2.0"
|
||||||
|
|
@ -126,6 +131,12 @@ type Response struct {
|
||||||
Result *json.RawMessage `json:"result"`
|
Result *json.RawMessage `json:"result"`
|
||||||
Error *Error `json:"error,omitempty"`
|
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
|
// SPEC NOTE: The spec says "If there was an error in detecting
|
||||||
// the id in the Request object (e.g. Parse error/Invalid
|
// the id in the Request object (e.g. Parse error/Invalid
|
||||||
// Request), it MUST be Null." If we made the ID field nullable,
|
// Request), it MUST be Null." If we made the ID field nullable,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue