This repository was archived by the owner on Nov 30, 2025. It is now read-only.
Repository navigation
How to set the descriptor for deserializers that accept different representations for a data object? #787
Unanswered
sschuberth
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I've written a deserializer that, in short, accepts both
and
In both cases the result object is
The
deserialize()code isBy experimenting, I found out that in order for the deserialization process to not fail even before the above
deserialize()is called, I need to set thedescriptortoHowever, that code has some issues:
buildSerialDescriptoris internal API and should not be used anymore.SerialKind.CONTEXTUALis wrong as it's not a contextual serializer how KxS defines it, meaning that a serializer would be selected at runtime and be configured as part ofSerializersModule.Actually, my understanding of the
descriptoris that it should describe the structure of the type produced by this (de-)serializer, and not all possible input "shapes". So in this case, I would only need to describe theDescriptiontype, i.e. I should be able to use thedescriptorof the generated serializer for that class via delegation.However, if I do so, I get this error
and the
deserialize()function is not even called.Any hints what's going on here? Is my understanding of the purpose of the
descriptorwrong? How can I get rid of the need for the internalbuildSerialDescriptor?Thanks for any insights!
All reactions