Repository navigation
fix(specs): add searchResponsePartial fallback to searchResult oneOf - #6350
Merged
Merged
Conversation
When responseFields strips required fields like hits, neither the searchResponse (discriminator: hits) nor searchForFacetValuesResponse (discriminator: facetHits) variant matches, causing deserialization to throw across all languages. Add a third oneOf variant (searchResponsePartial) with all search response properties but no required fields. Since it has no required fields, the generator cannot infer discriminators for it, so sortOneOfs places it last as an unconditional catch-all. Fixes API-464
Contributor
✔️ Code generated!
📊 Benchmark resultsBenchmarks performed on the method using a mock server, the results might not reflect the real-world performance.
|
Up to standards ✅🟢 Issues
|
This was referenced May 22, 2026
eric-zaharia
approved these changes
May 26, 2026
algolia-bot
added a commit
that referenced
this pull request
May 26, 2026
…6350) (generated) [skip ci] Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-bot
added a commit
to algolia/algoliasearch-client-csharp
that referenced
this pull request
May 26, 2026
…(generated) algolia/api-clients-automation#6350 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-bot
added a commit
to algolia/algoliasearch-client-dart
that referenced
this pull request
May 26, 2026
…(generated) algolia/api-clients-automation#6350 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-bot
added a commit
to algolia/algoliasearch-client-go
that referenced
this pull request
May 26, 2026
…(generated) algolia/api-clients-automation#6350 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-bot
added a commit
to algolia/algoliasearch-client-java
that referenced
this pull request
May 26, 2026
…(generated) algolia/api-clients-automation#6350 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-bot
added a commit
to algolia/algoliasearch-client-javascript
that referenced
this pull request
May 26, 2026
…(generated) algolia/api-clients-automation#6350 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-bot
added a commit
to algolia/algoliasearch-client-kotlin
that referenced
this pull request
May 26, 2026
…(generated) algolia/api-clients-automation#6350 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-bot
added a commit
to algolia/algoliasearch-client-php
that referenced
this pull request
May 26, 2026
…(generated) algolia/api-clients-automation#6350 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-bot
added a commit
to algolia/algoliasearch-client-python
that referenced
this pull request
May 26, 2026
…(generated) algolia/api-clients-automation#6350 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-bot
added a commit
to algolia/algoliasearch-client-ruby
that referenced
this pull request
May 26, 2026
…(generated) algolia/api-clients-automation#6350 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-bot
added a commit
to algolia/algoliasearch-client-scala
that referenced
this pull request
May 26, 2026
…(generated) algolia/api-clients-automation#6350 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@users.noreply.github.com>
algolia-bot
added a commit
to algolia/algoliasearch-client-swift
that referenced
this pull request
May 26, 2026
…(generated) algolia/api-clients-automation#6350 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com> Co-authored-by: Eric Zaharia <94015633+eric-zaharia@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
searchResponsePartialschema as a thirdoneOfvariant insearchResultresponseFieldsstrips required fields likehitsContext
#6199 auto-infers discriminator fields from unique required properties. For
searchResult, this givessearchResponseahitsdiscriminator andsearchForFacetValuesResponsekeeps its explicitfacetHitsdiscriminator.When a user sets
responseFieldsto a subset excludinghits(e.g.["nbHits"]), the API returns a valid search response withouthits. Both discriminator checks fail → deserialization throwsInvalidDataException. Affects all languages with discriminator-guarded oneOf deserialization.Fix
searchResponsePartialhas the same properties assearchResponse(baseSearchResponse+SearchPagination+ hits/query/params/extensions) but no required fields. SinceinferDiscriminatorFieldscan't compute unique required fields for it, no discriminator is inferred.sortOneOfsplaces it last (variants with discriminators sort first).Deserialization order becomes:
searchForFacetValuesResponse— discriminatorfacetHits→ tried firstsearchResponse— discriminatorhits→ tried secondsearchResponsePartial— no discriminator → unconditional catch-allNo generator changes needed.
References