anerjan / protobuf-net

Automatically exported from code.google.com/p/protobuf-net
Other
0 stars 0 forks source link

GetProto does not write the correct .proto messages for classes containing dictionary members #306

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Please include an e-mail address if this might need a dialogue!
==============

What steps will reproduce the problem?
1. Create a class (T) with a dictionary property
2. Add this class to the runtimetypemodel
3. Call GetProto(typeof(T))

What is the expected output? What do you see instead?
The hand coded .proto I had previously been using to receive a .NET object 
containing a dictionary in python is as follows:

message Session {
  required string id = 1;
  message customProperties_KeyValuePair {
    required string key = 1;
    required string value = 2;
  }
  repeated customProperties_KeyValuePair customProperties = 7;
  }

What GetProto generates is as follows:

message KeyValuePair`2 {
}
message Session {
   optional string Id = 1;
   repeated KeyValuePair`2 CustomProperties = 7;
}

What version of the product are you using? On what operating system?
I am using the revision 556 from trunk 

Please provide any additional information below.
I was working on a patch, but it turned out to be more complicated than I 
thought to get the GetSchemaTypeName() of the dictionary's generic parameters, 
make sure they are added to the required types etc. :( If I get it done I will 
attach it later

Original issue reported on code.google.com by Franches...@gmail.com on 27 Jul 2012 at 1:08

GoogleCodeExporter commented 9 years ago
Fixed r557

Original comment by marc.gravell on 27 Jul 2012 at 2:06

GoogleCodeExporter commented 9 years ago
Awesome, works great! Thanks!!!

Original comment by Franches...@gmail.com on 27 Jul 2012 at 2:14