From 480677cf7f8c34e3708de744c783fc5b40840f67 Mon Sep 17 00:00:00 2001 From: ko_oler <kooler89@gmail.com> Date: Mon, 10 Jul 2023 21:36:13 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=B2?= =?UTF-8?q?=20marshall/unmarshall=20json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/schema/schema_json.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/schema/schema_json.go b/pkg/schema/schema_json.go index 906acb5d..e8710f76 100644 --- a/pkg/schema/schema_json.go +++ b/pkg/schema/schema_json.go @@ -6,8 +6,8 @@ import ( ) type jsonSchema struct { - //Field json.RawMessage `json:"field,inline"` - Loaded bool `json:"loaded"` + Loaded bool `json:"loaded"` + Metadata map[string]string `json:"metadata"` } func (s *Schema) UnmarshalJSON(b []byte) error { @@ -17,6 +17,7 @@ func (s *Schema) UnmarshalJSON(b []byte) error { return errors.Wrapf(err, "error unmarshal json into field") } s.Loaded = j.Loaded + s.Metadata = j.Metadata if err := s.Field.UnmarshalJSON(b); err != nil { return err @@ -42,8 +43,8 @@ func (s *Schema) MarshalJSON() ([]byte, error) { } jsonSch, err := jsoniter.Marshal(jsonSchema{ - //Field: b, - Loaded: s.Loaded, + Loaded: s.Loaded, + Metadata: s.Metadata, }) if err != nil { return nil, err -- GitLab