When i call both endpoins and my serializer looks ...
# ktor
m
When i call both endpoins and my serializer looks like this (check order )
Copy code
register(CocktailIngredientMatrix.serializer().list)
register(Ingredient.serializer().list)
I get error from
/cocktailIngredientMatrix
endpoint
RESPONSE <http://10.0.2.2:8080/cocktailIngredientMatrix> failed with exception: kotlinx.serialization.json.JsonDecodingException: Invalid JSON at 23: Encountered an unknown key cocktailID
When i change thh order to :
Copy code
register(Ingredient.serializer().list)
 register(CocktailIngredientMatrix.serializer().list)
I get following error :
RESPONSE <http://10.0.2.2:8080/ingredients> failed with exception: kotlinx.serialization.json.JsonDecodingException: Invalid JSON at 41: Encountered an unknown key name
e
Hi @martin.petrulak, could you check the content of json?
m
Hey sure, i mean , code works if i have registered only one resializer. So if i call
/ingredients
and only
Ingredient
serializer is registered code works. Same goes for
/cocktailIngredientMatrix
, it works ,if i have registered only
CocktailIngredientMatrix
serializer. In scenario when i want to hit both enpoints -> i need both serializers to be registered, one of them throw an exception. Wierd thing is that when i change the order of how i register the serializer, the one that did not worked works, and the one that worked doesnt work
e
Yep, it looks like an issue. We deprecated
registerSerializer
because of
typeOf
m
what woudl be the correct way of doing it ?
@e5l so for the time being, i am just creating multiple instances of
HttpClient
, is there any issu tracker ticket that i can follow?