cloudflare / cloudflare/chanfana
[BUG] Getting Error while specified schema.request.headers fields.
- Dominant language
- TypeScript
- Stars
- 766
- Forks
- 70
- Avg merge
- 25m
- Merged PRs (30d)
- 4
Description
A minimal cloudflare API starter could reproduce the error by: bun create cloudflare@latest.
Just define the headers in request, then you could see it.
Please let me know if you need extra helps.
✘ [ERROR] TypeError: schema2.openapi is not a function
at null.
(file:///Users/zzx58/Desktop/DevProjects/Wishing-PIM/node_modules/@asteasolutions/zod-to-openapi/dist/index.mjs:1000:54)
at Array.map ()
at OpenAPIGenerator.generateInlineParameters
(file:///Users/zzx58/Desktop/DevProjects/Wishing-PIM/node_modules/@asteasolutions/zod-to-openapi/dist/index.mjs:975:58)
at enhanceMissingParametersError.location
(file:///Users/zzx58/Desktop/DevProjects/Wishing-PIM/node_modules/@asteasolutions/zod-to-openapi/dist/index.mjs:1145:24)
at enhanceMissingParametersError
(file:///Users/zzx58/Desktop/DevProjects/Wishing-PIM/node_modules/@asteasolutions/zod-to-openapi/dist/index.mjs:353:16)
at OpenAPIGenerator.getParameters
(file:///Users/zzx58/Desktop/DevProjects/Wishing-PIM/node_modules/@asteasolutions/zod-to-openapi/dist/index.mjs:1139:34)
at enhanceMissingParametersError.route
(file:///Users/zzx58/Desktop/DevProjects/Wishing-PIM/node_modules/@asteasolutions/zod-to-openapi/dist/index.mjs:1168:69)
at enhanceMissingParametersError
(file:///Users/zzx58/Desktop/DevProjects/Wishing-PIM/node_modules/@asteasolutions/zod-to-openapi/dist/index.mjs:353:16)
at OpenAPIGenerator.generatePath
(file:///Users/zzx58/Desktop/DevProjects/Wishing-PIM/node_modules/@asteasolutions/zod-to-openapi/dist/index.mjs:1168:28)
at OpenAPIGenerator.generateSingleRoute
(file:///Users/zzx58/Desktop/DevProjects/Wishing-PIM/node_modules/@asteasolutions/zod-to-openapi/dist/index.mjs:1180:31)
Contributor guide
Research direction
Reproduce the problem with `bun create cloudflare@latest` and a request schema defining headers. Read the `schema.request.headers` path alongside the reported `zod-to-openapi` stack trace, then verify that OpenAPI generation no longer throws `TypeError: schema2.openapi is not a function`. Done means routes with request headers generate successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bun, openapi, typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100