[protobuf] Re: protoc escape colon in options

2017-05-17 Thread David Konsumer
I guess I can just encodeURI it or something, but I hoped there might be a 
built-in way to escape ":"

On Wednesday, May 17, 2017 at 12:15:36 PM UTC-7, David Konsumer wrote:
>
> I have made a protoc plugin that handles some options, in the format:
>
> protoc -I $PROTO --postman_out=name=cool,base=$URL:out 
> $PROTO/services.proto
>
> to get the options "name" and "base"
>
> If "base" is a standard url (ie https://google.com) it has a colon in it, 
> which makes protoc think it's the output dir. Is there a way to escape 
> colons in the options?.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] protoc escape colon in options

2017-05-17 Thread David Konsumer
I have made a protoc plugin that handles some options, in the format:

protoc -I $PROTO --postman_out=name=cool,base=$URL:out $PROTO/services.proto

to get the options "name" and "base"

If "base" is a standard url (ie https://google.com) it has a colon in it, 
which makes protoc think it's the output dir. Is there a way to escape 
colons in the options?.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Timestamp

2017-05-17 Thread 'Feng Xiao' via Protocol Buffers
On Wed, May 17, 2017 at 8:10 AM, Leonardo Toledo 
wrote:

> Hi! I am using protobufs but i need to use the version 2 (syntax 2) of
> protobufs and at the same time i need to use the a timestamp, but the
> examples that i saw they use always the syntax 3 of protobufs. I already
> checked the protobufs documentation and i read that in syntax 2 also exist
> a timestamp, so my question is, how can i use your timestamp with syntax 2
> of protobufs?
>
> This is my code:
> import https://github.com/golang/protobuf/ptypes/timestamp/timestamp.proto
> (BUT THIS DOES EXIST A LINK TO THIS ALREADY)
> import https://github.com/google/protobuf/blob/master/
> src/google/protobuf/timestamp.proto (BUT THIS IS USING PROTO 3)
>
> repeated google.protobuf.Timestamp timestamp = 1;
>
> This does works, can anyone help me please and tell me how can i use the
> timestamp in protoc 2 ?
>
timestamp.proto uses proto3 syntax, but you can use it in a proto2 syntax
file.


>
> Thanks in advance! I am waiting for on response from you!
>
> Best regards,
> Leonardo Toledo
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> 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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Re: Porting protobuf to iRTOS

2017-05-17 Thread 'Feng Xiao' via Protocol Buffers
On Tue, May 16, 2017 at 11:26 PM, Shiva Kumar 
wrote:

> I have even tried using static member class. But in protobuf, namespace
> are nested and distributed across files. Mapping them to class will not
> work out. Removing the all the namespace is another consideration. Please
> suggest is there a simple way to do this or if a complete C version is also
> will be very helpful.
>

You can find some third-party C implementations here:
https://github.com/google/protobuf/blob/master/docs/third_party.md


>
> -Shiva
>
>
> On Wednesday, May 17, 2017 at 10:49:37 AM UTC+5:30, Shiva Kumar wrote:
>>
>> Hi All,
>>
>> I am porting protobuf stack to iRTOS. My C++ compiler doesn't support
>> "namespace" (its kind of compliant to Embedded C++). I am finding it very
>> difficult to port it. I there a complete C alternative or any other easy
>> way to port it.
>>
>> -Regards,
>> Shiva
>>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> 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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Timestamp

2017-05-17 Thread Leonardo Toledo
Hi! I am using protobufs but i need to use the version 2 (syntax 2) of 
protobufs and at the same time i need to use the a timestamp, but the 
examples that i saw they use always the syntax 3 of protobufs. I already 
checked the protobufs documentation and i read that in syntax 2 also exist 
a timestamp, so my question is, how can i use your timestamp with syntax 2 
of protobufs? 

This is my code:
import https://github.com/golang/protobuf/ptypes/timestamp/timestamp.proto 
(BUT THIS DOES EXIST A LINK TO THIS ALREADY)
import 
https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto
 
(BUT THIS IS USING PROTO 3)

repeated google.protobuf.Timestamp timestamp = 1;

This does works, can anyone help me please and tell me how can i use the 
timestamp in protoc 2 ? 

Thanks in advance! I am waiting for on response from you! 

Best regards,
Leonardo Toledo 

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Merging / extending 2 different Message types

2017-05-17 Thread Ciprian Caba
Hi guys,

I want to use protobufs on c++ for directly serializing some server 
requests into data objects. However, these requests share some common 
fields (eg: ts, auth-key, so on) - let's call them CommonParams

I will have multiple requests, eg: CreateAccountRequest, 
ReadAccountRequest, DeleteAccountRequest, which will all share the above 
common fields plus more.

Is there a way to merge a CommonParams's fields into a 
CreateAccountRequest, ReadAccountRequest? I also want the params to be on 
top level of the serialized JSON so no custom field of type CommonParams.

The only way I found was to serialize the CommonParams message and then to 
parse a new *Request message by parsing that serialized CommonParams. Of 
course, this means duplicating the CommonParams's fields into all of the 
*Request messages.

Any thoughts?

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Re: Protobuf3: How to use the new timestamp proto type?

2017-05-17 Thread Andrés Castaño
Hello all, I had the same issue when generating protos that contain 
Timestamp in Debian.

I got it working following this instructions:

https://gist.github.com/sofyanhadia/37787e5ed098c97919b8c593f0ec44d8

Please note my comment about creating a symlink instead of moving the 
binary.



On Thursday, 16 June 2016 02:19:56 UTC+10, Chad Beaulac wrote:
>
> A buildable solution is in my post here:
> https://groups.google.com/d/msg/protobuf/ecxdP_mN8OI/3FxhjiDaAQAJ
>
> Importing and fully qualified name worked for me.
>
>
> On Tuesday, June 14, 2016 at 10:18:10 AM UTC-7, Camilo Aguilar wrote:
>>
>> I'm also  unable to use the Timestamp type, using the fully qualified 
>> path didn't seem to work for me. 
>>
>> On Friday, May 6, 2016 at 8:00:26 PM UTC-4, Nathaniel Weems wrote:
>>>
>>> Using the fully qualified path "google.protobuf.Timestamp" works.
>>>
>>> On Friday, June 12, 2015 at 6:34:32 AM UTC-6, Robin wrote:

 I installed protobuf with the following homebrew command on OS X 
 10.10.3: brew install protobuf --devel
 The binary is symlinked to /us/local/bin and the includes are symlinked 
 to /usr/local/include/google/protobuf/timestamp.proto (which is present as 
 I confirmed).

 Which include path do you mean, the protoc -IPATH? And should it be 
 sufficient in my .proto file to just use Timestamp or should I use the 
 full 
 google.protobuf.Timestamp?

 On Friday, June 12, 2015 at 8:41:18 AM UTC+2, 肖锋 wrote:
>
>
>
> On Thursday, June 11, 2015 at 6:08:33 PM UTC-7, Robin wrote:
>>
>> Hi everyone,
>>
>> I have installed protobuf3.0.0-alpha-3 on my machine and have the 
>> following proto file:
>>
>> syntax = "proto3";
>>
>> package my.great.package;
>>
>> import "google/protobuf/timestamp.proto";
>>
>> option java_outer_classname = "TimestampedThingMsg";
>>
>> message TimestampedThing {
>> 
>> string thing = 1;
>> Timestamp date = 2;
>> 
>> }
>>
>> However when I run "protoc protobuf/timestamped_thing.proto" I get 
>> the following two errors:
>>
>> protobuf/timestamped_thing.proto: Import 
>> "google/protobuf/timestamp.proto" was not found or had errors.
>>
>> protobuf/timestamped_thing.proto:15:5: "Timestamp" is not defined.
>>
> protoc should be able to find these types automatically if they are 
> installed with protoc. Where did you install the protoc binary? Could you 
> check whether you can find google/protobuf/timestamp.proto in your 
> include 
> path? These protos should be installed along with protobuf header files.
>  
>
>>
>> How can I import the new Timestamp message type (source file: 
>> https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto)
>>  
>> to use it in my own messages?
>>
>> The only related example I could find in the docs was for the Any 
>> type where the import looks exactly like mine so not sure how to go 
>> about 
>> this. Docs link: 
>> https://developers.google.com/protocol-buffers/docs/proto3#any
>>
>>
>> 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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.