Parse Zod description as Markdown with YAML front matter: https://jekyllrb.com/docs/front-matter/
This is a well established system for including metadata inside a plain markdown string.
The front matter would be included in the openapi spec as metadata while the body would be used as the description. Some keys can trigger special behavior, for example injecting @deprecated into the generated types.
For example:
const routeSpec = {
methods: ["POST"],
auth: "auth_token",
jsonBody: z.object({
name: z.string().describe(`
---
deprecated: Use full_name
---
The name of the user.
`),
full_name: z.string().describe("The name of the user."),
}),
jsonResponse: z.object({
ok: z.boolean(),
}),
} as const
Parse Zod description as Markdown with YAML front matter: https://jekyllrb.com/docs/front-matter/
This is a well established system for including metadata inside a plain markdown string.
The front matter would be included in the openapi spec as metadata while the body would be used as the description. Some keys can trigger special behavior, for example injecting
@deprecatedinto the generated types.For example: