diff options
author | malkovskynv <malkovskynv@yandex-team.com> | 2023-08-03 13:42:05 +0300 |
---|---|---|
committer | malkovskynv <malkovskynv@yandex-team.com> | 2023-08-03 13:42:05 +0300 |
commit | 29af40f86c4159175acf78d57de7cd39e44c0dab (patch) | |
tree | 016948d29c43f651dd64d5a9f2d9cbdd4a827bfc /library/cpp/protobuf/json/config.h | |
parent | fef1ffbaef82af08b6201f41c2ed15723a4fe1cf (diff) | |
download | ydb-29af40f86c4159175acf78d57de7cd39e44c0dab.tar.gz |
MARKETRECOM-8673_json_enum_value
Diffstat (limited to 'library/cpp/protobuf/json/config.h')
-rw-r--r-- | library/cpp/protobuf/json/config.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/library/cpp/protobuf/json/config.h b/library/cpp/protobuf/json/config.h index 96bb832565..eee047e155 100644 --- a/library/cpp/protobuf/json/config.h +++ b/library/cpp/protobuf/json/config.h @@ -72,6 +72,10 @@ namespace NProtobufJson { /// with FieldNameMode. bool UseJsonName = false; + /// Use 'json_enum_value' protobuf option for enum value, mutually exclusive + /// with EnumValueMode + bool UseJsonEnumValue = false; + // Allow nonstandard conversions, e.g. from google.protobuf.Duration to string bool ConvertTimeAsString = false; @@ -135,6 +139,7 @@ namespace NProtobufJson { } TSelf& SetEnumMode(EnumValueMode mode) { + Y_ENSURE(!UseJsonEnumValue || mode == EnumNumber, "EnumValueMode and UseJsonEnumValue are mutually exclusive"); EnumMode = mode; return *this; } @@ -151,6 +156,13 @@ namespace NProtobufJson { return *this; } + TSelf& SetUseJsonEnumValue(bool jsonEnumValue) { + Y_ENSURE(!jsonEnumValue || EnumMode == EnumNumber, "EnumValueMode and UseJsonEnumValue are mutually exclusive"); + UseJsonEnumValue = jsonEnumValue; + return *this; + } + + TSelf& SetConvertTimeAsString(bool value) { ConvertTimeAsString = value; return *this; |