Serialization of optional types using typeAdapterFactory