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 | |
parent | fef1ffbaef82af08b6201f41c2ed15723a4fe1cf (diff) | |
download | ydb-29af40f86c4159175acf78d57de7cd39e44c0dab.tar.gz |
MARKETRECOM-8673_json_enum_value
Diffstat (limited to 'library/cpp')
20 files changed, 329 insertions, 5 deletions
diff --git a/library/cpp/protobuf/json/CMakeLists.darwin-x86_64.txt b/library/cpp/protobuf/json/CMakeLists.darwin-x86_64.txt index 5eb786fb5b..6914995d2e 100644 --- a/library/cpp/protobuf/json/CMakeLists.darwin-x86_64.txt +++ b/library/cpp/protobuf/json/CMakeLists.darwin-x86_64.txt @@ -6,6 +6,7 @@ # original buildsystem will not be accepted. +add_subdirectory(proto) add_library(cpp-protobuf-json) target_link_libraries(cpp-protobuf-json PUBLIC @@ -14,6 +15,7 @@ target_link_libraries(cpp-protobuf-json PUBLIC contrib-libs-protobuf library-cpp-json cpp-protobuf-util + protobuf-json-proto cpp-string_utils-relaxed_escaper ) target_sources(cpp-protobuf-json PRIVATE diff --git a/library/cpp/protobuf/json/CMakeLists.linux-aarch64.txt b/library/cpp/protobuf/json/CMakeLists.linux-aarch64.txt index 6fce8bebb0..e3f2a26102 100644 --- a/library/cpp/protobuf/json/CMakeLists.linux-aarch64.txt +++ b/library/cpp/protobuf/json/CMakeLists.linux-aarch64.txt @@ -6,6 +6,7 @@ # original buildsystem will not be accepted. +add_subdirectory(proto) add_library(cpp-protobuf-json) target_link_libraries(cpp-protobuf-json PUBLIC @@ -15,6 +16,7 @@ target_link_libraries(cpp-protobuf-json PUBLIC contrib-libs-protobuf library-cpp-json cpp-protobuf-util + protobuf-json-proto cpp-string_utils-relaxed_escaper ) target_sources(cpp-protobuf-json PRIVATE diff --git a/library/cpp/protobuf/json/CMakeLists.linux-x86_64.txt b/library/cpp/protobuf/json/CMakeLists.linux-x86_64.txt index 6fce8bebb0..e3f2a26102 100644 --- a/library/cpp/protobuf/json/CMakeLists.linux-x86_64.txt +++ b/library/cpp/protobuf/json/CMakeLists.linux-x86_64.txt @@ -6,6 +6,7 @@ # original buildsystem will not be accepted. +add_subdirectory(proto) add_library(cpp-protobuf-json) target_link_libraries(cpp-protobuf-json PUBLIC @@ -15,6 +16,7 @@ target_link_libraries(cpp-protobuf-json PUBLIC contrib-libs-protobuf library-cpp-json cpp-protobuf-util + protobuf-json-proto cpp-string_utils-relaxed_escaper ) target_sources(cpp-protobuf-json PRIVATE diff --git a/library/cpp/protobuf/json/CMakeLists.windows-x86_64.txt b/library/cpp/protobuf/json/CMakeLists.windows-x86_64.txt index 5eb786fb5b..6914995d2e 100644 --- a/library/cpp/protobuf/json/CMakeLists.windows-x86_64.txt +++ b/library/cpp/protobuf/json/CMakeLists.windows-x86_64.txt @@ -6,6 +6,7 @@ # original buildsystem will not be accepted. +add_subdirectory(proto) add_library(cpp-protobuf-json) target_link_libraries(cpp-protobuf-json PUBLIC @@ -14,6 +15,7 @@ target_link_libraries(cpp-protobuf-json PUBLIC contrib-libs-protobuf library-cpp-json cpp-protobuf-util + protobuf-json-proto cpp-string_utils-relaxed_escaper ) target_sources(cpp-protobuf-json PRIVATE 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; diff --git a/library/cpp/protobuf/json/json2proto.cpp b/library/cpp/protobuf/json/json2proto.cpp index be8682e239..3131b9779d 100644 --- a/library/cpp/protobuf/json/json2proto.cpp +++ b/library/cpp/protobuf/json/json2proto.cpp @@ -2,6 +2,7 @@ #include "util.h" #include <library/cpp/json/json_value.h> +#include <library/cpp/protobuf/json/proto/enum_options.pb.h> #include <google/protobuf/util/time_util.h> #include <google/protobuf/message.h> @@ -187,6 +188,18 @@ FindEnumValue(const NProtoBuf::EnumDescriptor* enumField, return nullptr; } +static const NProtoBuf::EnumValueDescriptor* +FindEnumValueByJsonName(const NProtoBuf::EnumDescriptor* enumField, TStringBuf target) { + for (int i = 0; i < enumField->value_count(); i++) { + auto* valueDescriptor = enumField->value(i); + if (valueDescriptor->options().GetExtension(json_enum_value) == target) { + return valueDescriptor; + } + } + return nullptr; +} + + static void JsonEnum2Field(const NJson::TJsonValue& json, google::protobuf::Message& proto, @@ -211,12 +224,16 @@ JsonEnum2Field(const NJson::TJsonValue& json, } } else if (json.IsString()) { const auto& value = json.GetString(); - if (config.EnumValueMode == NProtobufJson::TJson2ProtoConfig::EnumCaseInsensetive) { - enumFieldValue = FindEnumValue(enumField, value, AsciiEqualsIgnoreCase); - } else if (config.EnumValueMode == NProtobufJson::TJson2ProtoConfig::EnumSnakeCaseInsensitive) { - enumFieldValue = FindEnumValue(enumField, value, NProtobufJson::EqualsIgnoringCaseAndUnderscores); + if (config.UseJsonEnumValue) { + enumFieldValue = FindEnumValueByJsonName(enumField, value); } else { - enumFieldValue = enumField->FindValueByName(value); + if (config.EnumValueMode == NProtobufJson::TJson2ProtoConfig::EnumCaseInsensetive) { + enumFieldValue = FindEnumValue(enumField, value, AsciiEqualsIgnoreCase); + } else if (config.EnumValueMode == NProtobufJson::TJson2ProtoConfig::EnumSnakeCaseInsensitive) { + enumFieldValue = FindEnumValue(enumField, value, NProtobufJson::EqualsIgnoringCaseAndUnderscores); + } else { + enumFieldValue = enumField->FindValueByName(value); + } } if (!enumFieldValue) { ythrow yexception() << "Invalid string value of JSON enum field: " << TStringBuf(value).Head(100) << "."; 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; diff --git a/library/cpp/protobuf/json/proto/CMakeLists.darwin-x86_64.txt b/library/cpp/protobuf/json/proto/CMakeLists.darwin-x86_64.txt new file mode 100644 index 0000000000..6c6f4228c3 --- /dev/null +++ b/library/cpp/protobuf/json/proto/CMakeLists.darwin-x86_64.txt @@ -0,0 +1,43 @@ + +# This file was generated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + +get_built_tool_path( + TOOL_protoc_bin + TOOL_protoc_dependency + contrib/tools/protoc/bin + protoc +) +get_built_tool_path( + TOOL_cpp_styleguide_bin + TOOL_cpp_styleguide_dependency + contrib/tools/protoc/plugins/cpp_styleguide + cpp_styleguide +) + +add_library(protobuf-json-proto) +target_link_libraries(protobuf-json-proto PUBLIC + contrib-libs-cxxsupp + yutil + contrib-libs-protobuf +) +target_proto_messages(protobuf-json-proto PRIVATE + ${CMAKE_SOURCE_DIR}/library/cpp/protobuf/json/proto/enum_options.proto +) +target_proto_addincls(protobuf-json-proto + ./ + ${CMAKE_SOURCE_DIR}/ + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src +) +target_proto_outs(protobuf-json-proto + --cpp_out=${CMAKE_BINARY_DIR}/ + --cpp_styleguide_out=${CMAKE_BINARY_DIR}/ +) diff --git a/library/cpp/protobuf/json/proto/CMakeLists.linux-aarch64.txt b/library/cpp/protobuf/json/proto/CMakeLists.linux-aarch64.txt new file mode 100644 index 0000000000..1840a34ee6 --- /dev/null +++ b/library/cpp/protobuf/json/proto/CMakeLists.linux-aarch64.txt @@ -0,0 +1,44 @@ + +# This file was generated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + +get_built_tool_path( + TOOL_protoc_bin + TOOL_protoc_dependency + contrib/tools/protoc/bin + protoc +) +get_built_tool_path( + TOOL_cpp_styleguide_bin + TOOL_cpp_styleguide_dependency + contrib/tools/protoc/plugins/cpp_styleguide + cpp_styleguide +) + +add_library(protobuf-json-proto) +target_link_libraries(protobuf-json-proto PUBLIC + contrib-libs-linux-headers + contrib-libs-cxxsupp + yutil + contrib-libs-protobuf +) +target_proto_messages(protobuf-json-proto PRIVATE + ${CMAKE_SOURCE_DIR}/library/cpp/protobuf/json/proto/enum_options.proto +) +target_proto_addincls(protobuf-json-proto + ./ + ${CMAKE_SOURCE_DIR}/ + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src +) +target_proto_outs(protobuf-json-proto + --cpp_out=${CMAKE_BINARY_DIR}/ + --cpp_styleguide_out=${CMAKE_BINARY_DIR}/ +) diff --git a/library/cpp/protobuf/json/proto/CMakeLists.linux-x86_64.txt b/library/cpp/protobuf/json/proto/CMakeLists.linux-x86_64.txt new file mode 100644 index 0000000000..1840a34ee6 --- /dev/null +++ b/library/cpp/protobuf/json/proto/CMakeLists.linux-x86_64.txt @@ -0,0 +1,44 @@ + +# This file was generated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + +get_built_tool_path( + TOOL_protoc_bin + TOOL_protoc_dependency + contrib/tools/protoc/bin + protoc +) +get_built_tool_path( + TOOL_cpp_styleguide_bin + TOOL_cpp_styleguide_dependency + contrib/tools/protoc/plugins/cpp_styleguide + cpp_styleguide +) + +add_library(protobuf-json-proto) +target_link_libraries(protobuf-json-proto PUBLIC + contrib-libs-linux-headers + contrib-libs-cxxsupp + yutil + contrib-libs-protobuf +) +target_proto_messages(protobuf-json-proto PRIVATE + ${CMAKE_SOURCE_DIR}/library/cpp/protobuf/json/proto/enum_options.proto +) +target_proto_addincls(protobuf-json-proto + ./ + ${CMAKE_SOURCE_DIR}/ + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src +) +target_proto_outs(protobuf-json-proto + --cpp_out=${CMAKE_BINARY_DIR}/ + --cpp_styleguide_out=${CMAKE_BINARY_DIR}/ +) diff --git a/library/cpp/protobuf/json/proto/CMakeLists.txt b/library/cpp/protobuf/json/proto/CMakeLists.txt new file mode 100644 index 0000000000..f8b31df0c1 --- /dev/null +++ b/library/cpp/protobuf/json/proto/CMakeLists.txt @@ -0,0 +1,17 @@ + +# This file was generated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + +if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND NOT HAVE_CUDA) + include(CMakeLists.linux-aarch64.txt) +elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + include(CMakeLists.darwin-x86_64.txt) +elseif (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" AND NOT HAVE_CUDA) + include(CMakeLists.windows-x86_64.txt) +elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND NOT HAVE_CUDA) + include(CMakeLists.linux-x86_64.txt) +endif() diff --git a/library/cpp/protobuf/json/proto/CMakeLists.windows-x86_64.txt b/library/cpp/protobuf/json/proto/CMakeLists.windows-x86_64.txt new file mode 100644 index 0000000000..6c6f4228c3 --- /dev/null +++ b/library/cpp/protobuf/json/proto/CMakeLists.windows-x86_64.txt @@ -0,0 +1,43 @@ + +# This file was generated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + +get_built_tool_path( + TOOL_protoc_bin + TOOL_protoc_dependency + contrib/tools/protoc/bin + protoc +) +get_built_tool_path( + TOOL_cpp_styleguide_bin + TOOL_cpp_styleguide_dependency + contrib/tools/protoc/plugins/cpp_styleguide + cpp_styleguide +) + +add_library(protobuf-json-proto) +target_link_libraries(protobuf-json-proto PUBLIC + contrib-libs-cxxsupp + yutil + contrib-libs-protobuf +) +target_proto_messages(protobuf-json-proto PRIVATE + ${CMAKE_SOURCE_DIR}/library/cpp/protobuf/json/proto/enum_options.proto +) +target_proto_addincls(protobuf-json-proto + ./ + ${CMAKE_SOURCE_DIR}/ + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/contrib/libs/protobuf/src +) +target_proto_outs(protobuf-json-proto + --cpp_out=${CMAKE_BINARY_DIR}/ + --cpp_styleguide_out=${CMAKE_BINARY_DIR}/ +) diff --git a/library/cpp/protobuf/json/proto/enum_options.proto b/library/cpp/protobuf/json/proto/enum_options.proto new file mode 100644 index 0000000000..0349187b36 --- /dev/null +++ b/library/cpp/protobuf/json/proto/enum_options.proto @@ -0,0 +1,23 @@ +syntax="proto3"; + +import "google/protobuf/descriptor.proto"; + +/** +Allows custom strings for Enum proto values when converting to/from json + +Example: + +Enum SomeEnum { + DefaultEnumValue = 0 [json_enum_value="custom_name_for_default_value"]; +} +message TProtoTest { + SomeEnum someField = 0 [json_name="some_field"]; +} + +will correspond {"some_field": "custom_name_for_default_value"} +when [Proto2JsonConfig|Json2ProtoConfig].UseJsonEnumValue = True + +*/ +extend google.protobuf.EnumValueOptions { + string json_enum_value = 4242279; +} diff --git a/library/cpp/protobuf/json/proto/ya.make b/library/cpp/protobuf/json/proto/ya.make new file mode 100644 index 0000000000..072afd2d43 --- /dev/null +++ b/library/cpp/protobuf/json/proto/ya.make @@ -0,0 +1,9 @@ +PROTO_LIBRARY() + +SRCS( + enum_options.proto +) + +EXCLUDE_TAGS(GO_PROTO) + +END() diff --git a/library/cpp/protobuf/json/proto2json_printer.cpp b/library/cpp/protobuf/json/proto2json_printer.cpp index 6663ac6e71..c7deb46207 100644 --- a/library/cpp/protobuf/json/proto2json_printer.cpp +++ b/library/cpp/protobuf/json/proto2json_printer.cpp @@ -4,6 +4,8 @@ #include <google/protobuf/util/time_util.h> +#include <library/cpp/protobuf/json/proto/enum_options.pb.h> + #include <util/generic/yexception.h> #include <util/string/ascii.h> #include <util/string/cast.h> @@ -145,6 +147,15 @@ namespace NProtobufJson { return; } + if (Config.UseJsonEnumValue) { + auto jsonEnumValue = value->options().GetExtension(json_enum_value); + if (!jsonEnumValue) { + ythrow yexception() << "Trying to using json enum value for field " << value->name() << " which is not set."; + } + WriteWithMaybeEmptyKey<InMapContext>(json, key, jsonEnumValue); + return; + } + switch (GetConfig().EnumMode) { case TProto2JsonConfig::EnumNumber: { WriteWithMaybeEmptyKey<InMapContext>(json, key, value->number()); diff --git a/library/cpp/protobuf/json/ut/json2proto_ut.cpp b/library/cpp/protobuf/json/ut/json2proto_ut.cpp index d695f95c76..7b3e829868 100644 --- a/library/cpp/protobuf/json/ut/json2proto_ut.cpp +++ b/library/cpp/protobuf/json/ut/json2proto_ut.cpp @@ -478,6 +478,19 @@ Y_UNIT_TEST(TestFieldNameMode) { UNIT_ASSERT_EQUAL(proto.Getdef_lower(), 4); } + // UseJsonName with UseJsonEnumValue + { + TString modelStr(R"_({"json_enum" : "enum_1"})_"); + + TCustomJsonEnumValue proto; + TJson2ProtoConfig config; + config.SetUseJsonName(true); + config.SetUseJsonEnumValue(true); + + UNIT_ASSERT_NO_EXCEPTION(proto = Json2Proto<TCustomJsonEnumValue>(modelStr, config)); + UNIT_ASSERT_EQUAL(proto.GetJsonEnum(), EJsonEnum::J_1); + } + // FieldNameMode with UseJsonName { TJson2ProtoConfig config; diff --git a/library/cpp/protobuf/json/ut/proto2json_ut.cpp b/library/cpp/protobuf/json/ut/proto2json_ut.cpp index b70329181d..f19558e60a 100644 --- a/library/cpp/protobuf/json/ut/proto2json_ut.cpp +++ b/library/cpp/protobuf/json/ut/proto2json_ut.cpp @@ -887,6 +887,22 @@ Y_UNIT_TEST(TestFieldNameMode) { UNIT_ASSERT_STRINGS_EQUAL(jsonStr.Str(), modelStr); } + // UseJsonName and UseJsonEnumValue + { + TString modelStr(R"_({"json_enum":"enum_1"})_"); + + TCustomJsonEnumValue proto; + proto.SetJsonEnum(EJsonEnum::J_1); + + TStringStream jsonStr; + TProto2JsonConfig config; + config.SetUseJsonName(true); + config.SetUseJsonEnumValue(true); + + UNIT_ASSERT_NO_EXCEPTION(Proto2Json(proto, jsonStr, config)); + UNIT_ASSERT_STRINGS_EQUAL(jsonStr.Str(), modelStr); + } + // FieldNameMode with UseJsonName { TProto2JsonConfig config; diff --git a/library/cpp/protobuf/json/ut/test.proto b/library/cpp/protobuf/json/ut/test.proto index 8cd3db813a..1f8487521b 100644 --- a/library/cpp/protobuf/json/ut/test.proto +++ b/library/cpp/protobuf/json/ut/test.proto @@ -3,6 +3,8 @@ package NProtobufJsonTest; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; +import "library/cpp/protobuf/json/proto/enum_options.proto"; + enum EEnum { E_0 = 0; E_1 = 1; @@ -10,6 +12,11 @@ enum EEnum { E_3 = 3; }; +enum EJsonEnum { + J_0 = 0 [(json_enum_value)="enum_0"]; + J_1 = 1 [(json_enum_value)="enum_1"]; +} + message TFlatOptional { optional int32 I32 = 1; optional int64 I64 = 2; @@ -216,6 +223,10 @@ message TExtensionField { extensions 100 to 199; } +message TCustomJsonEnumValue { + optional EJsonEnum JsonEnum = 1 [json_name="json_enum"]; +} + extend TExtensionField { optional int32 bar = 123; } diff --git a/library/cpp/protobuf/json/ut/ya.make b/library/cpp/protobuf/json/ut/ya.make index 2a5391e375..0b2c954952 100644 --- a/library/cpp/protobuf/json/ut/ya.make +++ b/library/cpp/protobuf/json/ut/ya.make @@ -17,6 +17,7 @@ GENERATE_ENUM_SERIALIZATION(test.pb.h) PEERDIR( library/cpp/protobuf/interop library/cpp/protobuf/json + library/cpp/protobuf/json/proto ) END() diff --git a/library/cpp/protobuf/json/ya.make b/library/cpp/protobuf/json/ya.make index 7dbd055a3a..9309e341ef 100644 --- a/library/cpp/protobuf/json/ya.make +++ b/library/cpp/protobuf/json/ya.make @@ -17,6 +17,7 @@ PEERDIR( contrib/libs/protobuf library/cpp/json library/cpp/protobuf/util + library/cpp/protobuf/json/proto library/cpp/string_utils/relaxed_escaper ) |