docs: function isInvalidScalarValueType(recordTypes, val, propDesc, forUpdate) {
  
  	switch (propDesc.scalarValueType) {
  	case 'string':
  		if ((val !== null) && ((typeof val) !== 'string'))
  			return 'expected string.';
  		break;
  	case 'number':
  		if ((val !== null) && (
  			(typeof val) !== 'number') || !Number.isFinite(val))
  			return 'expected number.';
  		break;
  	case 'boolean':
  		if ((val !== null) && ((typeof val) !== 'boolean'))
  			return 'expected boolean.';
  		break;
  	case 'datetime':
  		if ((val !== null) && !(val instanceof Date) && (
  			((typeof val) !== 'string') ||
  				!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/.test(val) ||
  				Number.isNaN(Date.parse(val))))
  			return 'expected Date or ISO 8601 string.';
  		break;
  	case 'ref':
  		if ((val !== null) && !isValidRefValue(recordTypes, val, propDesc))
  			return ('expected ' + propDesc.refTarget + ' reference.');
  		break;
  	case 'object':
  		if (val === null)
  			return 'unexpected null instead of an object.';
  		if (!isValidObjectValue(recordTypes, val, propDesc, forUpdate))
  			return 'expected matching object properties.';
  	}
  
  	return false;
  }