codahale/jerkson — Issue #36: EitherDeserializer is "weird"
Author: endarkenj
Created: 2011-10-28 22:53:08+00:00
State: open

Currently, the deserializer assumes the value is a Left(_) and simply surrounds it with try {} catch { Right(_) }.

This goes against the common use of Either (as documented in the scaladocs):
Represents a value of one of two possible types (a disjoint union). The data constructors Left and Right represent the two possible values. The Either type is often used as an alternative to Option where Left represents failure (by convention) and Right is akin to Some.

The most common case is: Either[Throwable, T] so this deserializer is essentially backwards from the common case; however, I think it would be good to deserialize it using some kind of meta-data to ensure that you get the expected Left/Right.