Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
lmajano committed Nov 9, 2020
2 parents cc27fdc + 973861c commit bf01754
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ sudo: required
before_install:
# CommandBox Keys
- curl -fsSl https://downloads.ortussolutions.com/debs/gpg | sudo apt-key add -
- sudo echo "deb http://downloads.ortussolutions.com/debs/noarch /" | sudo tee -a
- sudo echo "deb https://downloads.ortussolutions.com/debs/noarch /" | sudo tee -a
/etc/apt/sources.list.d/commandbox.list

install:
Expand Down Expand Up @@ -112,7 +112,7 @@ deploy:
edge: true
file_glob: true
file: $TRAVIS_BUILD_DIR/.artifacts/$MODULE_ID/**/*
release_notes_file: changelog.md
release_notes_file: $TRAVIS_BUILD_DIR/changelog-latest.md
name: v${TRAVIS_TAG}
tag_name: v${TRAVIS_TAG}
overwrite: true
Expand Down
2 changes: 1 addition & 1 deletion box.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name":"ColdBox Validation",
"author":"Ortus Solutions <[email protected]>",
"version":"2.2.0",
"version":"2.3.0",
"location":"https://downloads.ortussolutions.com/ortussolutions/coldbox-modules/cbvalidation/@build.version@/[email protected]@.zip",
"slug":"cbvalidation",
"type":"modules",
Expand Down
28 changes: 26 additions & 2 deletions build/Build.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ component{
docs( argumentCollection=arguments );

// checksums
buildChecksums();
buildChecksums();

// Build latest changelog
latestChangelog();

// Finalize Message
print.line()
Expand Down Expand Up @@ -195,7 +198,28 @@ component{
overwrite=true,
recurse=true
);
}
}

/**
* Build the latest changelog file: changelog-latest.md
*/
function latestChangelog(){
print.blueLine( "Building latest changelog..." ).toConsole();

if( !fileExists( variables.cwd & "changelog.md" ) ){
return error( "Cannot continue building, changelog.md file doesn't exist!" );
}

fileWrite(
variables.cwd & "changelog-latest.md",
fileRead( variables.cwd & 'changelog.md' ).split( '----' )[2].trim() & chr( 13 ) & chr( 10 )
);

print
.greenLine( "Latest changelog file created at `changelog-latest.md`" )
.line()
.line( fileRead( variables.cwd & "changelog-latest.md" ) );
}

/********************************************* PRIVATE HELPERS *********************************************/

Expand Down
14 changes: 14 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

----

## [2.3.0] => 2020-NOV-09

### Added

* New github latest changelog publish
* Quote all memento keys so they can preserve their casing
* Quote all metadata keys so they can preserve their casing

### Fixed

* Metadata for validations so the docs can be generated correctly

----

## [2.2.0] => 2020-JUN-02

### Added
Expand Down
12 changes: 6 additions & 6 deletions models/result/ValidationError.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ component accessors="true" {
*/
struct function getMemento(){
return {
message : message,
field : field,
rejectedValue : rejectedValue,
validationType : validationType,
validationData : validationData,
errorMetadata : errorMetadata
"message" : message,
"field" : field,
"rejectedValue" : rejectedValue,
"validationType" : validationType,
"validationData" : validationData,
"errorMetadata" : errorMetadata
};
}

Expand Down
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
10 changes: 5 additions & 5 deletions models/validators/MethodValidator.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ component accessors="true" singleton {
/**
* Will check if an incoming value validates
*
* @validationResultThe result object of the validation
* @targetThe target object to validate on
* @fieldThe field on the target object to validate on
* @targetValueThe target value to validate
* @validationDataThe validation data the validator was created with
* @validationResult The result object of the validation
* @target The target object to validate on
* @field The field on the target object to validate on
* @targetValue The target value to validate
* @validationData The validation data the validator was created with
*/
boolean function validate(
required any validationResult,
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 bf01754

Please sign in to comment.