Skip to content

Conversation

@debba
Copy link
Contributor

@debba debba commented Aug 22, 2025

What kind of change does this PR introduce? (pls check at least one)

  • Bugfix
  • [ x] Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe below

Description

Enhanced the Form validation system with a wildcard support for complex nested array structures. This enables validation of dynamic data like orders with variable products, user lists with different attributes, and other nested collections.

Real-world Use Cases

// E-commerce orders with variable products
$rules = [
    "orders.*.id" => "numeric",
    "orders.*.products.*.name" => "string",
    "orders.*.products.*.available" => "optional|boolean"
];

// User management with dynamic attributes
$rules = [
    "users.*.profile.*.key" => "string",
    "users.*.permissions.*" => "string"
];

// Categories with nested items and tags
$rules = [
    "categories.*.items.*.tags.*" => "string",
    "categories.*.metadata.*.value" => "optional|string"
];

Summary

  • Enhanced wildcard validation system to support complex nested array structures
  • Added handling for multiple wildcard levels and deeply nested data
  • Improved error reporting with accurate field path tracking
  • Added tests

debba added 2 commits August 22, 2025 12:42
  - Fix optional field validation to properly handle null, empty string, and empty array
  - Add explicit boolean value conversion to string for validation
  - Improve missing value detection with strict type checking
  - Implement validateWildcardPath() method for complex nested validation
  - Add support for multiple wildcard levels (field.*.subfield.*)
  - Enhance getValue/setValue methods with improved dot notation support
  - Add recursive wildcard handling for deeply nested structures
  - Improve error reporting with accurate field paths for wildcards
  - Maintain backward compatibility with existing validation patterns
  - Added tests
@debba debba changed the title Feat enhanced wildcard validation feat: enhanced wildcard validation Aug 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant