feat(validation): check metadata JSON size

This patch also factor the de-serialized validation tests into a
separated module (which fixes the tests for mongo driver).

Change-Id: I46f0ac7df06ad2bf455073347392f7f4159449c9
Merge "feat(validation): check metadata JSON size"