mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
Some checks failed
CodeQL Scan / Analyze (javascript-typescript) (push) Failing after 0s
Build Docker Images / lint (push) Failing after 6s
Build Docker Images / check (push) Failing after 6s
Build Docker Images / tests (push) Failing after 5s
Deploy Docs to GitHub Pages / build (push) Failing after 0s
Build Docker Images / build (server, Dockerfile, ${{ github.repository_owner }}/server) (push) Has been skipped
Build Docker Images / build (worker, Worker.Dockerfile, ${{ github.repository_owner }}/worker) (push) Has been skipped
Deploy Docs to GitHub Pages / Deploy (push) Has been skipped
Mirror to Codeberg / Mirror (push) Failing after 0s
Nix Build / check (push) Failing after 0s
23 lines
609 B
TypeScript
23 lines
609 B
TypeScript
import ISO6391 from "iso-639-1";
|
|
import { z } from "zod";
|
|
import "zod-openapi/extend";
|
|
|
|
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());
|