Skip to content

MembershipsUpdateResponse required fields are not returned on API operations #15

Open
@rmolcr

Description

@rmolcr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions