diff options
author | sashashkov <sashashkov@yandex-team.com> | 2024-06-11 13:03:18 +0300 |
---|---|---|
committer | sashashkov <sashashkov@yandex-team.com> | 2024-06-12 10:26:35 +0300 |
commit | 67e7cccc330744cdb98035e309f626c1f63afb84 (patch) | |
tree | f29f638710ae5223dbb7a56e427aea6c551bdff6 /library/cpp/protobuf/json/config.h | |
parent | a26a1f012a93e209458200c2ba8ae484a45a6c54 (diff) | |
download | ydb-67e7cccc330744cdb98035e309f626c1f63afb84.tar.gz |
Implement number stringification for repeated fields as well
4ab5908e416439366466d984fc08db7254401884
Diffstat (limited to 'library/cpp/protobuf/json/config.h')
-rw-r--r-- | library/cpp/protobuf/json/config.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/library/cpp/protobuf/json/config.h b/library/cpp/protobuf/json/config.h index d17ac7b15b..98d484cdf4 100644 --- a/library/cpp/protobuf/json/config.h +++ b/library/cpp/protobuf/json/config.h @@ -86,15 +86,18 @@ namespace NProtobufJson { /// Print map as object, otherwise print it as array of key/value objects bool MapAsObject = false; - /// Stringify long integers which are not exactly representable by float or double values enum EStringifyNumbersMode { StringifyLongNumbersNever = 0, // default StringifyLongNumbersForFloat, StringifyLongNumbersForDouble, StringifyInt64Always, }; + /// Stringify long integers which are not exactly representable by float or double values. Not affect repeated numbers, for repeated use StringifyNumbersRepeated EStringifyNumbersMode StringifyNumbers = StringifyLongNumbersNever; + /// Stringify repeated long integers which are not exactly representable by float or double values. May cause heterogenous arrays, use StringifyInt64Always or StringifyLongNumbersNever to avoid + EStringifyNumbersMode StringifyNumbersRepeated = StringifyLongNumbersNever; + /// Decode Any fields content bool ConvertAny = false; @@ -191,6 +194,11 @@ namespace NProtobufJson { return *this; } + TSelf& SetStringifyNumbersRepeated(EStringifyNumbersMode stringify) { + StringifyNumbersRepeated = stringify; + return *this; + } + TSelf& SetNameGenerator(TNameGenerator callback) { NameGenerator = callback; return *this; @@ -210,6 +218,7 @@ namespace NProtobufJson { ConvertAny = value; return *this; } + }; } |