Skip to content

PostContactInfoContactsSuccess deserialization fails - API returns array but model expects object #243

@micvm

Description

@micvm

Checklist

  • I am able to reproduce the bug with the latest version
  • I made sure that there are no existing issues - open or closed - which I could contribute my information to.
  • I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • This issue contains only one bug.

Affected version

1.1.1

Description of the problem

When using ContactsApi.addContactToList() or ContactsApi.removeContactFromList(), the API call succeeds but response deserialization fails with:

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type
software.xdev.brevo.model.PostContactInfoContactsSuccess from Array value (token JsonToken.START_ARRAY)
at [Source: REDACTED; line: 1, column: 24] (through reference chain:
software.xdev.brevo.model.PostContactInfo["contacts"]->software.xdev.brevo.model.PostContactInfoContacts["success"])

Cause:

The Brevo API returns success as an array of emails:

  {
    "contacts": {
      "success": ["[email protected]"],
      "failure": [],
      "total": 1
    }
  }

But PostContactInfoContactsSuccess is modeled as an empty object class (no fields), not as a List.

Expected:

PostContactInfoContacts.success should be typed as List (or similar), not PostContactInfoContactsSuccess.

Affected methods:

  • ContactsApi.addContactToList()
  • ContactsApi.removeContactFromList()

Steps to reproduce the bug

ApiClient apiClient = Configuration.getDefaultApiClient();
ApiKeyAuth apiKey = (ApiKeyAuth) apiClient.getAuthentication("api-key");
apiKey.setApiKey("your-api-key");

ContactsApi contactsApi = new ContactsApi();

AddContactToListRequest request = new AddContactToListRequest();
request.setEmails(List.of("[email protected]"));
request.setIds(null);
request.setExtIds(null);

contactsApi.addContactToList(123L, request); // throws ApiException

Additional information

Other methods returning PostContactInfo may have the same issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions