This is what I have in mind.
This is not supported, I'm investigating whether I can enchance the syntax
of protobuf compiler to achieve this.
syntax ="proto2";
message Sample {
}
message Example {
//
message SubgMsg {
//
service Service {
rpc someMethod(Sample) returns Sample;
}
}
message AnotherSubMsg {
//
service Service {
rpc someMethod(Sample) returns Sample;
}
}
}
I can refer to them as 'Example.SubgMsg.someMethod' and
'Example.AnotherSubMsg.someMethod'.
On Wednesday, February 6, 2019 at 7:27:05 PM UTC+3, Derek Perez wrote:
>
> That's not how it's intended to be used, perhaps you want to define a
> package instead?
>
> On Wed, Feb 6, 2019, 1:54 AM <[email protected] <javascript:>> wrote:
>
>> Hi,
>>
>> I want to define services inside proto messages as below.
>>
>> Example of a proto file.
>>
>> syntax = "proto2";
>>
>> message Sample {
>> //
>> }
>>
>> message Example {
>> //
>> service Service {
>> rpc someMethod(Sample) returns Sample;
>> }
>> }
>>
>> So I can refer to that rpc as 'Example.Service.someMethod'.
>>
>> There may be another services, methods with the same name as
>> 'AnotherExample.Service.
>> somMethod' nested in other messages.
>>
>> This provides a logical relationship between proto
>> messages and rpc's for me.
>> For example, each proto message can have a method called 'init".
>>
>> Protoc does not support this, my proto file fails to compile.
>>
>> How can I achieve this?
>>
>> --
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/protobuf.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.