yeqown / protoc-gen-fieldmask

Generate FieldMask utility functions for protobuf
MIT License
34 stars 9 forks source link

Generation of shared out message type yields incompilable go code #7

Closed vaidasn closed 2 years ago

vaidasn commented 2 years ago

If the proto file contains multiple field masks that share the same out message type then the generated go code has compilation errors. Example of failing proto file:

syntax = "proto3";

import "google/protobuf/field_mask.proto";
import "fieldmask/option.proto";

message UserListRequest {
  int32 page_size = 1;
  string page_token = 2;
  google.protobuf.FieldMask field_mask = 3 [
    (fieldmask.option.Option).in = {gen: false},
    (fieldmask.option.Option).out = {gen: true, message:"UserInfoResponse"}
  ];
}
message UserInfoRequest {
  string user_id = 1;
  google.protobuf.FieldMask field_mask = 2 [
    (fieldmask.option.Option).in = {gen: false},
    (fieldmask.option.Option).out = {gen: true, message:"UserInfoResponse"}
  ];
}

message Address {
  string country = 1;
  string province = 2;
}

message UserInfoResponse {
  string user_id = 1;
  string name = 2;
  string email = 3;
 Address address = 4;
}