Comfy-Org / Comfy-Org/ComfyUI_frontend
bug: @hey-api/openapi-ts Zod plugin generates z.string() for multipart/form-data binary fields (zUploadImageData, zUploadMaskData)
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
## Summary
The generated Zod schemas `zUploadImageData` and `zUploadMaskData` in `packages/ingest-types/src/zod.gen.ts` validate the `image` field as `z.string()`, but the corresponding TypeScript types in `types.gen.ts` define it as `Blob | File`.
This is a codegen bug in `@hey-api/openapi-ts` — the Zod plugin does not correctly handle `multipart/form-data` binary part fields, and instead falls back to `z.string()`.
## Impact
- **Currently non-breaking**: the frontend does not import these Zod schemas directly.
- **Risk for downstream consumers**: since the schemas are exported as part of the published `@comfyorg/ingest-types` package, any downstream consumer using them for runtime validation of file upload payloads will get false validation failures when passing `Blob` or `File` objects.
## Affected Files
- `packages/ingest-types/src/zod.gen.ts` — `zUploadImageData`, `zUploadMaskData`
## Steps to Reproduce
1. Import `zUploadImageData` from `@comfyorg/ingest-types`
2. Attempt to validate a payload with `image: new File([...], 'test.png')`
3. Observe Zod validation failure — expects `string`, received `object`
## Possible Fix
Override or patch the generated schema for the `image` field to use `z.instanceof(Blob)` (or a union with `z.instanceof(File)`) until `@hey-api/openapi-ts` upstream fixes multipart binary support in its Zod plugin. Alternatively, open an upstream issue/PR with `@hey-api/openapi-ts`.
## References
- Introduced in PR #10697
- Review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10697#discussion_r3005811273
- Reported by: @dante01yoon
- Follow-up requested by: @christian-byrne
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-10702-bug-hey-api-openapi-ts-Zod-plugin-generates-z-string-for-multipart-form-data-bina-3326d73d36508159a116fd5a64523883) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.