Skip to content

Conversation

@volodymyr-kushnir
Copy link

@volodymyr-kushnir volodymyr-kushnir commented Oct 22, 2025

This fixes a nesting issue I've originally hit with the ajv resolver (albeit the issue itself is applicable to all resolvers) which is that toNestErrors may lose keys depending on the order of the keys returned by the parseErrorSchema, e.g. in this particular example the error for the config is actually last (the console output of parsedErrors is sorted thus a bit misleading) and simply replaces the config: { type: …, userId: … } object that existed one nesting step earlier —

image

I was explaining this to my coworkers so I have a screencast (100 seconds) that illustrates the issue, attaching it here in hope that it'd explain the changes behind the PR better than my writing —

resolvers.mp4

Also I was not very comfortable with passing the objects straight to Object.assign, I think I've hit a bug with objects being mutated in place, so even though I can no longer reproduce it I've still wrapped "foreign" objects in a structuredClone, just to be on a safe side.

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