#pragma once #include "common.h" #include #include #include /// @cond Doxygen_Suppress namespace NYT::NDetail { //////////////////////////////////////////////////////////////////////////////// enum class EProtobufType { EnumInt /* "enum_int" */, EnumString /* "enum_string" */, Any /* "any" */, OtherColumns /* "other_columns" */, }; enum class EProtobufSerializationMode { Protobuf, Yt, Embedded, }; enum class EProtobufListMode { Optional, Required, }; enum class EProtobufMapMode { ListOfStructsLegacy, ListOfStructs, Dict, OptionalDict, }; enum class EProtobufFieldSortOrder { AsInProtoFile, ByFieldNumber, }; enum class EProtobufOneofMode { SeparateFields, Variant, }; enum class EProtobufEnumWritingMode { SkipUnknownValues, CheckValues, }; struct TProtobufOneofOptions { EProtobufOneofMode Mode = EProtobufOneofMode::Variant; TString VariantFieldName; }; struct TProtobufFieldOptions { TMaybe Type; EProtobufSerializationMode SerializationMode = EProtobufSerializationMode::Protobuf; EProtobufListMode ListMode = EProtobufListMode::Required; EProtobufMapMode MapMode = EProtobufMapMode::ListOfStructsLegacy; }; struct TProtobufMessageOptions { EProtobufFieldSortOrder FieldSortOrder = EProtobufFieldSortOrder::ByFieldNumber; }; TString GetColumnName(const ::google::protobuf::FieldDescriptor& field); TProtobufFieldOptions GetFieldOptions( const ::google::protobuf::FieldDescriptor* fieldDescriptor, const TMaybe& defaultFieldOptions = {}); TProtobufOneofOptions GetOneofOptions( const ::google::protobuf::OneofDescriptor* oneofDescriptor, const TMaybe& defaultOneofOptions = {}); TProtobufMessageOptions GetMessageOptions(const ::google::protobuf::Descriptor* descriptor); TMaybe> InferColumnFilter(const ::google::protobuf::Descriptor& descriptor); TNode MakeProtoFormatConfigWithTables(const TVector& descriptors); TNode MakeProtoFormatConfigWithDescriptors(const TVector& descriptors); TTableSchema CreateTableSchemaImpl( const ::google::protobuf::Descriptor& messageDescriptor, bool keepFieldsWithoutExtension); //////////////////////////////////////////////////////////////////////////////// } // namespace NYT::NDetail /// @endcond