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

Cannot handle optional values #8

Open
ukayani opened this issue Jul 23, 2018 · 0 comments
Open

Cannot handle optional values #8

ukayani opened this issue Jul 23, 2018 · 0 comments

Comments

@ukayani
Copy link

ukayani commented Jul 23, 2018

Hi,

if I have the following case class:

case class Foo(a: String, b: Option[Int])

If i read a message pack encoded byte array which is equivalent to the following json (not encoded with msgpack4z):

{ "a": "test" }

I get a unpack error. Since the case class map codec looks for the presence of each key and fails if any key is not present.

It seems that the optionCodec expects the message pack encoded data to include the key regardless of whether there is a value for it or not.

Aside from writing my own case class codec, is there a way to handle unpacking such types?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant