aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf/json/config.h
diff options
context:
space:
mode:
authorsashashkov <sashashkov@yandex-team.com>2024-06-11 13:03:18 +0300
committersashashkov <sashashkov@yandex-team.com>2024-06-12 10:26:35 +0300
commit67e7cccc330744cdb98035e309f626c1f63afb84 (patch)
treef29f638710ae5223dbb7a56e427aea6c551bdff6 /library/cpp/protobuf/json/config.h
parenta26a1f012a93e209458200c2ba8ae484a45a6c54 (diff)
downloadydb-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.h11
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;
}
+
};
}