Given the RPC definition
rpc UpdateCase(UpdateCaseRequest) returns (Case) {
option (google.api.http) = {
patch: "/v2beta/{case.name=projects/*/cases/*}"
body: "case"
};
option (google.api.method_signature) = "case,update_mask";
}
resource definition
message Case {
option (google.api.resource) = {
type: "cloudsupport.googleapis.com/Case"
pattern: "projects/{project}/cases/{case}"
};
}
and request definition
message UpdateCaseRequest {
Case case = 1 [(google.api.field_behavior) = REQUIRED];
google.protobuf.FieldMask update_mask = 2;
}
The generated unit tests would fail because UpdateCaseRequest contains a field with name case which is a Java keyword.
Root cause: We append a _ to the field name in generated client code, so the field name is now case_, then when we try to match it with case.name in the resource definition in generated unit tests, it would fail because we are unable to find a field with name case.
Potential fix: Unescape the field name when generating unit tests.
Given the RPC definition
resource definition
and request definition
The generated unit tests would fail because
UpdateCaseRequestcontains a field with namecasewhich is a Java keyword.Root cause: We append a
_to the field name in generated client code, so the field name is nowcase_, then when we try to match it withcase.namein the resource definition in generated unit tests, it would fail because we are unable to find a field with namecase.Potential fix: Unescape the field name when generating unit tests.