MCPcopy Create free account
hub / github.com/DanWahlin/CustomerManagerStandard / addValidators

Function addValidators

CustomerManager/Scripts/breeze.debug.js:7197–7218  ·  view source on GitHub ↗
(dataProperty)

Source from the content-addressed store, hash-verified

7195 }
7196
7197 function addValidators(dataProperty) {
7198 var typeValidator;
7199 if (!dataProperty.isNullable) {
7200 dataProperty.validators.push(Validator.required());
7201 }
7202
7203 if (dataProperty.isComplexProperty) return;
7204
7205 if (dataProperty.dataType === DataType.String) {
7206 if (dataProperty.maxLength) {
7207 var validatorArgs = { maxLength: dataProperty.maxLength };
7208 typeValidator = Validator.maxLength(validatorArgs);
7209 } else {
7210 typeValidator = Validator.string();
7211 }
7212 } else {
7213 typeValidator = dataProperty.dataType.validatorCtor();
7214 }
7215
7216 dataProperty.validators.push(typeValidator);
7217
7218 }
7219
7220 function isIdentityProperty(csdlProperty) {
7221 // see if web api feed

Callers 1

parseCsdlDataPropertyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected