mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
22 lines
580 B
TypeScript
22 lines
580 B
TypeScript
import ISO6391 from "iso-639-1";
|
|
import { z } from "zod";
|
|
|
|
export const Id = z.string().uuid();
|
|
|
|
export const iso631 = z
|
|
.enum(ISO6391.getAllCodes() as [string, ...string[]])
|
|
.openapi({
|
|
description: "ISO 639-1 language code",
|
|
example: "en",
|
|
externalDocs: {
|
|
url: "https://en.wikipedia.org/wiki/List_of_ISO_639-1_language_codes",
|
|
},
|
|
ref: "ISO631",
|
|
});
|
|
|
|
export const zBoolean = z
|
|
.string()
|
|
.transform((v) => ["true", "1", "on"].includes(v.toLowerCase()))
|
|
.openapi({ type: "boolean" })
|
|
.or(z.boolean());
|