diff options
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; |