Skip to content

$ref parsing #328

@hexadecimal233

Description

@hexadecimal233

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions