Files
zero-fucks-given/apps/backend/app/base_modules/WebManager/validator/schemas.ts
T

33 lines
711 B
TypeScript

import { jsonObjectSchema } from '#validators/schemas/json_object_schema'
import vine from '@vinejs/vine'
export const localeSchema = vine
.string()
.trim()
.minLength(2)
.maxLength(16)
.regex(/^[a-z]{2,3}(?:-[A-Z]{2})?$/)
export const pathSchema = vine
.string()
.trim()
.maxLength(2048)
.regex(/^(?:(?:[a-z0-9]+(?:-[a-z0-9]+)*)(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*)?$/)
export const groupKeySchema = vine
.string()
.trim()
.minLength(1)
.maxLength(255)
.regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/)
export const componentSchema = vine.object({
type: vine
.string()
.trim()
.minLength(1)
.maxLength(100)
.regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
data: jsonObjectSchema,
})