I downloaded the openapi-description with
curl --location --request GET 'https://api.hubspot.com/api-catalog-public/v1/apis/crm/v3/associations' \ --header 'accept: application/yaml' \ -o associations.yaml
and I used the openapi-generator to generated a java client for that api.
I wanted to get get all associated custom objects for a list of custom objects. It is working as long as the association available. But when one entry does not have this association I get an error
org.springframework.web.client.RestClientException: Error while extracting response for type [class com.persolog.openapi.hubspot.associations.model.BatchResponsePublicAssociationMulti] and content type [application/json;charset=utf-8]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot construct instance of `com.persolog.openapi.hubspot.associations.model.ErrorCategory` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('OBJECT_NOT_FOUND'); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `com.persolog.openapi.hubspot.associations.model.ErrorCategory` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('OBJECT_NOT_FOUND')
at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 1, column: 243] (through reference chain: com.persolog.openapi.hubspot.associations.model.BatchResponsePublicAssociationMulti["errors"]->java.util.ArrayList[0]->com.persolog.openapi.hubspot.associations.model.StandardError["category"])
I looked into the association.yml and found a point that maybe wrong
StandardError: # ... properties: status: type: string id: type: string category: # working: # type: string # not working: $ref: '#/components/schemas/ErrorCategory'
when category is defined by the ref then it is not working. But with simple string-type it is working.
I requested the following endpoint:
https://api.hubapi.com/crm/v3/associations/2-106166593/2-106166588/batch/read
The complete result I got, was:
{
"status": "COMPLETE",
"results": [
{
"from": {
"id": "311326945"
},
"to": [
{
"id": "311244245",
"type": "referent_event"
}
]
},
{
"from": {
"id": "311326914"
},
"to": [
{
"id": "311244526",
"type": "referent_event"
}
]
}
],
"numErrors": 1,
"errors": [
{
"status": "error",
"category": "OBJECT_NOT_FOUND",
"subCategory": "crm.associations.NO_ASSOCIATIONS_FOUND",
"message": "No persolog_referent is associated with persolog_event 311326710.",
"context": {
"fromObjectId": [
"311326710"
],
"fromObjectType": [
"persolog_event"
],
"toObjectType": [
"persolog_referent"
]
}
}
],
"startedAt": "2022-09-26T14:46:54.602Z",
"completedAt": "2022-09-26T14:46:54.622Z"
}
Was this understandable? Do you need more Info?
Is this realy a bug and should be corrected?
kind regards in advance