Open
Description
I am trying out the custom option feature but I am not able to get it work. I am running 7.5.0 schema registry as well as client library version.
Here is my test schema:
syntax = "proto2";
package com.customtest;
option java_package = "com.customtest";
option java_outer_classname = "TestProto";
import "google/protobuf/descriptor.proto";
message CustomMessage1 {
optional string test_string = 1 [ (field_custom1) = 123];
}
extend google.protobuf.FieldOptions {
optional int32 field_custom1 = 1111;
}
Here is my test code:
// Fetch the schema object of type ParsedSchema from some existing client code using the client library.
ProtobufSchema protobufSchema = (ProtobufSchema) schema;
Descriptors.Descriptor descriptor = protobufSchema.toDescriptor();
for (Descriptors.FieldDescriptor field : descriptor.getFields()) {
logger.atInfo().log("options: " + field.getOptions());
}
// No options showup in the result
Here is my debugging process and some result for troubleshooting:
- I debug into the problem and it seems the
field_custom1
option appear in the ProtobufSchema.schemaObj - however, after calling toDescriptor, the field option can not be retained.
- On a further inspection, At this line the options showup but the field option can not be retained because the field option is evaluated for certain types including
ctype
,jstype
,deprecated
, etc. They are allnull
in my case and it can not be invoked to merge the options (reference code)
I am not sure if I miss something in this logic, the example I use is part of the test in this original PR. Do I need some special config to make this work?
Metadata
Assignees
Labels
No labels
Activity