Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MembershipsUpdateResponse required fields are not returned on API operations #15

Open
rmolcr opened this issue May 15, 2024 · 0 comments

Comments

@rmolcr
Copy link

rmolcr commented May 15, 2024

Hello,

First of all, thanks for all the support provided regarding OpenAPI usage. I'm opening this issue here as I think it is directly related to the specification, but sorry in advanced if this is not the proper place to raise this.

Problem

We are currently using the HubSpot OpenAPI spec to auto-generate a client for a Kotlin based application we are working on.
We've successfully integrated it and managed to generate all required code. Also made some tests to retrieve some entities and seems to be working like a charm.

After some testing, we are having an error with the Add records to a List operation (Probably happening with other operations on the List Membermship API).
As described in the specification, it should return a MembershipsUpdateResponse, and we are getting an error when the client tries to parse the reponse body, as it expecting some required fields that are not returned when adding a record to a List (e.g: recordIdsRemoved)

com.squareup.moshi.JsonDataException: Required value 'recordIdsRemoved' missing at $
	at com.squareup.moshi.internal.Util.missingProperty(Util.java:660)
	at com.squareup.moshi.kotlin.reflect.KotlinJsonAdapter.fromJson(KotlinJsonAdapter.kt:105)
	at com.squareup.moshi.internal.NullSafeJsonAdapter.fromJson(NullSafeJsonAdapter.java:41)
	at com.squareup.moshi.JsonAdapter.fromJson(JsonAdapter.java:70)
	at com.hubspot.lists.api.MembershipsApi.putCrmV3ListsListIdMembershipsAddWithHttpInfo(MembershipsApi.kt:1405)
	at com.hubspot.lists.api.MembershipsApi.putCrmV3ListsListIdMembershipsAdd(MembershipsApi.kt:225)
[...]

The actual response from the API is like (required fields are not present in the response):

{
    "recordsIdsAdded": [
        "13XXXXXXXX"
    ]
}

Workarround

After digging and debugging a bit the issue, we removed the required fields of MembershipsUpdateResponse from the local file for the OpenAPI specification we use and regenerated again all the code for the client.
This seems to be fixing the issue and we can now successfully run the Add records to a List operation.

Thanks in advance

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

No branches or pull requests

1 participant