H
Hono2d ago
32cls

swagger-ui and @hono/zod-openapi mismatch

Hello, I'm trying to make the swagger-ui middleware work with the @hono/zod-openapi package. It does work when I run my project but I get this deno-ts error in VS code and I wondered if it was possible to solve it?
app.use("/ui", swaggerUI({ url: "/api/docs" }));
app.use("/ui", swaggerUI({ url: "/api/docs" }));
No overload matches this call.
The last overload gave the following error.
Argument of type 'MiddlewareHandler<Env>' is not assignable to parameter of type 'MiddlewareHandler<Env, "/api/ui", {}>'.
Types of parameters 'c' and 'c' are incompatible.
Type 'Context<Env, "/api/ui", {}>' is missing the following properties from type 'Context<Env, string, {}>': #rawRequest, #req, #var, #status, and 9 more.
No overload matches this call.
The last overload gave the following error.
Argument of type 'MiddlewareHandler<Env>' is not assignable to parameter of type 'MiddlewareHandler<Env, "/api/ui", {}>'.
Types of parameters 'c' and 'c' are incompatible.
Type 'Context<Env, "/api/ui", {}>' is missing the following properties from type 'Context<Env, string, {}>': #rawRequest, #req, #var, #status, and 9 more.
Thanks for your help 🙏
2 Replies
Musanna Al Akil
try -> app.get("/ui", swaggerUI({ url: "/api/docs" }));
32cls
32clsOP2d ago
i tried it unfortunately didn't change anything 🙁

Did you find this page helpful?