Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zod inferred object doesn't work as input #1497

Open
RichardPergament opened this issue Oct 17, 2024 · 0 comments
Open

Zod inferred object doesn't work as input #1497

RichardPergament opened this issue Oct 17, 2024 · 0 comments

Comments

@RichardPergament
Copy link

RichardPergament commented Oct 17, 2024

I'm getting "error: qualified name not yet supported" when attempting to define an input object via Zod. See example below.

const InputZod = z.object({
    name: z.string().min(1).max(100),
});

export type Input = z.infer<typeof InputZod>;

export interface Output {}

export const post = api(
    {
        expose: true,
        auth: true,
        method: 'POST',
        path: '/some-url',
    },
    async (input: Input): Promise<Output> => { api code... }
);

Not entirely sure what the error message means. Is this approach not supported yet or is it a bug?

Would be cool if it were supported to reduce the amount of boilerplate (repeated model definitions), but I can understand that if that is easier said than done :-)

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

No branches or pull requests

1 participant