We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@hono/zod-openapi
0.18.4
4.6.20
Node.js
we have multiple API and handler all are working fine but only 1 APi failing which respons eis in txt/html and here is the code for that
import { Layout } from "@/components/Layout"; interface SiteData { title: string; description: string; children?: any; } export function Home(props: { siteData: SiteData; name: string }) { return ( <Layout { ...props.siteData }> <h1> Hello { props.name } </h1> </Layout> ); }
import type { Context } from "hono"; import { Home } from "@/components/Home"; import type { AppRouterHandler } from "@/types/common"; export const basic: AppRouterHandler<any> = (c) => { const props = { name: "Hacker", siteData: { title: "Home Page", description: "Hono is cool!", }, }; return c.html(<Home { ...props } />); };
import type { z } from "@hono/zod-openapi"; type ZodSchema = z.ZodUnion | z.AnyZodObject | z.ZodArray<z.AnyZodObject>; function htmlContent<T extends ZodSchema>(schema: T, description: string) { return { content: { "text/html": { schema } }, description }; } export const basic = createRoute({ path: "/", method: "get", tags, responses: { 200: htmlContent(z.string(), "basic routeIndex") } });
import { createRouter } from "@/libs/create-app"; import * as handlers from "@/routes/common/common.handlers"; import * as routes from "@/routes/common/common.routes"; const router = createRouter() .openapi(routes.basic, handlers.basic);
and here is configure-open-api.ts
import type { OpenAPIHono } from "@hono/zod-openapi"; import { apiReference } from "@scalar/hono-api-reference"; import type { AppBindings } from "@/middlewares"; import pkg from "../../package.json"; type AppOpenAPI = OpenAPIHono<AppBindings>; export default function configureOpenAPI(app: AppOpenAPI) { app.doc("/doc", { openapi: "3.0.0", info: { version: pkg.version, title: "TZ Server", description: "API for managing project" } }); app.get( "/reference", apiReference({ pageTitle: "Project: API Reference", theme: "moon", layout: "modern", defaultHttpClient: { targetKey: "javascript", clientKey: "fetch" }, spec: { url: "/doc" } }) );
and when run and open localhost:3000/refrences and hit / using test run it gives error
The URL seems to be invalid
on bottom of the page that Inavlia URL; here is screenshot for the same.
It should display the text/html page which opens on localhost:3000
gives error Invalid URL and hono stopped sometimes
running on ubuntu 24.04
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Which middleware has the bug?
@hono/zod-openapi
What version of the middleware?
0.18.4
What version of Hono are you using?
4.6.20
What runtime/platform is your app running on? (with version if possible)
Node.js
What steps can reproduce the bug?
we have multiple API and handler all are working fine but only 1 APi failing which respons eis in txt/html and here is the code for that
src/components/Home.tsx
src/common.handler.ts
common/common.routes.ts
sommon/common.index.ts
and here is configure-open-api.ts
and when run and open localhost:3000/refrences and hit / using test run it gives error
on bottom of the page that Inavlia URL; here is screenshot for the same.
What is the expected behavior?
It should display the text/html page which opens on localhost:3000
What do you see instead?
gives error Invalid URL and hono stopped sometimes
Additional information
running on ubuntu 24.04
The text was updated successfully, but these errors were encountered: