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,4 +1,4 @@
|
|||
import { z } from "zod";
|
||||
import { z } from "zod/v4";
|
||||
import { Instance } from "./instance.ts";
|
||||
import { SSOConfig } from "./versia.ts";
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ export const InstanceV1 = z
|
|||
uri: Instance.shape.domain,
|
||||
title: Instance.shape.title,
|
||||
short_description: Instance.shape.description,
|
||||
description: z.string().openapi({
|
||||
description: z.string().meta({
|
||||
description: "An HTML-permitted description of the site.",
|
||||
example: "<p>Join the world's smallest social network.</p>",
|
||||
}),
|
||||
|
|
@ -20,29 +20,29 @@ export const InstanceV1 = z
|
|||
streaming_api:
|
||||
Instance.shape.configuration.shape.urls.shape.streaming,
|
||||
})
|
||||
.openapi({
|
||||
.meta({
|
||||
description: "URLs of interest for clients apps.",
|
||||
}),
|
||||
stats: z
|
||||
.object({
|
||||
user_count: z.number().openapi({
|
||||
user_count: z.number().meta({
|
||||
description: "Total users on this instance.",
|
||||
example: 812303,
|
||||
}),
|
||||
status_count: z.number().openapi({
|
||||
status_count: z.number().meta({
|
||||
description: "Total statuses on this instance.",
|
||||
example: 38151616,
|
||||
}),
|
||||
domain_count: z.number().openapi({
|
||||
domain_count: z.number().meta({
|
||||
description: "Total domains discovered by this instance.",
|
||||
example: 25255,
|
||||
}),
|
||||
})
|
||||
.openapi({
|
||||
.meta({
|
||||
description:
|
||||
"Statistics about how much information the instance contains.",
|
||||
}),
|
||||
thumbnail: z.string().url().nullable().openapi({
|
||||
thumbnail: z.url().nullable().meta({
|
||||
description: "Banner image for the website.",
|
||||
example:
|
||||
"https://files.mastodon.social/site_uploads/files/000/000/001/original/vlcsnap-2018-08-27-16h43m11s127.png",
|
||||
|
|
@ -50,7 +50,7 @@ export const InstanceV1 = z
|
|||
languages: Instance.shape.languages,
|
||||
registrations: Instance.shape.registrations.shape.enabled,
|
||||
approval_required: Instance.shape.registrations.shape.approval_required,
|
||||
invites_enabled: z.boolean().openapi({
|
||||
invites_enabled: z.boolean().meta({
|
||||
description: "Whether invites are enabled.",
|
||||
example: true,
|
||||
}),
|
||||
|
|
@ -62,7 +62,7 @@ export const InstanceV1 = z
|
|||
Instance.shape.configuration.shape.accounts.shape
|
||||
.max_featured_tags,
|
||||
})
|
||||
.openapi({
|
||||
.meta({
|
||||
description: "Limits related to accounts.",
|
||||
}),
|
||||
statuses: z
|
||||
|
|
@ -77,7 +77,7 @@ export const InstanceV1 = z
|
|||
Instance.shape.configuration.shape.statuses.shape
|
||||
.characters_reserved_per_url,
|
||||
})
|
||||
.openapi({
|
||||
.meta({
|
||||
description: "Limits related to authoring statuses.",
|
||||
}),
|
||||
media_attachments: z
|
||||
|
|
@ -101,7 +101,7 @@ export const InstanceV1 = z
|
|||
Instance.shape.configuration.shape.media_attachments
|
||||
.shape.video_matrix_limit,
|
||||
})
|
||||
.openapi({
|
||||
.meta({
|
||||
description:
|
||||
"Hints for which attachments will be accepted.",
|
||||
}),
|
||||
|
|
@ -120,11 +120,11 @@ export const InstanceV1 = z
|
|||
Instance.shape.configuration.shape.polls.shape
|
||||
.max_expiration,
|
||||
})
|
||||
.openapi({
|
||||
.meta({
|
||||
description: "Limits related to polls.",
|
||||
}),
|
||||
})
|
||||
.openapi({
|
||||
.meta({
|
||||
description: "Configured values and limits for this website.",
|
||||
}),
|
||||
contact_account: Instance.shape.contact.shape.account,
|
||||
|
|
@ -132,11 +132,11 @@ export const InstanceV1 = z
|
|||
/* Versia Server API extension */
|
||||
sso: SSOConfig,
|
||||
})
|
||||
.openapi({
|
||||
.meta({
|
||||
description:
|
||||
"Represents the software instance of Versia Server running on this domain.",
|
||||
externalDocs: {
|
||||
url: "https://docs.joinmastodon.org/entities/V1_Instance",
|
||||
},
|
||||
ref: "InstanceV1",
|
||||
id: "InstanceV1",
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue