From 36d8e2d3b7e2c64d4828cd13c89747acc869a3ea Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 15 Jan 2021 10:40:19 +0300 Subject: [PATCH] [#311] control: Implement JSON marshaler on Netmap message Signed-off-by: Leonard Lyubich --- pkg/services/control/types.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/services/control/types.go b/pkg/services/control/types.go index 43a350db9..d6cb909f6 100644 --- a/pkg/services/control/types.go +++ b/pkg/services/control/types.go @@ -2,6 +2,7 @@ package control import ( "github.com/nspcc-dev/neofs-api-go/util/proto" + "google.golang.org/protobuf/encoding/protojson" ) // SetKey sets public key used for signing. @@ -309,3 +310,9 @@ func (x *Netmap) StableSize() int { return size } + +func (x *Netmap) MarshalJSON() ([]byte, error) { + return protojson.MarshalOptions{ + EmitUnpopulated: true, + }.Marshal(x) +}