From e3780926f4d4c3b165bedcefac207a3ee32b6bf7 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Mon, 13 Oct 2025 10:01:58 +0000 Subject: [PATCH 1/4] Version bump --- box.json | 2 +- changelog.md | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/box.json b/box.json index 0a698ac..8e17938 100644 --- a/box.json +++ b/box.json @@ -1,7 +1,7 @@ { "name":"ColdBox Validation", "author":"Ortus Solutions ", - "version":"4.7.0", + "version":"4.8.0", "location":"https://downloads.ortussolutions.com/ortussolutions/coldbox-modules/cbvalidation/@build.version@/cbvalidation-@build.version@.zip", "slug":"cbvalidation", "type":"modules", diff --git a/changelog.md b/changelog.md index 8d79cf6..c9a6b20 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [4.7.0] - 2025-10-13 + ### Changed - `validateOrFail` now filters nested structs and arrays to only return keys matching constraints, not just top-level keys (PR #85) @@ -312,7 +314,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Create first module version -[unreleased]: https://github.com/coldbox-modules/cbvalidation/compare/v4.6.0...HEAD +[unreleased]: https://github.com/coldbox-modules/cbvalidation/compare/v4.7.0...HEAD +[4.7.0]: https://github.com/coldbox-modules/cbvalidation/compare/v4.6.0...v4.7.0 [4.6.0]: https://github.com/coldbox-modules/cbvalidation/compare/v4.5.0...v4.6.0 [4.5.0]: https://github.com/coldbox-modules/cbvalidation/compare/v4.4.0...v4.5.0 [4.4.0]: https://github.com/coldbox-modules/cbvalidation/compare/v4.3.1...v4.4.0 From f64c7b0342350a728decc50e72df0e50ad3f57e3 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Thu, 16 Oct 2025 15:22:54 -0700 Subject: [PATCH 2/4] Handle null values when filtering constraints --- models/ValidationManager.cfc | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/models/ValidationManager.cfc b/models/ValidationManager.cfc index 34d65d8..bd95b6c 100644 --- a/models/ValidationManager.cfc +++ b/models/ValidationManager.cfc @@ -327,11 +327,16 @@ component accessors="true" serialize="false" singleton { } var constraint = arguments.constraints[ key ]; - if ( constraint.keyExists( "items" ) || constraint.keyExists( "arrayItem" ) ) { + if ( + ( constraint.keyExists( "items" ) || constraint.keyExists( "arrayItem" ) ) && !isNull( + arguments.target[ key ] + ) && isArray( arguments.target[ key ] ) + ) { + var items = arguments.target[ key ]; var filteredArray = []; var arrayConstraints = ( constraint.keyExists( "items" ) ? constraint.items : constraint.arrayItem ); if ( arrayConstraints.keyExists( "constraints" ) || arrayConstraints.keyExists( "nestedConstraints" ) ) { - for ( var item in arguments.target[ key ] ) { + for ( var item in items ) { if ( isStruct( item ) ) { arrayAppend( filteredArray, @@ -345,10 +350,16 @@ component accessors="true" serialize="false" singleton { } } } else { - filteredArray = arguments.target[ key ]; + filteredArray = isNull( arguments.target[ key ] ) ? javacast( "null", "" ) : arguments.target[ + key + ]; } filteredTarget[ key ] = filteredArray; - } else if ( constraint.keyExists( "constraints" ) || constraint.keyExists( "nestedConstraints" ) ) { + } else if ( + ( constraint.keyExists( "constraints" ) || constraint.keyExists( "nestedConstraints" ) ) && !isNull( + arguments.target[ key ] + ) && isStruct( arguments.target[ key ] ) + ) { filteredTarget[ key ] = filterTargetForConstraints( target = arguments.target[ key ], constraints = ( @@ -356,7 +367,9 @@ component accessors="true" serialize="false" singleton { ) ); } else { - filteredTarget[ key ] = arguments.target[ key ]; + filteredTarget[ key ] = isNull( arguments.target[ key ] ) ? javacast( "null", "" ) : arguments.target[ + key + ]; } } return filteredTarget; From 425bcf0c6856c2bc47922ba040ce863d33886334 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Thu, 16 Oct 2025 15:29:28 -0700 Subject: [PATCH 3/4] Filter out null values --- models/ValidationManager.cfc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/models/ValidationManager.cfc b/models/ValidationManager.cfc index bd95b6c..469e009 100644 --- a/models/ValidationManager.cfc +++ b/models/ValidationManager.cfc @@ -354,7 +354,9 @@ component accessors="true" serialize="false" singleton { key ]; } - filteredTarget[ key ] = filteredArray; + if ( !isNull( filteredArray ) ) { + filteredTarget[ key ] = filteredArray; + } } else if ( ( constraint.keyExists( "constraints" ) || constraint.keyExists( "nestedConstraints" ) ) && !isNull( arguments.target[ key ] @@ -367,9 +369,9 @@ component accessors="true" serialize="false" singleton { ) ); } else { - filteredTarget[ key ] = isNull( arguments.target[ key ] ) ? javacast( "null", "" ) : arguments.target[ - key - ]; + if ( !isNull( arguments.target[ key ] ) ) { + filteredTarget[ key ] = arguments.target[ key ]; + } } } return filteredTarget; From db7308ad4aa08cf35cbe453f0dc30ffb37108ae4 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Fri, 17 Oct 2025 14:59:53 +0200 Subject: [PATCH 4/4] finalized for release --- .github/workflows/tests.yml | 30 ++++++++++++++---------------- changelog.md | 7 +++++++ readme.md | 12 ++++++++---- server-boxlang-cfml@be.json | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 20 deletions(-) create mode 100644 server-boxlang-cfml@be.json diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 37dcbbb..e2cde00 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,25 +18,27 @@ jobs: strategy: fail-fast: false matrix: - cfengine: [ "boxlang-cfml@1", "lucee@5", "lucee@6", "adobe@2023", "adobe@2025" ] - coldboxVersion: [ "^7.0.0" ] + cfengine: [ "boxlang-cfml@1", "lucee@5", "lucee@6", "adobe@2023", "adobe@2025" ] + coldboxVersion: [ "^7.0.0", "^8.0.0" ] experimental: [ false ] # Experimental: ColdBox BE vs All Engines include: - - coldboxVersion: "be" - cfengine: "lucee@5" - experimental: true - coldboxVersion: "be" cfengine: "lucee@6" experimental: true - coldboxVersion: "be" - cfengine: "adobe@2025" + cfengine: "adobe@2023" experimental: true - coldboxVersion: "be" cfengine: "boxlang-cfml@1" experimental: true - - coldboxVersion: "be" - cfengine: "boxlang@1" + # BoxLang PRIME with ColdBox 8 + - coldboxVersion: "8" + cfengine: "boxlang-cfml@1" + experimental: true + # BoxLang CFML BE with ColdBox 8 + - coldboxVersion: "8" + cfengine: "boxlang-cfml@be" experimental: true steps: - name: Checkout Repository @@ -88,16 +90,12 @@ jobs: mkdir -p test-harness/tests/results box testbox run --verbose outputFile=test-harness/tests/results/test-results outputFormats=json,antjunit - - name: Publish Test Reports - uses: mikepenz/action-junit-report@v5.6.2 + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 if: always() with: - report_paths: | - test-harness/tests/results/**/*.xml - check_name: "TestBox Report ${{ matrix.cfengine }}-${{ matrix.coldboxVersion }}" - include_passed: false - fail_on_failure: true - detailed_summary: true + junit_files: test-harness/tests/results/**/*.xml + check_name: "${{ matrix.cfengine }} ColdBox ${{ matrix.coldboxVersion }} Test Results" - name: Upload Test Results to Artifacts if: always() diff --git a/changelog.md b/changelog.md index c9a6b20..7748e5e 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Copilot instructions added. +- Null values are now properly filtered out when `validateOrFail` returns validated struct/array results +- Handle null values correctly when filtering constraints in nested structures and arrays +- GitHub Actions workflow fixes + ## [4.7.0] - 2025-10-13 ### Changed diff --git a/readme.md b/readme.md index ce292d3..38c99a5 100644 --- a/readme.md +++ b/readme.md @@ -33,7 +33,7 @@ Apache License, Version 2.0. - **BoxLang** 1.0+ (Preferred) - **Lucee** 5.x+ -- **Adobe ColdFusion** 2021+ +- **Adobe ColdFusion** 2023+ - **Dependencies**: ColdBox 7+, cbi18n 3.0+ ## Installation @@ -46,7 +46,11 @@ box install cbvalidation The module will register several objects into WireBox using the `@cbvalidation` namespace. The validation manager is registered as `ValidationManager@cbvalidation`. It will also register several helper methods that can be used throughout the ColdBox application: `validate(), validateOrFail(), getValidationManager()` -### WireBox Registrations +## Documentation + +This module is fully documented at: https://coldbox-validation.ortusbooks.com/. It also has an MCP server with live docs and examples. + +## WireBox Registrations - `ValidationManager@cbvalidation` - The core validation engine - `validationManager@cbvalidation` - Alias for convenience @@ -348,7 +352,7 @@ www.coldbox.org | www.luismajano.com | www.ortussolutions.com ******************************************************************************** ``` -### HONOR GOES TO GOD ABOVE ALL +## HONOR GOES TO GOD ABOVE ALL Because of His grace, this project exists. If you don't like this, then don't read it, its not for you. @@ -358,6 +362,6 @@ And not only so, but we glory in tribulations also: knowing that tribulation wor And patience, experience; and experience, hope: And hope maketh not ashamed; because the love of God is shed abroad in our hearts by the Holy Ghost which is given unto us. ." Romans 5:5 -### THE DAILY BREAD +## THE DAILY BREAD > "I am the way, and the truth, and the life; no one comes to the Father, but by me (JESUS)" Jn 14:1-12 diff --git a/server-boxlang-cfml@be.json b/server-boxlang-cfml@be.json new file mode 100644 index 0000000..19cb4a4 --- /dev/null +++ b/server-boxlang-cfml@be.json @@ -0,0 +1,32 @@ +{ + "name":"cbvalidation-boxlang-cfml@be", + "app":{ + "serverHomeDirectory":".engine/boxlang-cfml-be", + "cfengine":"boxlang@be" + }, + "web":{ + "http":{ + "port":"60299" + }, + "rewrites":{ + "enable":true + }, + "webroot":"test-harness", + "aliases":{ + "/moduleroot/cbvalidation":"../" + } + }, + "JVM":{ + "heapSize":"1024", + "javaVersion":"openjdk21_jre", + "args":"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8888" + }, + "openBrowser": false, + "cfconfig":{ + "file":".cfconfig.json" + }, + "env":{}, + "scripts":{ + "onServerInitialInstall":"install bx-compat-cfml,bx-esapi,bx-mysql --noSave" + } +}