Files
sendou.ink/app/features/articles/articles-schemas.server.ts
2026-08-21 17:36:48 +03:00

15 lines
352 B
TypeScript

import * as v from "valibot";
const authorName = v.pipe(v.string(), v.minLength(1));
const author = v.union([
authorName,
v.object({ name: authorName, link: v.pipe(v.string(), v.url()) }),
]);
export const articleDataSchema = v.object({
title: v.pipe(v.string(), v.minLength(1)),
author: v.union([author, v.array(author)]),
date: v.date(),
});