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/json2proto.h | |
parent | fef1ffbaef82af08b6201f41c2ed15723a4fe1cf (diff) | |
download | ydb-29af40f86c4159175acf78d57de7cd39e44c0dab.tar.gz |
MARKETRECOM-8673_json_enum_value
Diffstat (limited to 'library/cpp/protobuf/json/json2proto.h')
-rw-r--r-- | library/cpp/protobuf/json/json2proto.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/library/cpp/protobuf/json/json2proto.h b/library/cpp/protobuf/json/json2proto.h index d576fabce7..aedbb8affc 100644 --- a/library/cpp/protobuf/json/json2proto.h +++ b/library/cpp/protobuf/json/json2proto.h @@ -48,6 +48,12 @@ namespace NProtobufJson { return *this; } + TSelf& SetUseJsonEnumValue(bool jsonEnumValue) { + Y_ENSURE(!jsonEnumValue || EnumValueMode == EnumCaseSensetive, "EnumValueMode and UseJsonEnumValue are mutually exclusive"); + UseJsonEnumValue = jsonEnumValue; + return *this; + } + TSelf& AddStringTransform(TStringTransformPtr transform) { StringTransforms.push_back(transform); return *this; @@ -84,6 +90,7 @@ namespace NProtobufJson { } TSelf& SetEnumValueMode(EnumValueMode enumValueMode) { + Y_ENSURE(!UseJsonEnumValue || enumValueMode == EnumCaseSensetive, "EnumValueMode and UseJsonEnumValue are mutually exclusive"); EnumValueMode = enumValueMode; return *this; } @@ -115,6 +122,10 @@ namespace NProtobufJson { /// with FieldNameMode. bool UseJsonName = false; + /// Use 'json_enum_value' protobuf option for enum value, mutually exclusive + /// with EnumValueMode + bool UseJsonEnumValue = false; + /// Transforms will be applied only to string values (== protobuf fields of string / bytes type). TVector<TStringTransformPtr> StringTransforms; |