Open cosmin-ghitea opened 3 hours ago
Please see https://github.com/asteasolutions/zod-to-openapi?tab=readme-ov-file#defining-route-parameters. It might not be obvious but in order to put any metadata at the param level (and not the schema level) you have to nest it like so:
param: {
description: 'your description here'
}
So in my case something like this
z.string().optional().openapi({
param: {
description: "Access token. Example: `123`",
}
}),
Yes
I encountered an issue while using @asteasolutions/zod-to-openapi. When I define custom headers with the .openapi() method in zod, the description for each header is nested under schema. I expect the description to be at the same level as name, in accordance with the OpenAPI 3.1 specification.
The generated OpenAPI currently nests the description inside schema