I want to create objects that represent the data structures that are passed back and forth to a Restful service. 

1. There must be an obvious and direct relationship between the record as documented in the service, and the record as interacted with in the Scala code, e.g. `obj.id` means the `id` field of the object.
2. I'd like to be able to define what fields make up the record in a declarative way.
3. For each field, I'd like to be able to also declare attributes like required/optional, unique, data type, max length, min/max values, default values, etc, much like the definition of a table in SQL
4. `obj.json` returns the object serialized as a string in JSON format
5. `TypeCompanionObject.fromJson` returns an `obj` from the JSON string
6. I want to be able to define generic test cases that can be applied to any field of type String, or to any field that is marked Required, etc.

I initially tried using a simple case class and Genson to do the serialization and de-serialization. That took care of requirements 1, 2, 4, and 5. But it didn't really let me do 3 or 6. 

What's a good pattern that will meet all of my requirements?