Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Nested object in input #454

Open
RakeshPotnuru opened this issue Sep 11, 2024 · 1 comment
Open

Nested object in input #454

RakeshPotnuru opened this issue Sep 11, 2024 · 1 comment

Comments

@RakeshPotnuru
Copy link

Hi, nested object in input for GET method not working.

Example:

getAll: protectedProcedure
    .meta({
      openapi: {
        method: "GET",
        path: "/something/get-all",
        protect: true,
      },
    })
    .input(
      z.object({
        pagination: z.object({ // <--- Error: Input parser key: "pagination" must be ZodString, ZodNumber, ZodBoolean, ZodBigInt or ZodDate
          page: z.number().int().positive().default(1),
          limit: z.number().int().positive().default(10),
        }),
      }),
    )
@tristanz
Copy link

This is documented in the readme, but I agree it would be nice to try to have a mapping. These become query parameters, so you'll need to define a mapping to path.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants