You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got an error when trying to directly use zod schema, rather than types proposed by the lib (Num, Str, ..).
I've found 2 workarounds, so this issue is low priority (you can even close it if you want), but at least it's documented in case someone has the same issue.
Also, it works on the official openAPI cloudflare templates. I've tried to find the diff between this project and mine, but impossible to fix it on my project.
✘ [ERROR] TypeError: schema5.openapi is not a function
at null.<anonymous>
(file:///.../node_modules/.pnpm/@[email protected][email protected]/node_modules/@asteasolutions/zod-to-openapi/dist/index.mjs:995:54)
at Array.map (<anonymous>)
at OpenAPIGenerator.generateInlineParameters
(file:///.../node_modules/.pnpm/@[email protected][email protected]/node_modules/@asteasolutions/zod-to-openapi/dist/index.mjs:970:58)
at enhanceMissingParametersError.location
my code:
export class Converter extends OpenAPIRoute {
schema = {
summary: "Convert a document",
request: {
query: z.object({
// url: Str({ description: "Url of the document to convert" }), <-- this works ! :)
url: z.string().describe("url of the document to convert"), <-- this doesn't work ! :(
}),
...
I've got an error when trying to directly use zod schema, rather than types proposed by the lib (Num, Str, ..).
I've found 2 workarounds, so this issue is low priority (you can even close it if you want), but at least it's documented in case someone has the same issue.
Also, it works on the official openAPI cloudflare templates. I've tried to find the diff between this project and mine, but impossible to fix it on my project.
my code:
Environment
Node v20.10.0
package.json
wrangler.toml
Workaround 1
Simply add the following before your zod schema
Workaround 2
Use type provided by chanfana.
The text was updated successfully, but these errors were encountered: