Enable Scalar + OpenAPI spec for user posting

This commit is contained in:
Kevin Puig
2025-09-27 13:20:15 -04:00
parent 3d79c9cf4f
commit b9982b626f
4 changed files with 36 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ import { Hono } from "hono";
import { fetchAllUsers, fetchUserData, createNewUser } from "../controller/userController";
import { createUserSchema } from "../validators/userValidator";
import { zValidator } from "@hono/zod-validator";
import { describeRoute, resolver } from "hono-openapi";
const actions = new Hono();
actions.get("user/:id", async (c) => {
@@ -30,6 +31,17 @@ actions.get("user", async (c) => {
actions.post(
"user",
describeRoute({
description: "Create a new user",
responses: {
201: {
description: "Success",
content: {
'application/json': { schema: resolver(createUserSchema) },
},
}
}
}),
zValidator('json', createUserSchema),
async (c) => {
try {