yeqown / protoc-gen-fieldmask

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

Generation for repeated fields and map fields fails #1

Closed vaidasn closed 2 years ago

vaidasn commented 2 years ago

FieldMask documentation says that repeated fields (and map field) are supported only if they are in the last position of a field mask. Field mask generation currently does not take that into account and fails. Example of failing proto file:

syntax = "proto3";

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

message UserInfoRequest {
  string user_id = 1;
  google.protobuf.FieldMask field_mask = 2 [
    (fieldmask.option.Option).in = {gen: true},
    (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;
  repeated Address addresses = 4;
}
yeqown commented 2 years ago

Amazing, you open 5 issues and 5 PRs almost at the same time, give me some time to check out them one by one ~