feat: openapi support plus more api validation

This commit is contained in:
Huskydog9988
2025-05-10 15:16:26 -04:00
parent a0bc4bbc4c
commit 3df6818ffe
9 changed files with 100 additions and 39 deletions

View File

@ -15,7 +15,9 @@ const signinValidator = type({
"rememberMe?": "boolean | undefined",
});
export default defineEventHandler(async (h3) => {
export default defineEventHandler<{
body: typeof signinValidator.infer;
}>(async (h3) => {
if (!enabledAuthManagers.Simple)
throw createError({
statusCode: 403,

View File

@ -7,13 +7,16 @@ import { type } from "arktype";
import { randomUUID } from "node:crypto";
const userValidator = type({
invitation: "string",
username: "string >= 5",
email: "string.email",
password: "string >= 14",
"displayName?": "string | undefined",
});
export default defineEventHandler(async (h3) => {
export default defineEventHandler<{
body: typeof userValidator.infer;
}>(async (h3) => {
const body = await readBody(h3);
const invitationId = body.invitation;