Skip to content

Commit 3437b5a

Browse files
committed
error: change gojay.EmbeddedJSON to json.RawMessage
1 parent eebf3de commit 3437b5a

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

error.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
package jsonrpc2
66

77
import (
8+
"encoding/json"
89
"fmt"
910

10-
"github.com/francoispqt/gojay"
1111
"golang.org/x/xerrors"
1212
)
1313

@@ -53,7 +53,7 @@ type Error struct {
5353

5454
// Data a Primitive or Structured value that contains additional
5555
// information about the error. Can be omitted.
56-
Data *gojay.EmbeddedJSON `json:"data"`
56+
Data *json.RawMessage `json:"data"`
5757

5858
frame xerrors.Frame
5959
err error

error_gen.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// Code generated by GoJay. DO NOT EDIT.
6-
75
package jsonrpc2
86

97
import (
@@ -17,23 +15,17 @@ func (v *Error) UnmarshalJSONObject(dec *gojay.Decoder, k string) error {
1715
return dec.Int64((*int64)(&v.Code))
1816
case "message":
1917
return dec.String(&v.Message)
20-
case "data":
21-
if v.Data == nil {
22-
v.Data = &gojay.EmbeddedJSON{}
23-
}
24-
return dec.AddEmbeddedJSON(v.Data)
2518
}
2619
return nil
2720
}
2821

2922
// NKeys returns the number of keys to unmarshal
30-
func (v *Error) NKeys() int { return 3 }
23+
func (v *Error) NKeys() int { return 2 }
3124

3225
// MarshalJSONObject implements gojay's MarshalerJSONObject
3326
func (v *Error) MarshalJSONObject(enc *gojay.Encoder) {
3427
enc.IntKey("code", int(v.Code))
3528
enc.StringKey("message", v.Message)
36-
enc.AddEmbeddedJSONKey("data", v.Data)
3729
}
3830

3931
// IsNil returns wether the structure is nil value or not

0 commit comments

Comments
 (0)