Note: Because openapi-zod is a library standing on the shoulders of other libraries, I don't have an idea if this is the correct repository to ask.
I am currently migrating an existing API with an OpenAPI spec (that users use to automatically generate clients) to hono. What I would need (without breaking changes for automatically generated clients), would be this:
export const list = createRoute({
path: "/profile",
method: "get",
summary: "Get a list of profiles for a given space.",
request: {
query: SortSchema,,
},
});
and the following schema:
import { z } from "@hono/zod-openapi";
export const SortSchema = z.object({
field: z.string().default("submittedAt").openapi({
description: "The field to sort by. Default is 'submittedAt'.",
}),
order: z.enum(["ASC", "DESC"]).default("ASC").openapi({
description: "The sort order. Can be either 'ASC' or 'DESC'. Default is 'ASC'.",
}),
}).openapi("sort");
When generating some OpenAPI, it generates this as parameters (yaml for better readability):
...
parameters:
- schema:
type: string
default: submittedAt
description: The field to sort by. Default is 'submittedAt'.
required: false
name: field
in: query
- schema:
type: string
enum:
- ASC
- DESC
default: ASC
description: The sort order. Can be either 'ASC' or 'DESC'. Default is 'ASC'.
required: false
name: order
in: query
First question: Shouldn't it put the schemas under a shared component (as it does with responses). This is what I would have expected:
Note: Because openapi-zod is a library standing on the shoulders of other libraries, I don't have an idea if this is the correct repository to ask.
I am currently migrating an existing API with an OpenAPI spec (that users use to automatically generate clients) to hono. What I would need (without breaking changes for automatically generated clients), would be this:
I have the following call to
createRoute
and the following schema:
When generating some OpenAPI, it generates this as parameters (yaml for better readability):
First question: Shouldn't it put the schemas under a shared component (as it does with responses). This is what I would have expected:
So far I am without any luck to achieve this.
Second question: Where would it be possible to add the
style
andexplode
properties?