Skip to content

Commit 82c6675

Browse files
author
Jason Yellick
committed
[FAB-5443] Have configtxlator emit default fields
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>
1 parent c904d2b commit 82c6675

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

common/tools/configtxlator/rest/protolator_handlers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var (
4545
},
4646
}
4747

48-
testOutput = `{"data":{"data":[{"signature":"YmFy"}]},"header":{"previous_hash":"Zm9v"}}`
48+
testOutput = `{"data":{"data":[{"signature":"YmFy"}]},"header":{"number":"0","previous_hash":"Zm9v"}}`
4949
)
5050

5151
func TestProtolatorDecode(t *testing.T) {

common/tools/protolator/json.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ func protoToJSON(msg proto.Message) ([]byte, error) {
216216
var b bytes.Buffer
217217
m := jsonpb.Marshaler{
218218
EnumsAsInts: false,
219-
EmitDefaults: false,
220-
Indent: " ",
219+
EmitDefaults: true,
220+
Indent: " ",
221221
OrigName: true,
222222
}
223223
err := m.Marshal(&b, msg)

0 commit comments

Comments
 (0)