Skip to content

Conversation

Copy link

Copilot AI commented Dec 2, 2025

The OneLogin API returns a pagination field in the Groups response, but GetGroups200Response didn't include it, causing deserialization to fail with IllegalArgumentException.

Changes

  • Created GetGroups200ResponsePagination - Model class with before_cursor, after_cursor, previous_link, next_link fields, following the pattern of GetEvents200ResponsePagination

  • Updated GetGroups200Response - Added pagination field with:

    • Serialization annotations and accessors
    • JSON validation logic
    • Integration into equals(), hashCode(), toString()
    • Added to openapiFields set
  • Added tests - Integration test validates the exact JSON from the issue now deserializes successfully

Example

GroupsApi groupsApi = new GroupsApi(defaultClient);
GetGroups200Response response = groupsApi.getGroups();

// Pagination info now accessible
GetGroups200ResponsePagination pagination = response.getPagination();
String nextCursor = pagination.getAfterCursor();
String nextLink = pagination.getNextLink();

// Groups data works as before
List<Group> groups = response.getData();

Fixes the JSON deserialization error:

The field `pagination` in the JSON string is not defined in the `GetGroups200Response` properties.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • repository.sonatype.org
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.11/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.11/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.11 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.11/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/onelogin-java-sdk/onelogin-java-sdk org.codehaus.plexus.classworlds.launcher.Launcher clean compile (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>The field pagination in the JSON string is not defined in the GetGroups200Response properties</issue_title>
<issue_description>Listing groups not working at all:

Exception in thread "main" java.lang.IllegalArgumentException: The field pagination in the JSON string is not defined in the GetGroups200Response properties. JSON: {"status":{"error":false,"code":200,"type":"success","message":"Success"},"pagination":{"before_cursor":null,"after_cursor":null,"previous_link":null,"next_link":null},"data":[{"id":502836,"name":"test","reference":null}]}
at com.onelogin.client.model.GetGroups200Response.validateJsonObject(GetGroups200Response.java:189)
at com.onelogin.client.model.GetGroups200Response$CustomTypeAdapterFactory$1.read(GetGroups200Response.java:233)
at com.onelogin.client.model.GetGroups200Response$CustomTypeAdapterFactory$1.read(GetGroups200Response.java:223)
at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:199)
at com.google.gson.Gson.fromJson(Gson.java:963)
at com.google.gson.Gson.fromJson(Gson.java:928)
at com.google.gson.Gson.fromJson(Gson.java:877)
at com.onelogin.client.JSON.deserialize(JSON.java:325)
at com.onelogin.client.ApiClient.deserialize(ApiClient.java:989)
at com.onelogin.client.ApiClient.handleResponse(ApiClient.java:1199)
at com.onelogin.client.ApiClient.execute(ApiClient.java:1123)
at com.onelogin.client.api.GroupsApi.getGroupsWithHttpInfo(GroupsApi.java:309)
at com.onelogin.client.api.GroupsApi.getGroups(GroupsApi.java:289)

com.onelogin onelogin-java-sdk 3.1.1

GroupsApi groupsApi = new GroupsApi(defaultClient);
List groups = groupsApi.getGroups().getData();
if (groups != null) {
for (Group group : groups) {
System.out.println(group.toString());
}
}</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Subterrane <5290140+Subterrane@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix pagination field in GetGroups200Response Add missing pagination field to GetGroups200Response Dec 2, 2025
Copilot AI requested a review from Subterrane December 2, 2025 21:54
@Subterrane Subterrane closed this Dec 2, 2025
@Subterrane Subterrane deleted the copilot/fix-pagination-field-issue branch December 2, 2025 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The field pagination in the JSON string is not defined in the GetGroups200Response properties

2 participants