Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deserialization failure for polymorphic (or sealed) classes #18

Closed
zigzago opened this issue Oct 11, 2020 · 0 comments
Closed

Deserialization failure for polymorphic (or sealed) classes #18

zigzago opened this issue Oct 11, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@zigzago
Copy link
Collaborator

zigzago commented Oct 11, 2020

with this bson:

{"_id":ObjectId(5d17ab793b4083d41f829821),"___type": "int-value", "value": 1}

and this class:


@Serializable
sealed class Value

@Serializable
@SerialName("int-value")
data class IntValue(val value: Int) : Value()

there is a failure during deserialization. This is because PolymorphismDecoder should use decodeSequentially at false and its decodeElementIndex should be updated to not infer that the discriminator property is always first.

I'm going to propose on a fix ;)

@zigzago zigzago added the bug Something isn't working label Oct 11, 2020
jershell added a commit that referenced this issue Oct 12, 2020
fixes #18 Deserialization failure for polymorphic class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant