From 906d123cb0bfbca25ad774758a1ecce3a40c0435 Mon Sep 17 00:00:00 2001 From: algolia-bot Date: Mon, 23 Sep 2024 21:14:59 +0000 Subject: [PATCH] fix(kotlin): deserialization (generated) https://github.com/algolia/api-clients-automation/pull/3822 Co-authored-by: algolia-bot Co-authored-by: Thomas Raffray --- .../scala/algoliasearch/recommend/RecommendationsHit.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/scala/algoliasearch/recommend/RecommendationsHit.scala b/src/main/scala/algoliasearch/recommend/RecommendationsHit.scala index 5a51670d..6c44c040 100644 --- a/src/main/scala/algoliasearch/recommend/RecommendationsHit.scala +++ b/src/main/scala/algoliasearch/recommend/RecommendationsHit.scala @@ -52,8 +52,9 @@ object RecommendationsHitSerializer extends Serializer[RecommendationsHit] { case (TypeInfo(clazz, _), json) if clazz == classOf[RecommendationsHit] => json match { - case value: JObject => Extraction.extract[TrendingFacetHit](value) - case _ => throw new MappingException("Can't convert " + json + " to RecommendationsHit") + case value: JObject if value.obj.exists(_._1 == "facetName") && value.obj.exists(_._1 == "facetValue") => + Extraction.extract[TrendingFacetHit](value) + case _ => throw new MappingException("Can't convert " + json + " to RecommendationsHit") } }