Skip to content
Snippets Groups Projects
Commit 480677cf authored by ko_oler's avatar ko_oler
Browse files

правки в marshall/unmarshall json

parent 6d7fc0fd
No related branches found
No related tags found
No related merge requests found
...@@ -6,8 +6,8 @@ import ( ...@@ -6,8 +6,8 @@ import (
) )
type jsonSchema struct { 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 { func (s *Schema) UnmarshalJSON(b []byte) error {
...@@ -17,6 +17,7 @@ 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") return errors.Wrapf(err, "error unmarshal json into field")
} }
s.Loaded = j.Loaded s.Loaded = j.Loaded
s.Metadata = j.Metadata
if err := s.Field.UnmarshalJSON(b); err != nil { if err := s.Field.UnmarshalJSON(b); err != nil {
return err return err
...@@ -42,8 +43,8 @@ func (s *Schema) MarshalJSON() ([]byte, error) { ...@@ -42,8 +43,8 @@ func (s *Schema) MarshalJSON() ([]byte, error) {
} }
jsonSch, err := jsoniter.Marshal(jsonSchema{ jsonSch, err := jsoniter.Marshal(jsonSchema{
//Field: b,
Loaded: s.Loaded, Loaded: s.Loaded,
Metadata: s.Metadata,
}) })
if err != nil { if err != nil {
return nil, err return nil, err
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment