Skip to content

Commit

Permalink
chore: Enable requesting numeric enums in "transport=rest" responses …
Browse files Browse the repository at this point in the history
…for services supporting this (Java, Go, Python, PHP, TypeScript, C#, and Ruby), even if they do not yet turn on REST transport (#566)

- [ ] Regenerate this pull request now.

chore: disallow "transport=rest" for services where numeric enums are not confirmed to be supported (except in PHP and Java)
PiperOrigin-RevId: 493113566

Source-Link: https://github.com/googleapis/googleapis/commit/758f0d1217d9c7fe398aa5efb1057ce4b6409e55

Source-Link: https://github.com/googleapis/googleapis-gen/commit/78bd8f05e1276363eb14eae70e91fe4bc20703ab
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzhiZDhmMDVlMTI3NjM2M2ViMTRlYWU3MGU5MWZlNGJjMjA3MDNhYiJ9
  • Loading branch information
gcf-owl-bot[bot] authored Dec 20, 2022
1 parent 223bdff commit b0143ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public class HttpJsonPoliciesStub extends PoliciesStub {
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
Expand Down Expand Up @@ -122,6 +123,7 @@ public class HttpJsonPoliciesStub extends PoliciesStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<GetPolicyRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
Expand Down Expand Up @@ -156,12 +158,13 @@ public class HttpJsonPoliciesStub extends PoliciesStub {
ProtoRestSerializer<CreatePolicyRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "policyId", request.getPolicyId());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("policy", request.getPolicy(), false))
.toBody("policy", request.getPolicy(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.<Operation>newBuilder()
Expand Down Expand Up @@ -196,12 +199,13 @@ public class HttpJsonPoliciesStub extends PoliciesStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<UpdatePolicyRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("policy", request.getPolicy(), false))
.toBody("policy", request.getPolicy(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.<Operation>newBuilder()
Expand Down Expand Up @@ -236,6 +240,7 @@ public class HttpJsonPoliciesStub extends PoliciesStub {
ProtoRestSerializer<DeletePolicyRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "etag", request.getEtag());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public class HttpJsonPoliciesStub extends PoliciesStub {
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
Expand Down Expand Up @@ -122,6 +123,7 @@ public class HttpJsonPoliciesStub extends PoliciesStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<GetPolicyRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
Expand Down Expand Up @@ -156,12 +158,13 @@ public class HttpJsonPoliciesStub extends PoliciesStub {
ProtoRestSerializer<CreatePolicyRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "policyId", request.getPolicyId());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("policy", request.getPolicy(), false))
.toBody("policy", request.getPolicy(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.<Operation>newBuilder()
Expand Down Expand Up @@ -196,12 +199,13 @@ public class HttpJsonPoliciesStub extends PoliciesStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<UpdatePolicyRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("policy", request.getPolicy(), false))
.toBody("policy", request.getPolicy(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.<Operation>newBuilder()
Expand Down Expand Up @@ -236,6 +240,7 @@ public class HttpJsonPoliciesStub extends PoliciesStub {
ProtoRestSerializer<DeletePolicyRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "etag", request.getEtag());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
Expand Down

0 comments on commit b0143ff

Please sign in to comment.