+- **Open decision — path encoding (revisit before v1.0).** `ValidationError` stores the path as a dotted string, built by string concatenation in `withPathPrefix()`. That encoding is lossy: a literal key containing a dot (`'user.name'`) is indistinguishable from nesting, an empty-string schema key composes a leading-dot path (`.hidden`, special-cased in the `getErrors('')` guard), and `items.0.name` cannot distinguish array index `0` from string key `'0'`. Zod keeps a segment array (`['user', 'name']`) as the source of truth and derives the string view; we do the inverse, so segments are unrecoverable and a future `getSegments()` could never be correct for dotted keys. Two acceptable resolutions, decide one before freezing the contract: (a) store `array $segments` internally, prepend segments in `withPathPrefix()`, keep `getPath()` returning the dot-joined string unchanged — public API identical, filtering becomes exact, leaves room for an additive `getSegments()` post-1.0; or (b) declare literal dotted keys out of scope for a form/API validator and document the limitation (`llms.txt`). The dotted-string _view_ stays the primary API either way (it maps onto HTML input names, Laravel/Symfony error keys, and JS property access); the decision is only about what is stored underneath.
0 commit comments