Aditya Mathur
Aditya Mathur
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
Yeah for them too use the validator
80 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
Seems to be working fine with scalar
80 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
No description
80 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
You don't have to pass required, as that we can get from the schema
80 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
This is how you should do it
80 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
app.get(
"/",
describeRoute({
responses: {
200: {
description: "Hello World",
content: {
"text/plain": {
schema: resolver(z.string()),
},
},
},
},
}),
validator(
"json",
z.object({ query: z.string() }).openapi({
description: "Search query",
ref: "SearchRequest",
}),
),
(c) => {
return c.text("Hello World");
},
);
app.get(
"/",
describeRoute({
responses: {
200: {
description: "Hello World",
content: {
"text/plain": {
schema: resolver(z.string()),
},
},
},
},
}),
validator(
"json",
z.object({ query: z.string() }).openapi({
description: "Search query",
ref: "SearchRequest",
}),
),
(c) => {
return c.text("Hello World");
},
);
80 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
Quick question why are you passing this in describeRoute?
80 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
Just share a screenshot of the type errors you are getting, then I can take a look too
80 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
or CodeSandbox
80 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
can you share a reproduction of this on Stackblitz?
80 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
I am not getting any type errors
80 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
import { serve } from "@hono/node-server";
import { Hono } from "hono";
import {
describeRoute,
openAPISpecs,
} from "hono-openapi";
import {
resolver,
validator,
} from "hono-openapi/zod";
import { apiReference } from "@scalar/hono-api-reference";
import z from "zod";
import "zod-openapi/extend";

const app = new Hono();

app.get(
"/",
describeRoute({
responses: {
200: {
description: "Hello World",
content: {
"text/plain": {
schema: resolver(z.string()),
},
},
},
},
}),
validator(
"query",
z.object({
pathParam: z.string().openapi({
default: "Hello",
example: "world",
}),
}),
),
(c) => {
return c.text("Hello World");
},
);

app.get("/openapi", openAPISpecs(app));

app.get(
"/docs",
apiReference({
theme: "saturn",
spec: {
url: "/openapi",
},
}),
);

const port = 3000;
console.log(
`Server is running on http://localhost:${port}`,
);

serve({
fetch: app.fetch,
port,
});
import { serve } from "@hono/node-server";
import { Hono } from "hono";
import {
describeRoute,
openAPISpecs,
} from "hono-openapi";
import {
resolver,
validator,
} from "hono-openapi/zod";
import { apiReference } from "@scalar/hono-api-reference";
import z from "zod";
import "zod-openapi/extend";

const app = new Hono();

app.get(
"/",
describeRoute({
responses: {
200: {
description: "Hello World",
content: {
"text/plain": {
schema: resolver(z.string()),
},
},
},
},
}),
validator(
"query",
z.object({
pathParam: z.string().openapi({
default: "Hello",
example: "world",
}),
}),
),
(c) => {
return c.text("Hello World");
},
);

app.get("/openapi", openAPISpecs(app));

app.get(
"/docs",
apiReference({
theme: "saturn",
spec: {
url: "/openapi",
},
}),
);

const port = 3000;
console.log(
`Server is running on http://localhost:${port}`,
);

serve({
fetch: app.fetch,
port,
});
80 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
Hey @MarvinKR, this is my code -
80 replies
HHono
Created by Tony on 3/4/2025 in #help
RPC types not working well inside a monorepo
Now I also wanna know which one was it? 😂
114 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
@MarvinKR can you check if v0.4.6 solves this issue for you?
80 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
I need to write some tests 🙃
80 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
80 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
I am working on another issue right now, which might help this one too. Not sure but I will give it a try.
80 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
Interesting, can you share a reproduction of this? And create a issue over here - https://github.com/rhinobase/hono-openapi/issues
80 replies
HHono
Created by MarvinKR on 2/24/2025 in #help
products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI
what version are you using of hono-openapi? @MarvinKR
80 replies