You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(FieldValidator): add outputKey() for schema output key remapping
- Add outputKey(string $key) to allow schema fields to output under a different key
- AssociativeValidator and ObjectValidator use output key when assigning validated values
- Update llms.txt, docs (object-validation, validator-factory), CHANGELOG, ROADMAP
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
5
5
## [Unreleased]
6
6
7
7
### Added
8
+
-`outputKey(string $key)` on `FieldValidator` for schema fields: output validated values under a different key than the input field (e.g. input `service_id` -> output `service` after transform); works with `Validator::isAssociative()` and `Validator::isObject()`
**Schema fields only.** Emits the validated value under a different key than the input field. Only applies when the validator is used inside `Validator::isAssociative()` or `Validator::isObject()`.
Use `outputKey()` on schema fields to emit validated values under a different key than the input field. This is useful when the input uses snake_case or IDs while the output should use different property names (e.g. for API responses or after transforming IDs to entities).
0 commit comments