Skip to content

Commit

Permalink
patch issue xdevplatform#30
Browse files Browse the repository at this point in the history
  • Loading branch information
nrv committed Jul 7, 2022
1 parent e96d0aa commit 5533da8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/com/twitter/clientlib/model/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,14 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException {
if (jsonObj.get("profile_image_url") != null && !jsonObj.get("profile_image_url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `profile_image_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("profile_image_url").toString()));
}

// Patch issue #30
if (jsonObj.get("profile_image_url") != null) {
if (jsonObj.get("profile_image_url").getAsString().isBlank()) {
jsonObj.remove("profile_image_url");
}
}

// validate the optional field `public_metrics`
if (jsonObj.getAsJsonObject("public_metrics") != null) {
UserPublicMetrics.validateJsonObject(jsonObj.getAsJsonObject("public_metrics"));
Expand Down

0 comments on commit 5533da8

Please sign in to comment.