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

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
remotes/KirillovDenis/release/v0.21.1
Leonard Lyubich 2021-01-15 10:40:19 +03:00 committed by Alex Vanin
parent dde24bc9e5
commit 36d8e2d3b7
1 changed files with 7 additions and 0 deletions

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