Extra dot in descriptor data (protoc java)

39 views
Skip to first unread message

Venkat Duddu

unread,
Dec 22, 2021, 2:00:04 PM12/22/21
to Protocol Buffers
We are seeing extra dot for external referenced variables in descriptorData in the generated java class for a given Message.

Message Definition
syntax = "proto3";
package com.chegg;

import "google/protobuf/struct.proto";

message OneGraphRequest {
string operation_name = 1;
google.protobuf.Struct variables = 2;
string query = 3;
}

DescriptorData (java.lang.String[] descriptorData) from the generated Class for variables looks like this:
".google.protobuf.Struct"

It is starting with extra dot (before google), how can we suppress (remove the extra dot at the begining) it?

Marc Gravell

unread,
Dec 22, 2021, 2:18:12 PM12/22/21
to Venkat Duddu, Protocol Buffers
IIRC, the leading dot means that the name is absolute rather than relative. I'm not sure it represents an error.

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/338c0e38-6c7a-435d-945b-f2e23f8a6979n%40googlegroups.com.

Venkat Duddu

unread,
Dec 22, 2021, 2:22:38 PM12/22/21
to Protocol Buffers
Thank you Marc.

When I have leading dot, we are facing issues with schema confluent schema registry integration. 

1. We register schema without leading dot.
2. Confluent Schema registry uses the descriptor data to look up schema def for a given protobuf message since descriptorData has extra dot, it is throwing schema not found exception.

Workaround for now looks like: add leading dot in the schema definition as well so that schema def and descriptor data both will have the dot. Not sure whether this is the right solution or not, but seems to be working for now.

Deanna Garcia

unread,
Jan 25, 2022, 12:52:43 PMJan 25
to Protocol Buffers
The leading dot is purposeful, and as pointed out is because the name is absolute rather than relative. Your workaround is fine, or you could use substring to get rid of the dot in the type if you would like.

Venkat Duddu

unread,
Jan 25, 2022, 1:07:14 PMJan 25
to Protocol Buffers
Thank you for clarifying !!
Reply all
Reply to author
Forward
0 new messages