Thanks, Robert! I'll post it on their forum and see if they suggest 
something.

Thanks,
Vikas

On Monday, August 8, 2022 at 3:47:02 PM UTC-7 [email protected] wrote:

> Vikas,
>
> If you are using Confluent Schema Registry, there is a way to do this by 
> using the Confluent libraries, namely `ProtobufSchema.toDescriptor()`.  But 
> it's best that you ask this question in the Confluent Community slack forum 
> or at https://forum.confluent.io/.  
>
> Robert
>
> On Monday, 8 August 2022 at 10:51:39 UTC-7 [email protected] wrote:
>
>> Ah, got it, Matt. That's what I was suspecting but wanted to avoid and 
>> see if there is any way around it. Thanks for patiently understanding and 
>> responding to my queries!
>>
>> Thanks,
>> Vikas
>>
>> On Monday, August 8, 2022 at 10:35:55 AM UTC-7 [email protected] wrote:
>>
>>> Vikas~
>>>
>>> You are asking how to dynamically compile a .proto message into a 
>>> descriptor that you can load at runtime.  I don't have a good answer here 
>>> short of launching `protoc` as a subprocess.
>>>
>>> Matt
>>>
>>> On Mon, Aug 8, 2022 at 1:29 PM Vikas Dahiya <[email protected]> wrote:
>>>
>>>> Thanks, Matt!
>>>>
>>>> The schema I have is in string format. Here is the snippet of the same
>>>>
>>>> syntax = "proto3";
>>>> package com.company.qna.enriched;
>>>>
>>>> import "imports/user/token_status.proto";
>>>> import "validate/validate.proto";
>>>> import "google/protobuf/timestamp.proto";
>>>>
>>>> message QuestionViewEnriched {
>>>>   string event_id = 1 [(validate.rules).string.uuid = true];
>>>>   string source = 2 [(validate.rules).string.min_len = 3];
>>>>   string event_type = 3 [(validate.rules).string.prefix = "com.chegg"];
>>>>   .google.protobuf.Timestamp event_time = 4;
>>>>   string chegg_user_uuid = 21 [(validate.rules).string.uuid = true];
>>>>   string chegg_visitor_id = 22 [(validate.rules).string.uuid = true];
>>>>   string chegg_session_id = 23;
>>>>   string client_ip_address = 24 [(validate.rules).string.ip = true];
>>>>   string user_agent = 25 [(validate.rules).string.well_known_regex = 
>>>> HTTP_HEADER_VALUE];
>>>>   string language = 26 [(validate.rules).string.well_known_regex = 
>>>> HTTP_HEADER_VALUE];
>>>>   string experiments = 27;
>>>>   bool is_internal_user = 28;
>>>>   string device_class = 29;
>>>>   com.company.user.TokenStatus access_token_status = 30;
>>>>   com.company.user.TokenStatus id_token_status = 31;
>>>>   string url = 41;
>>>>   string referral_url = 42;
>>>> }
>>>>
>>>> On Saturday, August 6, 2022 at 1:20:20 PM UTC-7 [email protected] wrote:
>>>>
>>>>> Vikas~
>>>>>
>>>>> I suspect your best bet is:
>>>>>
>>>>> ```
>>>>> Schema<?> s = ....
>>>>> Object o = s.newInstance();
>>>>> if (o instanceof MessageOrBuilder) {
>>>>>     return ((MessageOrBuilder)o).getDescriptorForType();
>>>>> }
>>>>> return nullptr;
>>>>> ```
>>>>>
>>>>> If you are using the JavaLite runtime, you may not have descriptor 
>>>>> information available, so this can produce nullptr.
>>>>>
>>>>> Matt
>>>>>
>>>>> On Sat, Aug 6, 2022 at 4:13 PM Vikas Dahiya <[email protected]> 
>>>>> wrote:
>>>>>
>>>>>> Matt,
>>>>>>
>>>>>> Kafka APIs really don't have to do anything here. Think of it as a 
>>>>>> problem: I got a schema from any random place (in this case it's a 
>>>>>> schema 
>>>>>> registry), and now I need to use this schema to create an Object to use 
>>>>>> in 
>>>>>> my system. I don't have generated java classes at my disposal. So I am 
>>>>>> looking to get the descriptor to create an Object out of this schema. 
>>>>>> Hope 
>>>>>> that helps to understand the problem. 
>>>>>>
>>>>>> Thanks,
>>>>>> Vikas
>>>>>> On Saturday, August 6, 2022 at 1:05:00 PM UTC-7 [email protected] 
>>>>>> wrote:
>>>>>>
>>>>>>> Vikas~
>>>>>>>
>>>>>>> I don't really know the Kafka APIs, but it might be better to ask on 
>>>>>>> one of their lists or maybe stack overflow.
>>>>>>>
>>>>>>> Matt
>>>>>>>
>>>>>>> On Sat, Aug 6, 2022 at 3:57 PM Vikas Dahiya <[email protected]> 
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Matt, I am using kafka, I don’t have a code snippet as I am just 
>>>>>>>> getting the schema from confulant schema registry and need a 
>>>>>>>> descriptor to 
>>>>>>>> create the object. I can share the schema snippet if that can help.
>>>>>>>>
>>>>>>>> Vikas
>>>>>>>>
>>>>>>>> On Sat, Aug 6, 2022 at 12:30 PM Matthew Fowles Kulukundis <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> Vikas~
>>>>>>>>>
>>>>>>>>> Do you have links to your code or snippets you can share?  Are you 
>>>>>>>>> using kafka or AWS schema registry or something?
>>>>>>>>>
>>>>>>>>> Matt
>>>>>>>>>
>>>>>>>>> On Sat, Aug 6, 2022 at 3:23 PM Vikas Dahiya <[email protected]> 
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Matt, I am using Java.
>>>>>>>>>>
>>>>>>>>>> Thanks!
>>>>>>>>>> Vikas
>>>>>>>>>>
>>>>>>>>>> On Saturday, August 6, 2022 at 11:57:25 AM UTC-7 [email protected] 
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> Vikas~
>>>>>>>>>>>
>>>>>>>>>>> What language are you using (C++, Java, Python, etc)?
>>>>>>>>>>>
>>>>>>>>>>> Matt
>>>>>>>>>>>
>>>>>>>>>>> On Fri, Aug 5, 2022 at 5:14 PM Vikas Dahiya <[email protected]> 
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> I have an in memory proto schema which I am reading from the 
>>>>>>>>>>>> schema registry. I am looking for a way or the best way if there 
>>>>>>>>>>>> are more 
>>>>>>>>>>>> than one, to get the descriptor for this schema. How can I do 
>>>>>>>>>>>> that? I am 
>>>>>>>>>>>> new to protobuf and pardon me if the provided information is not 
>>>>>>>>>>>> sufficient, but I can provide any required additional details.
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks
>>>>>>>>>>>>
>>>>>>>>>>>> -- 
>>>>>>>>>>>> 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 [email protected].
>>>>>>>>>>>> To view this discussion on the web visit 
>>>>>>>>>>>> https://groups.google.com/d/msgid/protobuf/3b2a5728-549b-4c19-a1b2-4811b0124f8cn%40googlegroups.com
>>>>>>>>>>>>  
>>>>>>>>>>>> <https://groups.google.com/d/msgid/protobuf/3b2a5728-549b-4c19-a1b2-4811b0124f8cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>>>>>> .
>>>>>>>>>>>>
>>>>>>>>>>> -- 
>>>>>>>>>> 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 [email protected].
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> To view this discussion on the web visit 
>>>>>>>>>> https://groups.google.com/d/msgid/protobuf/b87d55ad-1bfe-4378-9355-e43a55f47003n%40googlegroups.com
>>>>>>>>>>  
>>>>>>>>>> <https://groups.google.com/d/msgid/protobuf/b87d55ad-1bfe-4378-9355-e43a55f47003n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>>>> .
>>>>>>>>>>
>>>>>>>>> -- 
>>>>>> 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 [email protected].
>>>>>>
>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/protobuf/1f6e5388-75ed-4a06-944e-0efce86dfc03n%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/protobuf/1f6e5388-75ed-4a06-944e-0efce86dfc03n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> -- 
>>>> 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 [email protected].
>>>>
>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/protobuf/43835e46-f786-4756-836a-ece5db30652dn%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/protobuf/43835e46-f786-4756-836a-ece5db30652dn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/c6bf4e27-b32c-463b-a965-225c4ceb5abcn%40googlegroups.com.

Reply via email to