Happy Sunday, guys,
For a couple years now I've enjoyed Salat's beautiful "invisible-ness". It's just so good at what it does.
The one thing that's stuck in my craw (Texas-ism) was that it couldn't handle nested Lists, Options, or Maps. So if I had a domain object like the one below, I'd basically be out of luck.
case class Foo (
something : Map[ String, List[User] ]
)
I'd need to wrap my List[User] in another case class:
case class Foo (
something : Map[ String, UserHolder ]
)
case class UserHolder (
users : List[User]
)
Then all would be well. Works just fine, but... a bit convoluted, and can actually be a real problem if you need to match up to existing JSON that models the unwrapped Map.
Well one day a few weeks ago I had more time than good sense, so I started adding nesting to Salat, and today I finished my first attempt at it. (I'm still amazed, looking at the "successful" message on my unit tests!) I tested a bunch of combinations to/from JSON, and going to/from Mongo (they're actually handled slightly differently in the code).
I wouldn't hook up my life support system to this code any time soon, but the potential of this enhancement is pretty compelling! I have a couple of projects that really need this.
(BTW, there are 3 "OK" unit test failures if you build the code. They have nothing to do with these new enhancements. They come from my older mod that tweaks how JSON _id fields are handled, and is different than stock repo build. The code is right, per my id change. I just haven't fixed the unit tests to reflect it. But do be aware my salat version handles JSON id fields differently--it retains the case class' field name, not "_id", if going to JSON, but uses "_id" if going to Mongo.)