Zod schema type inference while using serverless-auto-swagger

34 Views Asked by At

I'm introducing serverless-auto-swagger to generate docs for my API, and I'm already using Zod to validate and sanitize incoming data.

When I state a type, infered from a zod schema, in my docs, it appears as an empty object in the docs:

export const CheckUrlBodySchema = z.object({
    url: z.string().url(),
});

export type CheckUrlBody = z.infer<typeof CheckUrlBodySchema>;

enter image description here

The rest of the libraries to generate docs, require huge amounts of data to be added to each endpoint, which is not feasible for API with hundreds of endpoints, so I'd love to make this one work with zod.

0

There are 0 best solutions below