Skip to content

Commit

Permalink
feat: Add autopopulated proto3 optional field to echo (#1471)
Browse files Browse the repository at this point in the history
* feat: Add autopopulated proto3 optional field to echo

* update field numbers
  • Loading branch information
parthea committed Mar 20, 2024
1 parent f5cd0ed commit dba317f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion schema/google/showcase/v1beta1/echo.proto
Expand Up @@ -211,10 +211,15 @@ message EchoRequest {
// Optional. This field can be set to test the routing annotation on the Echo method.
string other_header = 5;

// Based on go/client-populate-request-id-design; subject to change
// To facilitate testing of https://google.aip.dev/client-libraries/4235
string request_id = 7 [
(google.api.field_info).format = UUID4
];

// To facilitate testing of https://google.aip.dev/client-libraries/4235
optional string other_request_id = 8 [
(google.api.field_info).format = UUID4
];
}

// The response message for the Echo methods.
Expand All @@ -227,6 +232,9 @@ message EchoResponse {

// The request ID specified or autopopulated in the request.
string request_id = 3;

// The other request ID specified or autopopulated in the request.
string other_request_id = 4;
}

// The request message used for the EchoErrorDetails method.
Expand Down
1 change: 1 addition & 0 deletions schema/google/showcase/v1beta1/showcase_v1beta1.yaml
Expand Up @@ -88,3 +88,4 @@ publishing:
- selector: google.showcase.v1beta1.Echo.Echo
auto_populated_fields:
- request_id
- other_request_id
2 changes: 1 addition & 1 deletion server/services/echo_service.go
Expand Up @@ -51,7 +51,7 @@ func (s *echoServerImpl) Echo(ctx context.Context, in *pb.EchoRequest) (*pb.Echo
}
echoHeaders(ctx)
echoTrailers(ctx)
return &pb.EchoResponse{Content: in.GetContent(), Severity: in.GetSeverity(), RequestId: in.GetRequestId()}, nil
return &pb.EchoResponse{Content: in.GetContent(), Severity: in.GetSeverity(), RequestId: in.GetRequestId(), OtherRequestId: in.GetOtherRequestId()}, nil
}

func (s *echoServerImpl) EchoErrorDetails(ctx context.Context, in *pb.EchoErrorDetailsRequest) (*pb.EchoErrorDetailsResponse, error) {
Expand Down

0 comments on commit dba317f

Please sign in to comment.