ann
ann

Reputation: 371

Internal reference in protobuf?

I'm new to scala and I'm thinking of using protobuf to pass around some data. However, in the data, there are some common sets of values across different items. The data in JSON might look like this:

[
  {
    "id" : "1",
    "value" : {
      "field1" : "f1value.1",
      "field2" : "f2value.1",
      "field3": commonobject 
    }
  },
  {
    "id" : "2",
    "value" : {
      "field1" : "f1value.2",
      "field2" : "f2value.2",
      "field3": commonobject
    }
  }
]

I am hoping to find a solution not to duplicated commonobject somehow. I'm wondering if there is an internal reference in protobuf, like $ref in JSON schema.

Thanks for the help!

Upvotes: 1

Views: 565

Answers (1)

kliew
kliew

Reputation: 3183

protobuf messages cannot store references. You can store an object-id to reference common objects.

Upvotes: 2

Related Questions