File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -305,6 +305,19 @@ component accessors="true" serialize="false" singleton {
305305 return filterTargetForConstraints ( arguments .target , constraints );
306306 }
307307
308+ /**
309+ * Recursively filters the given target structure or object according to the provided constraints.
310+ *
311+ * This method processes the target and returns a new structure containing only the keys that exist in the constraints.
312+ * It handles nested constraints (via "constraints" or "nestedConstraints" keys) and array item constraints (via "items" or "arrayItem" keys)
313+ * by recursively filtering nested objects and arrays as needed.
314+ *
315+ * @target The target structure or object to filter. Can be a struct or an object containing fields to validate.
316+ * @constraints The structure of constraints to use for filtering the target. Keys correspond to fields in the target.
317+ *
318+ * @return struct: A new structure containing only the fields from the target that match the provided constraints,
319+ * with nested structures and arrays filtered recursively as specified by the constraints.
320+ */
308321 private any function filterTargetForConstraints ( required any target , required struct constraints ){
309322 var filteredTarget = {};
310323 for ( var key in arguments .target ) {
You can’t perform that action at this time.
0 commit comments