You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to protobuf-net RuntimeTypeModel class, the complex datatype such as Dictionary<string,string[]> are not getting converted to corresponding proto schema
#351
Open
atulDc opened this issue
Nov 25, 2024
· 0 comments
The protobuf-net RuntimeTypeModel class has a function TryGetRepeatedProvider which checks if a C# data type is a proto's "repeated" type and its c# System.Reflection.MemeberInfo type is present (e.g. string[] or List or Dictionary<T,K>) then do not create its proto schema.
Below Example:
c# Dictionary<string,string[]> is not getting converted to proto schema :
// below Array_String message is not getting generated.
message Array_String {
repeated string item = 1;
}
// KeyValuePair_String_Array_String message is getting generated
message KeyValuePair_String_Array_String {
string Key = 1;
Array_String Value = 2; // getting generated too
}
the message Array_String is not getting generated because c# string[] System.Reflection.Memberinfo type is available to RuntimeTypeModel class of protobuf-net library.
When c# System.Reflection.Memberinfo type is available why its message is not generated in proto?
If those are not generated then the above-mentioned complex types are not working, what could be a workaround?
If we try to bypass the below mentioned check in RuntimeTypeModel class's GetSchema function what could go wrong ?
Bypassing this instruction :
TryGetRepeatedProvider(tmp.Type) is not null) continue;
The bottom line is:
Dictionary<string,string[]> or Dictionary<string,Dictionary<string,string>> these c# types should be parsed and their proto schema should be generated.
The text was updated successfully, but these errors were encountered:
atulDc
changed the title
Due to protobuf-net RuntimeTypeModel class, the complex datatype such as Dictionary<string,string[]> are not getting converted to proto schema
Due to protobuf-net RuntimeTypeModel class, the complex datatype such as Dictionary<string,string[]> are not getting converted to corresponding proto schema
Nov 25, 2024
The protobuf-net RuntimeTypeModel class has a function TryGetRepeatedProvider which checks if a C# data type is a proto's "repeated" type and its c# System.Reflection.MemeberInfo type is present (e.g. string[] or List or Dictionary<T,K>) then do not create its proto schema.
Below Example:
c# Dictionary<string,string[]> is not getting converted to proto schema :
// below Array_String message is not getting generated.
message Array_String {
repeated string item = 1;
}
// KeyValuePair_String_Array_String message is getting generated
message KeyValuePair_String_Array_String {
string Key = 1;
Array_String Value = 2; // getting generated too
}
the message Array_String is not getting generated because c# string[] System.Reflection.Memberinfo type is available to RuntimeTypeModel class of protobuf-net library.
When c# System.Reflection.Memberinfo type is available why its message is not generated in proto?
If those are not generated then the above-mentioned complex types are not working, what could be a workaround?
If we try to bypass the below mentioned check in RuntimeTypeModel class's GetSchema function what could go wrong ?
Bypassing this instruction :
TryGetRepeatedProvider(tmp.Type) is not null) continue;
The bottom line is:
Dictionary<string,string[]> or Dictionary<string,Dictionary<string,string>> these c# types should be parsed and their proto schema should be generated.
The text was updated successfully, but these errors were encountered: