Repository navigation
fix(specs): allow null records in getObjects response - #6582
Merged
Merged
Conversation
Contributor
βοΈ Code generated!
π Benchmark resultsBenchmarks performed on the method using a mock server, the results might not reflect the real-world performance.
|
The engine returns `null` for requested objectIDs that don't exist in the index, but the `results` array was typed as non-null, which crashed deserialization in strongly-typed clients (e.g. Kotlin, Swift). Mark the `results` items as nullable and propagate nullability through the generic type templates (Swift, C#, JavaScript/TS) and the Dart generator. For Go, collapse the redundant `[]*map[string]any` back to `[]map[string]any` since a map is already a nilable reference type.
Fluf22
force-pushed
the
fix/get-objects-nullable
branch
from
June 18, 2026 12:32
2d67586 to
6aca28e
Compare
Fluf22
marked this pull request as ready for review
June 18, 2026 13:01
Add a client CTS case asserting that a `getObjects` response containing a `null` entry (returned for objectIDs that don't exist in the index) alongside a real record deserializes correctly. Locks the behavior fixed by marking the results items nullable.
The getObjects CTS test exposed two Ruby issues with null records: - client test rendering inlined the JSON `null` token as Ruby code, which is invalid (must be `nil`); add a `rubyNil` lambda to convert it. - `_to_hash` called `.compact`, stripping null entries from arrays in `to_hash`/`to_json`/`to_body`; drop it so null array elements are preserved.
eric-zaharia
approved these changes
Jun 22, 2026
algolia-api-clients-automation-bot Bot
added a commit
that referenced
this pull request
Jun 22, 2026
β¦ted) [skip ci] Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-csharp
that referenced
this pull request
Jun 22, 2026
algolia/api-clients-automation#6582 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-dart
that referenced
this pull request
Jun 22, 2026
algolia/api-clients-automation#6582 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-go
that referenced
this pull request
Jun 22, 2026
algolia/api-clients-automation#6582 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-java
that referenced
this pull request
Jun 22, 2026
algolia/api-clients-automation#6582 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-javascript
that referenced
this pull request
Jun 22, 2026
algolia/api-clients-automation#6582 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-kotlin
that referenced
this pull request
Jun 22, 2026
algolia/api-clients-automation#6582 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-php
that referenced
this pull request
Jun 22, 2026
algolia/api-clients-automation#6582 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-python
that referenced
this pull request
Jun 22, 2026
algolia/api-clients-automation#6582 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-ruby
that referenced
this pull request
Jun 22, 2026
algolia/api-clients-automation#6582 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-scala
that referenced
this pull request
Jun 22, 2026
algolia/api-clients-automation#6582 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
algolia-api-clients-automation-bot Bot
added a commit
to algolia/algoliasearch-client-swift
that referenced
this pull request
Jun 22, 2026
algolia/api-clients-automation#6582 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Algolia engine returns
nullentries in thegetObjectsresultsarray when a requestedobjectIDdoesn't exist in the index, but the spec typedresultsitems as non-null. This caused deserialization crashes in strongly-typed clients.Fixes algolia/algoliasearch-client-kotlin#427
Fixes algolia/algoliasearch-client-swift#892
Fixes algolia/algoliasearch-client-csharp#873
This is a spec issue: the contract didn't reflect the engine's actual behavior (verified against the AlgoliaSaaS engine, which explicitly pushes
nullfor missing objectIDs).Changes
getObjectsresultsitems asnullable: true(kept inline rather than theoneOf: [..., type: 'null']convention, because that convention is incompatible withx-is-genericβ it materializes a concreteGetObjectsResponseResultsInnermodel and drops the genericT).items.isNullable.List<Object>βList<Object?>).[]*map[string]anyback to[]map[string]any, since a map is already a nilable reference type (no breaking change vs current type).Resulting element types
resultselement typeList<JsonObject?>List[Optional[object]][]map[string]any(nil = null)[T?]List<T?>(T | null)[]List<Object?>Java, Scala, PHP, and Ruby are already null-tolerant at the type level, so no change is needed.