Skip to content

Commit a9fcffc

Browse files
committed
docs: explain that response parsing considers json_name
1 parent ed9d0a9 commit a9fcffc

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

sdk-platform-java/gax-java/gax-httpjson/src/main/java/com/google/api/gax/httpjson/ProtoRestSerializer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ String toJson(Message message, boolean numericEnum) {
101101
@SuppressWarnings("unchecked")
102102
RequestT fromJson(Reader json, Message.Builder builder) {
103103
try {
104+
// Supports mapping from both standard proto field names and explicit 'json_name' annotations.
105+
// See:
106+
// https://github.com/protocolbuffers/protobuf/blob/cecbbf41e43634c7c5b940dd336aa81b31fd4e5d/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java#L1577-L1583
104107
JsonFormat.parser().usingTypeRegistry(registry).ignoringUnknownFields().merge(json, builder);
105108
return (RequestT) builder.build();
106109
} catch (IOException e) {

0 commit comments

Comments
 (0)