Skip to content

Commit e2a18d6

Browse files
committed
Refine ROADMAP.md: Mark validation gaps as 'for consideration' and identify redundant methods
- Reorganized 'Real-World Validation Gaps' section as 'For Consideration' - Moved nullable() and optional() to 'Probably Redundant' section - Added rationale: both methods are redundant since everything is nullable/optional by default - Kept high-value methods like notEmpty(), in(), between(), filled(), when() for future consideration - Improved section organization and clarity for development prioritization
1 parent c3071f7 commit e2a18d6

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

ROADMAP.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,30 @@ This roadmap outlines the strategic development plan for future releases, priori
1616
- [x]**Comprehensive Documentation** - Complete API reference and practical examples
1717
- [x]**Comprehensive Test Suite** - 19 new tests (76 total) with 54 new assertions (208 total)
1818

19+
## 📋 Immediate Tasks (Documentation Gaps from Real-World Testing)
20+
21+
### Critical Documentation Updates
22+
- [ ] **Document `nullifyEmpty()` method** - Add to README, API reference, string/form guides (currently only in array guide)
23+
- [ ] **Add form handling examples** - Show `nullifyEmpty()` in real-world form validation scenarios
24+
- [ ] **Update getting started guides** - Include `nullifyEmpty()` in basic usage patterns
25+
26+
### Critical API Improvements
27+
- [ ] **Rename `addValidation()` to `validate()`** - Shorter, cleaner method name consistent with `transform()` pattern
28+
- [ ] **Make error message optional in `validate()`** - Add generic fallback message for better developer experience
29+
- [ ] **Update all documentation** - Replace `addValidation()` with `validate()` across all guides and examples
30+
31+
### Critical Bug Fixes
32+
- [ ] **Fix ObjectValidator null property handling** - `isset($validatedFieldValue)` excludes null properties from result object
33+
- Should return object with null properties, not empty object
34+
- AssociativeValidator works correctly, ObjectValidator has the bug
35+
- [ ] **Fix dangerous empty string coercion across all validators** - Make `coerce()` convert `''``null` (not 0/false) for form safety
36+
- IntValidator: `''``null` (not 0) - prevents dangerous zero defaults in forms
37+
- FloatValidator: `''``null` (not 0.0) - prevents dangerous zero defaults in forms
38+
- BoolValidator: `''``null` (not false) - empty query params should be null
39+
- This is a **BREAKING CHANGE** but critical for real-world form/API safety
40+
- [ ] **Add comprehensive tests for empty string handling** - Ensure all validators treat empty strings as "no value provided"
41+
- [ ] **Update documentation** - Explain the form-safety rationale behind empty string → null coercion
42+
1943
## 📋 Next Release (v0.5.0) - Utility Features
2044

2145
### String Enhancements
@@ -150,6 +174,7 @@ $stringValidator = Validator::isString()
150174
- [x]**`transform()`** / **`pipe()`** - Generic transformation methods (already implemented!)
151175
- [x]**`nullifyEmpty()`** - Convert empty arrays to null (already implemented!)
152176
- [x]**`filterEmpty()`** - Remove empty/null values and reindex automatically (already implemented!)
177+
- [ ] **Enhanced `filterEmpty(bool $filter = true)`** - Add boolean parameter for conditional filtering
153178

154179
### Removed from Scope
155180
- ~~`unique()`~~ - Use `array_unique()` or Laravel Collections (complex deduplication logic)
@@ -171,6 +196,9 @@ $stringValidator = Validator::isString()
171196
- ~~`round(precision)`~~ - Use `->pipe(fn($v) => round($v, $precision))` for clarity
172197

173198
### Universal Validators
199+
- [ ] **Enhanced `required(bool $required = true)`** - Add boolean parameter to override required state (validator reusability)
200+
- [ ] **Enhanced `coerce(bool $coerce = true)`** - Add boolean parameter to override coercion state (library flexibility)
201+
- [ ] **Enhanced `nullifyEmpty(bool $nullify = true)`** - Add boolean parameter to override nullification (form vs API patterns)
174202
- [ ] **`enum()`** - Validates value is one of predefined options (available on all validators)
175203
- [ ] **`const()`** - Validates value equals specific constant
176204

@@ -184,6 +212,18 @@ $stringValidator = Validator::isString()
184212
- [ ] **Structured error codes** - Programmatic error identification
185213
- [ ] **Error path enhancement** - Full field paths for nested validation errors
186214

215+
### Real-World Validation Gaps (For Consideration)
216+
- [ ] **`notEmpty()` method** - Explicit validation that value is not empty string/array (clearer than custom validation)
217+
- [ ] **`in()` alias for `oneOf()`** - More intuitive method name (`->in(['active', 'inactive'])`)
218+
- [ ] **`between(min, max)` for strings** - Length validation shorthand (`->between(3, 50)` instead of `->minLength(3)->maxLength(50)`)
219+
- [ ] **`between(min, max)` for numerics** - Range validation shorthand (`->between(1, 100)` instead of `->min(1)->max(100)`)
220+
- [ ] **`filled()` method** - Requires non-null AND non-empty (stricter than required())
221+
- [ ] **`when()` conditional validation** - Apply validation only when condition is met (`->when($userRole === 'admin', fn($v) => $v->required())`)
222+
223+
### Probably Redundant (Default Behavior)
224+
- [ ] ~~`optional()` method~~ - Redundant since everything is optional by default
225+
- [ ] ~~`nullable()` method~~ - Redundant since everything accepts null by default (unless required)
226+
187227
## 🏗️ Future Release (v0.6.0) - Advanced Schema Features
188228

189229
### Schema Composition

0 commit comments

Comments
 (0)