Questions tagged [protocol-buffers]

For questions about Google's protocol buffers

Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages.

https://developers.google.com/protocol-buffers

7638 questions
3
votes
1 answer

How can I implement a gRPC ServerWritableStream in nest.js?

The nest.js documentation doesn't mention anything regarding the case of a unidirectional ServerWritableStream. I want to receive a normal request and use call.write to pass to the client streaming messages. This works fine in plain TypeScript using…
Va5ili5
  • 749
  • 8
  • 20
3
votes
3 answers

Protobuf NUL-framing

Common practice for using protobufs over the wire, including by gRPC, is to length prefix protobuf messages into frames (e.g. like this) so that the decoder knows when one message stops and the next starts. This seems unnecessary. According to the…
ckfinite
  • 427
  • 2
  • 6
3
votes
3 answers

Parsing a date from a mongoDB with golang time.Now()

I am creating a date using Go via time.Now() and it store it in the mongoDB with no issue. The date looks like 2023-02-28T20:10:46.140+00:00. However when I try to retrieve it I get an error that reads: {{"code":2, "message":"parsing time…
Mike3355
  • 11,305
  • 24
  • 96
  • 184
3
votes
0 answers

bazel build proto failed due to missing symbol called in mac

I am using bazel to build my grpc proto3 and use the grpc-ecosystem/grpc-gateway in golang, but it failed due to missing symbol called without more detailed error message. bazel build //proto/public/v1:admin_service_go_proto --sandbox_debug…
Jay
  • 71
  • 3
3
votes
0 answers

Tonic annotate only enums at compile time

Using tonic_build I can add .type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]”) to annotate my types with e.g. serde. However is there a way to only annotate enums, that are in the same package as structs. Example: syntax =…
Alex
  • 439
  • 5
  • 16
3
votes
2 answers

Convert the output of protoc --decode_raw into json

I'm trying to convert the message of a protobuf blob into a json, without the corresponding schema. This is the code I'm using but it doesn't get nested objects. Maybe there is a way to convert blobs without the schema? I just need a json. The…
Georg K.
  • 463
  • 2
  • 8
3
votes
1 answer

How to serialise protobuf enum values for plain-text / prototxt storage?

I can successfully serialise other fields to ASCII using google::protobuf::TextFormat::Print, however my enums don't show up. What am I doing wrong? Code as follows: main.cpp #include #include #include #include…
Brian
  • 185
  • 1
  • 11
3
votes
0 answers

How to I install protobufs C++/Python extension?

I'm looking to upgrade to the new protobuf version 4.21.0. I am sharing messages between python and c++, on the release page they mention that this capability breaks, unless I set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp, and ensure that the…
Hakaishin
  • 2,550
  • 3
  • 27
  • 45
3
votes
0 answers

Jackson deserialization error with List of class generated from proto file: Cannot find a (Map) Key deserializer for type

I am getting an error Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot find a (Map) Key deserializer for type [simple type, class com.google.protobuf.Descriptors$FieldDescriptor] when I attempt to deserialize the…
James Hutchinson
  • 841
  • 2
  • 13
  • 27
3
votes
1 answer

How to minimize protocol buffer memory allocations for large # of messages?

My application uses protocol buffers and has a large number (100 million) of simple messages. Based on callgrind analysis, a memory allocation & deallocation is being made for each instance. Consider the following representative example: //…
MarkB
  • 672
  • 2
  • 9
3
votes
1 answer

Return the enum key when decoding Protobuf in Python

Currently, I am decoding protobuf messages in Python where the output is: { "lat": 12.345678, "lng": -12.345678, "firmware_status": 3 } In my case 3 corresponds to FINISHED per the .proto file enum definition. * Note I'm using v3 of…
Don T Spamme
  • 199
  • 7
3
votes
2 answers

Python class generated by protoc cannot be imported in the code because of unresolved references (Mac OS)

I tried to use protocol buffers on my project and the problem I have is that when I use protoc to generate the python class. The file that's generated looks nothing like in the example provided by Google and cannot be imported in any file because…
3
votes
2 answers

Latest Google protobuf not working on app engine

For my GAE app, I was updating the libs in my requirements.txt, and after doing so, I get error messages relating to protobuf. TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file, your generated code is out…
new name
  • 15,861
  • 19
  • 68
  • 114
3
votes
0 answers

How to represent google.protobuf.Any to JSON?

I have a request with a field of google.protobuf.Any type. I already checked if my gRPC service is working and I set up the envoy to transcode HTTP/JSON to gRPC. But the envoy keeps giving me an error because of the google.protobuf.Any…
Gunwoo Kim
  • 63
  • 8
3
votes
3 answers

GRPC_TOOLS.PROTOC generates broken pb2 python file

I am trying to build an application using gRPC in Python. I have the following directory layout: service/ ├─ auth/ │ ├─ auth_pb2_grpc.py │ ├─ auth_pb2.py │ ├─ auth.py │ ├─ client.py ├─ flask/ ├─ todo/ ├─ app.py ├─ auth.proto/ ├─…
Qagan
  • 31
  • 3
1 2 3
99
100