Problem#
Standard Schema validators can return issue objects that cannot be serialized with JSON.stringify. This hides the original validation failure.
The same raw serialization pattern exists in server-function validation and router search validation.
Scope#
Create a shared internal formatter for Standard Schema issues and use it in both paths.
The formatter must:
- Preserve issue messages.
- Handle root and nested paths without ambiguous dot-path collisions.
- Safely handle prototype-named keys such as
__proto__.
- Avoid adding a public
router-core export unless there is a supported external use case.
Tests#
- Add unit coverage for root issues, nested paths, numeric keys, special property names, and non-serializable issue objects.
- Add E2E coverage for server-function validation using multiple Standard Schema-compatible libraries, as requested in #3708.
- Verify router search validation uses the same safe formatting behavior.
- Run the relevant React Start bundle-size scenario.
Documentation#
Review and update the validator documentation to describe Standard Schema compatibility and the resulting validation-error behavior where user-facing.
Related work#
Supersedes stale #3708 which should be updated for the current validation architecture and cover both server-function and router search validation.