[#311] control: Implement JSON marshaler on Netmap message

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-01-15 10:40:19 +03:00 committed by Alex Vanin
parent dde24bc9e5
commit 36d8e2d3b7

View file

@ -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)
}