mirror of
https://github.com/versia-pub/server.git
synced 2026-04-28 05:09:16 +02:00
refactor: ⬆️ Upgrade to Zod v4 and hono-openapi 0.5.0
This commit is contained in:
parent
add2429606
commit
24d4150da4
209 changed files with 1331 additions and 1622 deletions
|
|
@ -1,22 +1,17 @@
|
|||
import ISO6391 from "iso-639-1";
|
||||
import { z } from "zod";
|
||||
import "zod-openapi/extend";
|
||||
import { z } from "zod/v4";
|
||||
|
||||
export const Id = z.string().uuid();
|
||||
export const Id = z.uuid();
|
||||
|
||||
export const iso631 = z
|
||||
.enum(ISO6391.getAllCodes() as [string, ...string[]])
|
||||
.openapi({
|
||||
.meta({
|
||||
description: "ISO 639-1 language code",
|
||||
example: "en",
|
||||
externalDocs: {
|
||||
url: "https://en.wikipedia.org/wiki/List_of_ISO_639-1_language_codes",
|
||||
},
|
||||
ref: "ISO631",
|
||||
id: "ISO631",
|
||||
});
|
||||
|
||||
export const zBoolean = z
|
||||
.string()
|
||||
.transform((v) => ["true", "1", "on"].includes(v.toLowerCase()))
|
||||
.openapi({ type: "boolean" })
|
||||
.or(z.boolean());
|
||||
export const zBoolean = z.stringbool().or(z.boolean());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue