Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public class Compute extends com.google.api.client.googleapis.services.json.Abst
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
* <li>Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
* <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
* <li>Java: {@code com.google.api.client.http.javanet.NetHttpTransport}</li>
* </li>
* </ul>
* @param jsonFactory JSON factory, which may be:
Expand Down Expand Up @@ -293216,8 +293216,7 @@ private static String chooseEndpoint(com.google.api.client.http.HttpTransport tr
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
* <li>Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
* <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
* </li>
* <li>Java: {@code com.google.api.client.http.javanet.NetHttpTransport}</li>
* </ul>
* @param jsonFactory JSON factory, which may be:
* <ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public final class StructuredEntries extends com.google.api.client.json.GenericJ
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.util.Map<String, Any> entries;
private java.util.Map<String, java.lang.Object> entries;

/**
* Map of a partner metadata that belong to the same subdomain. It accepts any value including
* google.protobuf.Struct.
* @return value or {@code null} for none
*/
public java.util.Map<String, Any> getEntries() {
public java.util.Map<String, java.lang.Object> getEntries() {
return entries;
}

Expand All @@ -51,7 +51,7 @@ public java.util.Map<String, Any> getEntries() {
* google.protobuf.Struct.
* @param entries entries or {@code null} for none
*/
public StructuredEntries setEntries(java.util.Map<String, Any> entries) {
public StructuredEntries setEntries(java.util.Map<String, java.lang.Object> entries) {
this.entries = entries;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public class Compute extends com.google.api.client.googleapis.services.json.Abst
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
* <li>Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
* <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
* <li>Java: {@code com.google.api.client.http.javanet.NetHttpTransport}</li>
* </li>
* </ul>
* @param jsonFactory JSON factory, which may be:
Expand Down Expand Up @@ -270048,8 +270048,7 @@ private static String chooseEndpoint(com.google.api.client.http.HttpTransport tr
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
* <li>Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
* <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
* </li>
* <li>Java: {@code com.google.api.client.http.javanet.NetHttpTransport}</li>
* </ul>
* @param jsonFactory JSON factory, which may be:
* <ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public final class StructuredEntries extends com.google.api.client.json.GenericJ
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.util.Map<String, Any> entries;
private java.util.Map<String, java.lang.Object> entries;

/**
* Map of a partner metadata that belong to the same subdomain. It accepts any value including
* google.protobuf.Struct.
* @return value or {@code null} for none
*/
public java.util.Map<String, Any> getEntries() {
public java.util.Map<String, java.lang.Object> getEntries() {
return entries;
}

Expand All @@ -51,7 +51,7 @@ public java.util.Map<String, Any> getEntries() {
* google.protobuf.Struct.
* @param entries entries or {@code null} for none
*/
public StructuredEntries setEntries(java.util.Map<String, Any> entries) {
public StructuredEntries setEntries(java.util.Map<String, java.lang.Object> entries) {
this.entries = entries;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public class Compute extends com.google.api.client.googleapis.services.json.Abst
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
* <li>Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
* <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
* <li>Java: {@code com.google.api.client.http.javanet.NetHttpTransport}</li>
* </li>
* </ul>
* @param jsonFactory JSON factory, which may be:
Expand Down Expand Up @@ -234047,8 +234047,7 @@ private static String chooseEndpoint(com.google.api.client.http.HttpTransport tr
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
* <li>Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
* <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
* </li>
* <li>Java: {@code com.google.api.client.http.javanet.NetHttpTransport}</li>
* </ul>
* @param jsonFactory JSON factory, which may be:
* <ul>
Expand Down
11 changes: 5 additions & 6 deletions generator/src/googleapis/codegen/java_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,11 @@ def _GetTypeInfo(self, def_dict):
if result:
return result

# TODO(user): Uncomment this and update golden files.
# result = self.type_map.get((json_type, None))
# if result:
# return result
#
# raise ValueError('Unknown type: %s format: %s' % (json_type, json_format))
# Fallback to the unformatted base type if exact format mapping is not found.
result = self.type_map.get((json_type, None))
if result and json_type != 'string':
return result


return (utilities.CamelCase(json_type), None, None)

Expand Down
6 changes: 6 additions & 0 deletions generator/tests/java_generator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ def testGetCodeTypeFromDictionary(self):
['java.lang.String', {'type': 'string'}],
['java.lang.Long', {'type': 'integer', 'format': 'uint32'}],
['java.math.BigInteger', {'type': 'string', 'format': 'uint64'}],
['java.lang.Object', {'type': 'any', 'format': 'unknown'}],
['String', {'type': 'string', 'format': 'unknown'}],

]
for test_case in test_cases:
self.assertEqual(
Expand All @@ -110,6 +113,9 @@ def testGetPrimitiveTypeFromDictionary(self):
[None, {'type': 'string', 'format': 'date-time'}],
[None, {'type': 'string', 'format': 'uint64'}],
[None, {'type': 'anything_else', 'format': 'uint64'}],
[None, {'type': 'any', 'format': 'unknown'}],
[None, {'type': 'string', 'format': 'unknown'}],

]

for test_case in test_cases:
Expand Down