Skip to content

Commit

Permalink
Merge pull request #46 from ryanalbrecht/development
Browse files Browse the repository at this point in the history
Preserve case for ErrorMetadata structs.
  • Loading branch information
lmajano authored Nov 9, 2020
2 parents 4a546e4 + 82044e6 commit 3854be2
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion models/validators/AcceptedValidator.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ component accessors="true" singleton {
rejectedValue : ( isSimpleValue( arguments.targetValue ) ? arguments.targetValue : "" ),
validationData : arguments.validationData
};
var error = validationResult.newError( argumentCollection = args ).setErrorMetadata( { max : arguments.validationData } );
var error = validationResult.newError( argumentCollection = args ).setErrorMetadata( { 'max' : arguments.validationData } );
validationResult.addError( error );
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion models/validators/AlphaValidator.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ component accessors="true" singleton {
rejectedValue : ( isSimpleValue( arguments.targetValue ) ? arguments.targetValue : "" ),
validationData : arguments.validationData
};
var error = validationResult.newError( argumentCollection = args ).setErrorMetadata( { max : arguments.validationData } );
var error = validationResult.newError( argumentCollection = args ).setErrorMetadata( { 'max' : arguments.validationData } );
validationResult.addError( error );
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions models/validators/DiscreteValidator.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ component accessors="true" singleton {
var error = validationResult
.newError( argumentCollection = args )
.setErrorMetadata( {
operation : operation,
operationValue : operationValue
'operation' : operation,
'operationValue' : operationValue
} );
validationResult.addError( error );
}
Expand Down
2 changes: 1 addition & 1 deletion models/validators/MaxValidator.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ component accessors="true" singleton {
rejectedValue : ( isSimpleValue( arguments.targetValue ) ? arguments.targetValue : "" ),
validationData : arguments.validationData
};
var error = validationResult.newError( argumentCollection = args ).setErrorMetadata( { max : arguments.validationData } );
var error = validationResult.newError( argumentCollection = args ).setErrorMetadata( { 'max' : arguments.validationData } );
validationResult.addError( error );
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion models/validators/MinValidator.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ component accessors="true" singleton {
rejectedValue : ( isSimpleValue( arguments.targetValue ) ? arguments.targetValue : "" ),
validationData : arguments.validationData
};
var error = validationResult.newError( argumentCollection = args ).setErrorMetadata( { min : arguments.validationData } );
var error = validationResult.newError( argumentCollection = args ).setErrorMetadata( { 'min' : arguments.validationData } );
validationResult.addError( error );
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions models/validators/RangeValidator.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ component accessors="true" singleton {
var error = validationResult
.newError( argumentCollection = args )
.setErrorMetadata( {
range : arguments.validationData,
min : min,
max : max
'range' : arguments.validationData,
'min' : min,
'max' : max
} );
validationResult.addError( error );
return false;
Expand Down
2 changes: 1 addition & 1 deletion models/validators/RegexValidator.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ component accessors="true" singleton {
rejectedValue : ( isSimpleValue( arguments.targetValue ) ? arguments.targetValue : "" ),
validationData : arguments.validationData
};
var error = validationResult.newError( argumentCollection = args ).setErrorMetadata( { regex : arguments.validationData } );
var error = validationResult.newError( argumentCollection = args ).setErrorMetadata( { 'regex' : arguments.validationData } );
validationResult.addError( error );
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion models/validators/SameAsNoCaseValidator.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ component accessors="true" singleton {
rejectedValue : ( isSimpleValue( arguments.targetValue ) ? arguments.targetValue : "" ),
validationData : arguments.validationData
};
var error = validationResult.newError( argumentCollection = args ).setErrorMetadata( { sameas : arguments.validationData } );
var error = validationResult.newError( argumentCollection = args ).setErrorMetadata( { 'sameas' : arguments.validationData } );
validationResult.addError( error );
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion models/validators/SameAsValidator.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ component accessors="true" singleton {
rejectedValue : ( isSimpleValue( arguments.targetValue ) ? arguments.targetValue : "" ),
validationData : arguments.validationData
};
var error = validationResult.newError( argumentCollection = args ).setErrorMetadata( { sameas : arguments.validationData } );
var error = validationResult.newError( argumentCollection = args ).setErrorMetadata( { 'sameas' : arguments.validationData } );
validationResult.addError( error );
return false;
}
Expand Down
8 changes: 5 additions & 3 deletions models/validators/SizeValidator.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,21 @@ component accessors="true" singleton {
return true;
}
}

var args = {
message : "The '#arguments.field#' value is not in the required size range (#arguments.validationData#)",
field : arguments.field,
validationType : getName(),
rejectedValue : ( isSimpleValue( arguments.targetValue ) ? arguments.targetValue : "" ),
validationData : arguments.validationData
};

var error = validationResult
.newError( argumentCollection = args )
.setErrorMetadata( {
size : arguments.validationData,
min : min,
max : max
'size' : arguments.validationData,
'min' : min,
'max' : max
} );
validationResult.addError( error );
return false;
Expand Down
2 changes: 1 addition & 1 deletion models/validators/TypeValidator.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ component accessors="true" singleton {
rejectedValue : ( isSimpleValue( arguments.targetValue ) ? arguments.targetValue : "" ),
validationData : arguments.validationData
};
var error = validationResult.newError( argumentCollection = args ).setErrorMetadata( { type : arguments.validationData } );
var error = validationResult.newError( argumentCollection = args ).setErrorMetadata( { 'type' : arguments.validationData } );
validationResult.addError( error );
}

Expand Down

0 comments on commit 3854be2

Please sign in to comment.