Javascript object validation using schemas