Skip to content

Commit

Permalink
[FAB-5443] Have configtxlator emit default fields
Browse files Browse the repository at this point in the history
Currently, configtxlator outputs configs with default fields omitted.
This means for instance that if a value has not been changed, its
version at 0 is not printed.  Similarly, if there is no CRL defined, the
CRL field is not printed.

Based on multiple reports, this behavior seems to be more confusing than
helpful.  This CR changes the code to turn the emit defaults flag on.

Change-Id: I4b393f4eb0473fd3e7ee09b7db6ccc4ac7c1932c
Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
  • Loading branch information
Jason Yellick committed Jul 26, 2017
1 parent c904d2b commit 82c6675
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var (
},
}

testOutput = `{"data":{"data":[{"signature":"YmFy"}]},"header":{"previous_hash":"Zm9v"}}`
testOutput = `{"data":{"data":[{"signature":"YmFy"}]},"header":{"number":"0","previous_hash":"Zm9v"}}`
)

func TestProtolatorDecode(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions common/tools/protolator/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ func protoToJSON(msg proto.Message) ([]byte, error) {
var b bytes.Buffer
m := jsonpb.Marshaler{
EnumsAsInts: false,
EmitDefaults: false,
Indent: " ",
EmitDefaults: true,
Indent: " ",
OrigName: true,
}
err := m.Marshal(&b, msg)
Expand Down

0 comments on commit 82c6675

Please sign in to comment.