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

Reading enums is broken #13

Open
matejdro opened this issue Jan 14, 2020 · 0 comments
Open

Reading enums is broken #13

matejdro opened this issue Jan 14, 2020 · 0 comments

Comments

@matejdro
Copy link

matejdro commented Jan 14, 2020

Expected behaviour

MoshiPack should decode TestClass that contains an enum without issues.

Actual behaviour

Unpacking crashes with com.squareup.moshi.JsonDataException: Required value 'number' missing at $

Steps to reproduce behaviour

enum class TestEnum { A, B }
data class TestClass(val data: TestEnum, val number: Int)

val moshiPack = MoshiPack()
val buffer = Buffer()
buffer.writeAll(moshiPack.pack(TestClass(TestEnum.A, 12)))
println(moshiPack.unpack<TestClass>(buffer))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant