easy-express-cwa
Version:
CLI tool to setup a common Express.js backend developed by codewithashim
27 lines (23 loc) • 524 B
text/typescript
import { z } from "zod";
const createExampleZodSchema = z.object({
body: z.object({
title: z.string({
required_error: "Title is required",
}),
description: z.string({
required_error: "Description is required",
}),
}),
});
const updateExampleZodSchema = z.object({
body: z
.object({
title: z.string().optional(),
description: z.string().optional(),
})
.optional(),
});
export const createExampleValidator = {
createExampleZodSchema,
updateExampleZodSchema,
};