@@ -52,6 +52,10 @@ const (
5252 (confluent.field_meta).tags = "PII"
5353 ];
5454 repeated string works = 4;
55+ oneof pii_oneof {
56+ Pizza oneof_message = 5;
57+ string oneof_string = 6 [(.confluent.field_meta).tags = "PII"];
58+ }
5559 }
5660
5761 message Pizza {
@@ -109,9 +113,10 @@ func TestProtobufSerdeWithSimple(t *testing.T) {
109113 serde .MaybeFail ("Serializer configuration" , err )
110114
111115 obj := test.Author {
112- Name : "Kafka" ,
113- Id : 123 ,
114- Works : []string {"The Castle" , "The Trial" },
116+ Name : "Kafka" ,
117+ Id : 123 ,
118+ Works : []string {"The Castle" , "The Trial" },
119+ PiiOneof : & test.Author_OneofString {OneofString : "oneof" },
115120 }
116121 bytes , err := ser .Serialize ("topic1" , & obj )
117122 serde .MaybeFail ("serialization" , err )
@@ -128,9 +133,10 @@ func TestProtobufSerdeWithSimple(t *testing.T) {
128133
129134 // serialize second object
130135 obj = test.Author {
131- Name : "Kierkegaard" ,
132- Id : 123 ,
133- Works : []string {"Fear And Trembling" },
136+ Name : "Kierkegaard" ,
137+ Id : 123 ,
138+ Works : []string {"Fear And Trembling" },
139+ PiiOneof : & test.Author_OneofString {OneofString : "oneof" },
134140 }
135141 bytes , err = ser .Serialize ("topic1" , & obj )
136142 serde .MaybeFail ("serialization" , err )
@@ -331,10 +337,11 @@ func TestProtobufSerdeWithCELCondition(t *testing.T) {
331337 }
332338
333339 obj := test.Author {
334- Name : "Kafka" ,
335- Id : 123 ,
336- Picture : []byte {1 , 2 },
337- Works : []string {"The Castle" , "The Trial" },
340+ Name : "Kafka" ,
341+ Id : 123 ,
342+ Picture : []byte {1 , 2 },
343+ Works : []string {"The Castle" , "The Trial" },
344+ PiiOneof : & test.Author_OneofString {OneofString : "oneof" },
338345 }
339346
340347 bytes , err := ser .Serialize ("topic1" , & obj )
@@ -391,10 +398,11 @@ func TestProtobufSerdeWithCELConditionFail(t *testing.T) {
391398 }
392399
393400 obj := test.Author {
394- Name : "Kafka" ,
395- Id : 123 ,
396- Picture : []byte {1 , 2 },
397- Works : []string {"The Castle" , "The Trial" },
401+ Name : "Kafka" ,
402+ Id : 123 ,
403+ Picture : []byte {1 , 2 },
404+ Works : []string {"The Castle" , "The Trial" },
405+ PiiOneof : & test.Author_OneofString {OneofString : "oneof" },
398406 }
399407
400408 _ , err = ser .Serialize ("topic1" , & obj )
@@ -423,7 +431,7 @@ func TestProtobufSerdeWithCELFieldTransform(t *testing.T) {
423431 Kind : "TRANSFORM" ,
424432 Mode : "WRITE" ,
425433 Type : "CEL_FIELD" ,
426- Expr : "name == 'name ' ; value + '-suffix'" ,
434+ Expr : "typeName == 'STRING ' ; value + '-suffix'" ,
427435 }
428436 ruleSet := schemaregistry.RuleSet {
429437 DomainRules : []schemaregistry.Rule {encRule },
@@ -442,10 +450,11 @@ func TestProtobufSerdeWithCELFieldTransform(t *testing.T) {
442450 }
443451
444452 obj := test.Author {
445- Name : "Kafka" ,
446- Id : 123 ,
447- Picture : []byte {1 , 2 },
448- Works : []string {"The Castle" , "The Trial" },
453+ Name : "Kafka" ,
454+ Id : 123 ,
455+ Picture : []byte {1 , 2 },
456+ Works : []string {"The Castle" , "The Trial" },
457+ PiiOneof : & test.Author_OneofString {OneofString : "oneof" },
449458 }
450459
451460 bytes , err := ser .Serialize ("topic1" , & obj )
@@ -460,10 +469,11 @@ func TestProtobufSerdeWithCELFieldTransform(t *testing.T) {
460469 serde .MaybeFail ("register message" , err )
461470
462471 obj2 := test.Author {
463- Name : "Kafka-suffix" ,
464- Id : 123 ,
465- Picture : []byte {1 , 2 },
466- Works : []string {"The Castle" , "The Trial" },
472+ Name : "Kafka-suffix" ,
473+ Id : 123 ,
474+ Picture : []byte {1 , 2 },
475+ Works : []string {"The Castle-suffix" , "The Trial-suffix" },
476+ PiiOneof : & test.Author_OneofString {OneofString : "oneof-suffix" },
467477 }
468478
469479 newobj , err := deser .Deserialize ("topic1" , bytes )
@@ -509,10 +519,11 @@ func TestProtobufSerdeWithCELFieldCondition(t *testing.T) {
509519 }
510520
511521 obj := test.Author {
512- Name : "Kafka" ,
513- Id : 123 ,
514- Picture : []byte {1 , 2 },
515- Works : []string {"The Castle" , "The Trial" },
522+ Name : "Kafka" ,
523+ Id : 123 ,
524+ Picture : []byte {1 , 2 },
525+ Works : []string {"The Castle" , "The Trial" },
526+ PiiOneof : & test.Author_OneofString {OneofString : "oneof" },
516527 }
517528
518529 bytes , err := ser .Serialize ("topic1" , & obj )
@@ -569,10 +580,11 @@ func TestProtobufSerdeWithCELFieldConditionFail(t *testing.T) {
569580 }
570581
571582 obj := test.Author {
572- Name : "Kafka" ,
573- Id : 123 ,
574- Picture : []byte {1 , 2 },
575- Works : []string {"The Castle" , "The Trial" },
583+ Name : "Kafka" ,
584+ Id : 123 ,
585+ Picture : []byte {1 , 2 },
586+ Works : []string {"The Castle" , "The Trial" },
587+ PiiOneof : & test.Author_OneofString {OneofString : "oneof" },
576588 }
577589
578590 _ , err = ser .Serialize ("topic1" , & obj )
@@ -629,10 +641,11 @@ func TestProtobufSerdeEncryption(t *testing.T) {
629641 }
630642
631643 obj := test.Author {
632- Name : "Kafka" ,
633- Id : 123 ,
634- Picture : []byte {1 , 2 },
635- Works : []string {"The Castle" , "The Trial" },
644+ Name : "Kafka" ,
645+ Id : 123 ,
646+ Picture : []byte {1 , 2 },
647+ Works : []string {"The Castle" , "The Trial" },
648+ PiiOneof : & test.Author_OneofString {OneofString : "oneof" },
636649 }
637650
638651 bytes , err := ser .Serialize ("topic1" , & obj )
0 commit comments