@featurevisor/core
Version:
Core package of Featurevisor for Node.js usage
31 lines (26 loc) • 714 B
text/typescript
import { z } from "zod";
export function getAttributeZodSchema() {
const propertySchema = z.object({
type: z.enum([
"boolean",
"string",
"integer",
"double",
"date",
"semver",
"array",
// @NOTE: intentionally ignored for now to not allow nesting
// "object",
]),
description: z.string().optional(),
});
const attributeZodSchema = z
.object({
archived: z.boolean().optional(),
type: z.enum(["boolean", "string", "integer", "double", "date", "semver", "object", "array"]),
description: z.string(),
properties: z.record(z.string(), propertySchema).optional(),
})
.strict();
return attributeZodSchema;
}