5#include <yt/yt_proto/yt/formats/extension.pb.h>
7#include <util/generic/maybe.h>
9#include <google/protobuf/message.h>
12namespace NYT::NDetail {
16enum class EProtobufType
24enum class EProtobufSerializationMode
31enum class EProtobufListMode
37enum class EProtobufMapMode
45enum class EProtobufFieldSortOrder
51enum class EProtobufOneofMode
57enum class EProtobufEnumWritingMode
63struct TProtobufOneofOptions
65 EProtobufOneofMode Mode = EProtobufOneofMode::Variant;
66 TString VariantFieldName;
69struct TProtobufFieldOptions
71 TMaybe<EProtobufType> Type;
72 EProtobufSerializationMode SerializationMode = EProtobufSerializationMode::Protobuf;
73 EProtobufListMode ListMode = EProtobufListMode::Required;
74 EProtobufMapMode MapMode = EProtobufMapMode::ListOfStructsLegacy;
77struct TProtobufMessageOptions
79 EProtobufFieldSortOrder FieldSortOrder = EProtobufFieldSortOrder::ByFieldNumber;
82TString GetColumnName(const ::google::protobuf::FieldDescriptor& field);
84TProtobufFieldOptions GetFieldOptions(
85 const ::google::protobuf::FieldDescriptor* fieldDescriptor,
86 const TMaybe<TProtobufFieldOptions>& defaultFieldOptions = {});
88TProtobufOneofOptions GetOneofOptions(
89 const ::google::protobuf::OneofDescriptor* oneofDescriptor,
90 const TMaybe<TProtobufOneofOptions>& defaultOneofOptions = {});
92TProtobufMessageOptions GetMessageOptions(const ::google::protobuf::Descriptor* descriptor);
94TMaybe<TVector<TString>> InferColumnFilter(const ::google::protobuf::Descriptor& descriptor);
96TNode MakeProtoFormatConfigWithTables(
const TVector<const ::google::protobuf::Descriptor*>& descriptors);
97TNode MakeProtoFormatConfigWithDescriptors(
const TVector<const ::google::protobuf::Descriptor*>& descriptors);
99TTableSchema CreateTableSchemaImpl(
100 const ::google::protobuf::Descriptor& messageDescriptor,
101 bool keepFieldsWithoutExtension);