Closed joanrieu closed 1 year ago
Thanks for the detailed report and fix 😊, I'll create a release with the fix shortly
If you have a recursive schema, this change causes warnings Recursive reference detected at #<path>! Defaulting to any
to appear.
My schema doesn't cause the problems mentioned in #43, so I made a PR to override the $refStrategy
workaround https://github.com/iway1/trpc-panel/pull/98
Hello, thanks for this library, it's great!
I recently encountered a bug related to form validation when trying to submit a mutation. The bug makes it fail (the request never gets sent to the server). It looks like the generated JSON Schema $refs are improperly resolved.
It occurs when the zod-to-json-schema library used behind the scenes decides to emit a $ref to a previous property's type while declaring one that shares the same type. It does that to prevent duplication, but somehow $ref paths are seen as invalid during trpc-panel's validation before sending a request.
An example of this can be seen in bug report #43.
A workaround is to make the zod-to-json-schema library avoid emitting $refs.
For others potentially facing the issue, I worked around it by using the following patch through pnpm's patch system:
package.json
:trpc-panel@1.3.2.patch
: