@@ -46,11 +46,11 @@ public void ParseSchema()
4646
4747 message ReferrerMessage {
4848
49- string root_id = 1 [(. confluent.field_meta) = { annotation : ""PII"" }];
50- ReferencedMessage ref = 2 [(. confluent.field_meta).annotation = ""PII""];
49+ string root_id = 1 [(confluent.field_meta) = { doc : ""PII"" }];
50+ ReferencedMessage ref = 2 [(confluent.field_meta).doc = ""PII""];
5151
5252 }" ;
53-
53+
5454 string import = @"syntax = ""proto3"";
5555 package io.confluent.kafka.serializers.protobuf.test;
5656
@@ -62,15 +62,20 @@ message ReferencedMessage {
6262
6363 IDictionary < string , string > imports = new Dictionary < string , string > ( ) ;
6464 imports [ "ref.proto" ] = import ;
65+ imports [ "confluent/meta.proto" ] = "doesn't matter, will be overwritten anyway" ;
6566
6667 var fds = ProtobufUtils . Parse ( schema , imports ) ;
67- foreach ( var file in fds . Files )
68- {
69- foreach ( var messageType in file . MessageTypes )
70- {
71- Assert . Equal ( "ReferrerMessage" , messageType . Name ) ;
72- }
73- }
68+ Assert . Equal ( 4 , fds . Files . Count ) ;
69+
70+ var fileNames = fds . Files . Select ( s => s . Name ) . ToHashSet ( ) ;
71+ Assert . Contains ( "__root.proto" , fileNames ) ;
72+ Assert . Contains ( "ref.proto" , fileNames ) ;
73+ Assert . Contains ( "confluent/meta.proto" , fileNames ) ;
74+ Assert . Contains ( "google/protobuf/descriptor.proto" , fileNames ) ;
75+
76+ var rootFile = fds . Files . First ( s => s . Name == "__root.proto" ) ;
77+ Assert . Equal ( 1 , rootFile . MessageTypes . Count ) ;
78+ Assert . Equal ( "ReferrerMessage" , rootFile . MessageTypes . First ( ) . Name ) ;
7479 }
7580
7681 [ Fact ]
@@ -112,12 +117,12 @@ message Person {
112117 schema . RuleSet = new RuleSet ( new List < Rule > ( ) ,
113118 new List < Rule >
114119 {
115- new Rule ( "testCEL" , RuleKind . Condition , RuleMode . Write , "CEL" , null , null ,
120+ new Rule ( "testCEL" , RuleKind . Condition , RuleMode . Write , "CEL" , null , null ,
116121 "message.name == 'awesome'" , null , null , false )
117122 }
118123 ) ;
119124 store [ schemaStr ] = 1 ;
120- subjectStore [ "topic-value" ] = new List < RegisteredSchema > { schema } ;
125+ subjectStore [ "topic-value" ] = new List < RegisteredSchema > { schema } ;
121126 var config = new ProtobufSerializerConfig
122127 {
123128 AutoRegisterSchemas = false ,
@@ -159,12 +164,12 @@ message Person {
159164 schema . RuleSet = new RuleSet ( new List < Rule > ( ) ,
160165 new List < Rule >
161166 {
162- new Rule ( "testCEL" , RuleKind . Condition , RuleMode . Write , "CEL" , null , null ,
167+ new Rule ( "testCEL" , RuleKind . Condition , RuleMode . Write , "CEL" , null , null ,
163168 "message.name != 'awesome'" , null , null , false )
164169 }
165170 ) ;
166171 store [ schemaStr ] = 1 ;
167- subjectStore [ "topic-value" ] = new List < RegisteredSchema > { schema } ;
172+ subjectStore [ "topic-value" ] = new List < RegisteredSchema > { schema } ;
168173 var config = new ProtobufSerializerConfig
169174 {
170175 AutoRegisterSchemas = false ,
@@ -200,12 +205,12 @@ message Person {
200205 schema . RuleSet = new RuleSet ( new List < Rule > ( ) ,
201206 new List < Rule >
202207 {
203- new Rule ( "testCEL" , RuleKind . Transform , RuleMode . Write , "CEL_FIELD" , null , null ,
208+ new Rule ( "testCEL" , RuleKind . Transform , RuleMode . Write , "CEL_FIELD" , null , null ,
204209 "typeName == 'STRING' ; value + '-suffix'" , null , null , false )
205210 }
206211 ) ;
207212 store [ schemaStr ] = 1 ;
208- subjectStore [ "topic-value" ] = new List < RegisteredSchema > { schema } ;
213+ subjectStore [ "topic-value" ] = new List < RegisteredSchema > { schema } ;
209214 var config = new ProtobufSerializerConfig
210215 {
211216 AutoRegisterSchemas = false ,
@@ -247,12 +252,12 @@ message Person {
247252 schema . RuleSet = new RuleSet ( new List < Rule > ( ) ,
248253 new List < Rule >
249254 {
250- new Rule ( "testCEL" , RuleKind . Condition , RuleMode . Write , "CEL_FIELD" , null , null ,
255+ new Rule ( "testCEL" , RuleKind . Condition , RuleMode . Write , "CEL_FIELD" , null , null ,
251256 "name == 'name' ; value == 'awesome'" , null , null , false )
252257 }
253258 ) ;
254259 store [ schemaStr ] = 1 ;
255- subjectStore [ "topic-value" ] = new List < RegisteredSchema > { schema } ;
260+ subjectStore [ "topic-value" ] = new List < RegisteredSchema > { schema } ;
256261 var config = new ProtobufSerializerConfig
257262 {
258263 AutoRegisterSchemas = false ,
@@ -294,12 +299,12 @@ message Person {
294299 schema . RuleSet = new RuleSet ( new List < Rule > ( ) ,
295300 new List < Rule >
296301 {
297- new Rule ( "testCEL" , RuleKind . Condition , RuleMode . Write , "CEL_FIELD" , null , null ,
302+ new Rule ( "testCEL" , RuleKind . Condition , RuleMode . Write , "CEL_FIELD" , null , null ,
298303 "name == 'name' ; value != 'awesome'" , null , null , false )
299304 }
300305 ) ;
301306 store [ schemaStr ] = 1 ;
302- subjectStore [ "topic-value" ] = new List < RegisteredSchema > { schema } ;
307+ subjectStore [ "topic-value" ] = new List < RegisteredSchema > { schema } ;
303308 var config = new ProtobufSerializerConfig
304309 {
305310 AutoRegisterSchemas = false ,
@@ -332,7 +337,7 @@ message PersonWithPic {
332337 string name = 3 [(.confluent.field_meta) = { tags: ""PII"" }];
333338 bytes picture = 4 [(.confluent.field_meta) = { tags: ""PII"" }];
334339 }" ;
335-
340+
336341 var schema = new RegisteredSchema ( "topic-value" , 1 , 1 , schemaStr , SchemaType . Protobuf , null ) ;
337342 schema . Metadata = new Metadata ( new Dictionary < string , ISet < string > >
338343 {
@@ -356,7 +361,7 @@ message PersonWithPic {
356361 }
357362 ) ;
358363 store [ schemaStr ] = 1 ;
359- subjectStore [ "topic-value" ] = new List < RegisteredSchema > { schema } ;
364+ subjectStore [ "topic-value" ] = new List < RegisteredSchema > { schema } ;
360365 var config = new ProtobufSerializerConfig
361366 {
362367 AutoRegisterSchemas = false ,
0 commit comments