Refactor JSONSchema handling code

This to better support both Draft 3 and Draft 4 simultaneously.

Additionally, we fix some bugs in the API v1 Schemas.

Change-Id: Iead88f0fb1320ef4ad545a2b66a53b82424c4b14
Merge "Refactor JSONSchema handling code"