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

[bug]: getObjects JSON deserialization with null object #427

Open
antoinelapeyrelbo opened this issue Nov 13, 2024 · 1 comment
Open

[bug]: getObjects JSON deserialization with null object #427

antoinelapeyrelbo opened this issue Nov 13, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@antoinelapeyrelbo
Copy link

Description

Hi,

I'm currently working on an Android application using the Kotlin Algolia client.
I have just updated to 3.5.0 and have an issue when using searchClient.getObjects(): if I request for an object that does not exist on Algolia, it returns an array with some "null" values that breaks the Ktor deserialisation.

For exemple:
The request:
{"requests":[{"objectID":"222966","indexName":"my_index","attributesToRetrieve":[""]},{"objectID":"314558","indexName":"my_index","attributesToRetrieve":[""]},{"objectID":"317683","indexName":"my_index","attributesToRetrieve":[""]}]}
222966 and 317683 exist on Algolia but not 314558
The response:
{"results":[{"objectID":"222966"},null,{"objectID":"317683"}],"message":"ObjectID 314558 does not exist. "}
So it throws and AlgoliaClientException because:
io.ktor.serialization.JsonConvertException: Illegal input: Unexpected JSON token at offset 34: Expected start of the object '{', but had 'n' instead at path: $.results[1]

Is there a way to request for objects even if they don't exist on Algolia and get a response like it did in v2? Maybe using a custom Json deserializer?

Thanks

Client

Search

Version

3.5.0

Relevant log output

No response

@antoinelapeyrelbo
Copy link
Author

Hi, any updates on that? Can you reproduce the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant