aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf/json/config.h
diff options
context:
space:
mode:
authordimastark <dimastark@yandex-team.com>2024-09-30 16:58:58 +0300
committerdimastark <dimastark@yandex-team.com>2024-09-30 17:11:11 +0300
commit4cd5d4661db60c7f096ec51f08bca0ed7aba8f9b (patch)
tree03a54adef9e505da807b2456aeadfc29a2b1ece6 /library/cpp/protobuf/json/config.h
parent334072c7351043236bdca34f2ede8ed1cb4a6d79 (diff)
downloadydb-4cd5d4661db60c7f096ec51f08bca0ed7aba8f9b.tar.gz
SortMapKeys in proto2json for deterministic seriarialization
commit_hash:e64dedae589fa2d16347be4d80e2596f46566b38
Diffstat (limited to 'library/cpp/protobuf/json/config.h')
-rw-r--r--library/cpp/protobuf/json/config.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/library/cpp/protobuf/json/config.h b/library/cpp/protobuf/json/config.h
index 98d484cdf4..d0d2d21bcf 100644
--- a/library/cpp/protobuf/json/config.h
+++ b/library/cpp/protobuf/json/config.h
@@ -109,6 +109,9 @@ namespace NProtobufJson {
bool WriteNanAsString = false;
+ // Sort keys in maps before serialization.
+ bool SortMapKeys = false;
+
TSelf& SetDoubleNDigits(ui32 ndigits) {
DoubleNDigits = ndigits;
return *this;
@@ -189,6 +192,11 @@ namespace NProtobufJson {
return *this;
}
+ TSelf& SetSortMapKeys(bool value) {
+ SortMapKeys = value;
+ return *this;
+ }
+
TSelf& SetStringifyNumbers(EStringifyNumbersMode stringify) {
StringifyNumbers = stringify;
return *this;