-
Notifications
You must be signed in to change notification settings - Fork 69
Closed
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
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.
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.