Sorry, I pressed "send" to quickly.
In my case, what I am doing, (I insist I am a beginner) is as follows:
- Json comes in the request
- When the validation is simple (for example, a filed is optional or must be a number, etc) I validate it using the
Json Reads validation - The rest of validation I am doing it in the apply method of my companion object
object Something {
def apply(ar1: Int, ar2: String...) = {
assert(ar1 < 500)
assert (ar2 contains ("hello"))
....
}
}
That would be an example, in case it helps.
Miguel