From 8ac30a3b82cc01a76ce8284ab6e33c1245c34314 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Tue, 2 Jun 2020 12:32:48 -0500 Subject: [PATCH 1/7] version bump --- box.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/box.json b/box.json index f23e62c..3a1f1b0 100644 --- a/box.json +++ b/box.json @@ -1,7 +1,7 @@ { "name":"ColdBox Validation", "author":"Ortus Solutions ", - "version":"2.2.0", + "version":"2.3.0", "location":"https://downloads.ortussolutions.com/ortussolutions/coldbox-modules/cbvalidation/@build.version@/cbvalidation-@build.version@.zip", "slug":"cbvalidation", "type":"modules", From 5b78fece0e2751440ff053d6d62b7a5b54b1753d Mon Sep 17 00:00:00 2001 From: Samuel Knowlton Date: Wed, 17 Jun 2020 15:28:21 -0500 Subject: [PATCH 2/7] Fix annotations on validate() Add spaces between argument names and text --- models/validators/MethodValidator.cfc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/models/validators/MethodValidator.cfc b/models/validators/MethodValidator.cfc index 682b40d..54970e1 100644 --- a/models/validators/MethodValidator.cfc +++ b/models/validators/MethodValidator.cfc @@ -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, From dbe85dfc1e6a62d14b9c5ec3cd82bd51c4b4eada Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Wed, 17 Jun 2020 23:35:23 -0600 Subject: [PATCH 3/7] Quote memento keys Technically this is a breaking change since any people who have used this in JavaScript land or in an API would now have different key casing, but I think it's the right move for the future. --- models/result/ValidationError.cfc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/models/result/ValidationError.cfc b/models/result/ValidationError.cfc index 04d6c41..ceff2bf 100644 --- a/models/result/ValidationError.cfc +++ b/models/result/ValidationError.cfc @@ -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 }; } From 4a546e49e678b0c2b6d31371540c3333be1334b9 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 9 Jul 2020 12:01:38 -0500 Subject: [PATCH 4/7] latest changelogs --- build/Build.cfc | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/build/Build.cfc b/build/Build.cfc index 20d86e4..cf74dff 100644 --- a/build/Build.cfc +++ b/build/Build.cfc @@ -70,7 +70,10 @@ component{ docs( argumentCollection=arguments ); // checksums - buildChecksums(); + buildChecksums(); + + // Build latest changelog + latestChangelog(); // Finalize Message print.line() @@ -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 *********************************************/ From db91c1b7cbe0086940823281bbd2e2d69e53f92d Mon Sep 17 00:00:00 2001 From: ryanalbrecht Date: Mon, 2 Nov 2020 08:51:29 -0600 Subject: [PATCH 5/7] Preserve case for ErrorMetadata structs. --- models/validators/AcceptedValidator.cfc | 2 +- models/validators/AlphaValidator.cfc | 2 +- models/validators/MaxValidator.cfc | 2 +- models/validators/MinValidator.cfc | 2 +- models/validators/RangeValidator.cfc | 6 +++--- models/validators/RegexValidator.cfc | 2 +- models/validators/SameAsNoCaseValidator.cfc | 2 +- models/validators/SameAsValidator.cfc | 2 +- models/validators/SizeValidator.cfc | 8 +++++--- models/validators/TypeValidator.cfc | 2 +- 10 files changed, 16 insertions(+), 14 deletions(-) diff --git a/models/validators/AcceptedValidator.cfc b/models/validators/AcceptedValidator.cfc index be5527a..ebf2d6c 100644 --- a/models/validators/AcceptedValidator.cfc +++ b/models/validators/AcceptedValidator.cfc @@ -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; } diff --git a/models/validators/AlphaValidator.cfc b/models/validators/AlphaValidator.cfc index e4b870c..5f32580 100644 --- a/models/validators/AlphaValidator.cfc +++ b/models/validators/AlphaValidator.cfc @@ -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; } diff --git a/models/validators/MaxValidator.cfc b/models/validators/MaxValidator.cfc index eeeecb0..8b5e7f8 100644 --- a/models/validators/MaxValidator.cfc +++ b/models/validators/MaxValidator.cfc @@ -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; } diff --git a/models/validators/MinValidator.cfc b/models/validators/MinValidator.cfc index 77fa633..c454874 100644 --- a/models/validators/MinValidator.cfc +++ b/models/validators/MinValidator.cfc @@ -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; } diff --git a/models/validators/RangeValidator.cfc b/models/validators/RangeValidator.cfc index 63d4029..235f1a2 100644 --- a/models/validators/RangeValidator.cfc +++ b/models/validators/RangeValidator.cfc @@ -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; diff --git a/models/validators/RegexValidator.cfc b/models/validators/RegexValidator.cfc index 627b6f4..562fb21 100644 --- a/models/validators/RegexValidator.cfc +++ b/models/validators/RegexValidator.cfc @@ -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; } diff --git a/models/validators/SameAsNoCaseValidator.cfc b/models/validators/SameAsNoCaseValidator.cfc index c495644..f09b418 100644 --- a/models/validators/SameAsNoCaseValidator.cfc +++ b/models/validators/SameAsNoCaseValidator.cfc @@ -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; } diff --git a/models/validators/SameAsValidator.cfc b/models/validators/SameAsValidator.cfc index 6d4ee77..05b053a 100644 --- a/models/validators/SameAsValidator.cfc +++ b/models/validators/SameAsValidator.cfc @@ -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; } diff --git a/models/validators/SizeValidator.cfc b/models/validators/SizeValidator.cfc index 8e881ad..5074498 100644 --- a/models/validators/SizeValidator.cfc +++ b/models/validators/SizeValidator.cfc @@ -92,6 +92,7 @@ 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, @@ -99,12 +100,13 @@ component accessors="true" singleton { 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; diff --git a/models/validators/TypeValidator.cfc b/models/validators/TypeValidator.cfc index fb22d13..da5ce6a 100644 --- a/models/validators/TypeValidator.cfc +++ b/models/validators/TypeValidator.cfc @@ -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 ); } From 82044e6a67067c2c9fe158bbf22721da356dd2d8 Mon Sep 17 00:00:00 2001 From: ryanalbrecht Date: Mon, 2 Nov 2020 09:00:33 -0600 Subject: [PATCH 6/7] preserve key case for DiscreteValidator --- models/validators/DiscreteValidator.cfc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/validators/DiscreteValidator.cfc b/models/validators/DiscreteValidator.cfc index e734d77..81d4dd1 100644 --- a/models/validators/DiscreteValidator.cfc +++ b/models/validators/DiscreteValidator.cfc @@ -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 ); } From 973861c5fbfd2c878d183b6790d5ede0157a28ff Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Mon, 9 Nov 2020 09:41:30 -0600 Subject: [PATCH 7/7] * 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 --- .travis.yml | 4 ++-- changelog.md | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f3890e9..0822862 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: @@ -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 diff --git a/changelog.md b/changelog.md index 2dffbae..9682104 100644 --- a/changelog.md +++ b/changelog.md @@ -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