Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #12 from hathora/java-roomconfig-validation
Browse files Browse the repository at this point in the history
updating patch and removing inaccurate null-check for java roomConfig
  • Loading branch information
jchu231 authored Nov 15, 2023
2 parents 6496b06 + 8fc89e1 commit b4f785b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 10 additions & 0 deletions java/post-java-generation.patch
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,13 @@ diff --git a/java/src/main/java/com/hathora/client/model/Room.java b/java/src/ma
// ensure the json data is an array
if (!jsonObj.get("allocations").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `allocations` to be an array in the JSON string but got `%s`", jsonObj.get("allocations").toString()));
@@ -366,9 +366,6 @@ public class Room {
for (int i = 0; i < jsonArrayallocations.size(); i++) {
RoomAllocation.validateJsonObject(jsonArrayallocations.get(i).getAsJsonObject());
};
- if (!jsonObj.get("roomConfig").isJsonPrimitive()) {
- throw new IllegalArgumentException(String.format("Expected the field `roomConfig` to be a primitive type in the JSON string but got `%s`", jsonObj.get("roomConfig").toString()));
- }
if (!jsonObj.get("roomId").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `roomId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("roomId").toString()));
}
3 changes: 0 additions & 3 deletions java/src/main/java/com/hathora/client/model/Room.java
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,6 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException {
for (int i = 0; i < jsonArrayallocations.size(); i++) {
RoomAllocation.validateJsonObject(jsonArrayallocations.get(i).getAsJsonObject());
};
if (!jsonObj.get("roomConfig").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `roomConfig` to be a primitive type in the JSON string but got `%s`", jsonObj.get("roomConfig").toString()));
}
if (!jsonObj.get("roomId").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `roomId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("roomId").toString()));
}
Expand Down

0 comments on commit b4f785b

Please sign in to comment.