Issue
While Elysia natively supports t.Ref for automatic reference tracking, third party libraries (e.g. zod, arktype) does not seem to be parsed correctly (since they have different init methods), and will be automatically expanded.
Have taken a look on oRPC, they implemented a ref-tracking system for zod but apparently does not support the Elysia way.
There does not seem to have an API/function for non-typebox types to register refs inside the system (or i couldve missed it)
Workaround
Now upon every generation, I have to run a script to automatically replace schemas of the same shape.
The script also contains a arktype converter. (may not cover all the cases) (which can be found here)
Also, be sure every model is registered in the models section of the elysia instance, or no schema will be generated
Issue
While Elysia natively supports t.Ref for automatic reference tracking, third party libraries (e.g. zod, arktype) does not seem to be parsed correctly (since they have different init methods), and will be automatically expanded.
Have taken a look on oRPC, they implemented a ref-tracking system for zod but apparently does not support the Elysia way.
There does not seem to have an API/function for non-typebox types to register refs inside the system (or i couldve missed it)
Workaround
Now upon every generation, I have to run a script to automatically replace schemas of the same shape.
The script also contains a arktype converter. (may not cover all the cases) (which can be found here)
Also, be sure every model is registered in the models section of the elysia instance, or no schema will be generated