proteus icon indicating copy to clipboard operation
proteus copied to clipboard

Don't inline fields of embedded messages, keep them as separated messages

Open erizocosmico opened this issue 8 years ago • 1 comments

Right now, if we do something like the following:

type Model struct {
  ID int64
}

type User struct {
  Model
  Name string
}

The result of the proto generated by proteus is:

message User {
  int64 id = 1;
  string name = 2;
}

Which works fine right now, but we should maybe change it because as a result, Model is not generated and does not get its ProtoMessage and all the mumbo jumbo it should have generated for it, which can be a mess for reflection-based marshal/unmarshal if we finally make it work with that.

Right now it works, but we should evaluate if this is worth fixing/changing or not in the long run.

erizocosmico avatar Jun 26 '17 09:06 erizocosmico

If done, would be a breaking change, thus I would say we should add a tag to that field not to be treated as inlined.

Serabe avatar Jul 05 '17 12:07 Serabe