zod-express-middleware icon indicating copy to clipboard operation
zod-express-middleware copied to clipboard

Express middleware to validate requests using zod schema's.

Results 15 zod-express-middleware issues
Sort by recently updated
recently updated
newest added

``` import express from "express" import { z } from "zod" const expressApp = express() expressApp.use(express.json()) ``` otherwise POST body req validation will not work in the readme there are...

Hello, In my projects I need to improve the typings as is does not always conform to what we get. For instance using the schema: ```typescript z.object({ value: z.number().default(10), })...

I have a validation schema for the `limit` parameter, which has a default value: ```ts const limitParam = z.number().min(0).optional().default(10) ``` The middleware validates this parameter in the query, but it...

If you use a date type in your zod schema as follows it will always fail validation, because JSON does not have date type, only strings, and zod will always...

In my query params, there is only one field I would like to modify, however if i define my schema in the form of the following: ```ts export const schema=...

Example below works: ```ts const app = express(); const params = z.object({ num: z.string(), }) app.get('/', validateRequestParams(params), async (req, res, next) => { req.params.num }); ``` However, when I add...

Hello, love the library, it became one of the pillars for my express application because of it's ability to infer request data types. But obviously I wouldn't be here if...

Hi, thanks for this package, it's really useful. I currently have the following example endpoints: ``` router.post("/", middleware.validator(schema.create), middleware.auth(), async (req, res) => {}); and router.post("/", middleware.validator(schema.create), async (req, res)...

> However, if the code for your endpoint is in a separate file, typings will not be automatically available. This is where the TypedRequest, TypedRequestBody etc. types come in: the...