Comfy-Org / Comfy-Org/ComfyUI_frontend

Replace z.any schema boundaries with unknown and enforce the rule

Open
#17,250 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

`apiSchema.ts` still uses `z.any()` at external-data boundaries, including `current_inputs`, `current_outputs`, feature flags, and dependent outputs. Values inferred from those schemas propagate unchecked `any` into callers.

Verified at upstream commit `686a91971eccaec062b39830764b04e5d0aa8a03`: [apiSchema.ts](https://github.com/Comfy-Org/ComfyUI_frontend/blob/686a91971eccaec062b39830764b04e5d0aa8a03/src/schemas/apiSchema.ts). The earlier review also named `nodeDefSchema.ts`; the targeted current search found no `z.any()` there, so inventory current occurrences before editing.

Replace intentional pass-through values with `z.unknown()` and narrow at their consumers. Use a more specific schema when the external contract is known. Enforce the prohibition through the repository's active lint tooling, including reintroduction tests; do not silence resulting type errors with assertions.

Acceptance:

- `rg 'z\.any\(' src` finds no remaining calls.
- Lint rejects a reintroduced `z.any()` call.
- Typecheck and relevant API/schema tests pass, including unknown payload values and supported consumer behavior.

This follows the Zod schema rules in `docs/guidance/typescript.md`. Upstream transfer for FE-2116; implementation belongs in this repository.

Contributor guide

Open the contributing guide

Research direction

Start with src/schemas/apiSchema.ts at the current z.any() occurrences and inventory them with rg 'z\.any\(' src; read docs/guidance/typescript.md for the schema rules. Trace the affected consumers, then run the active lint tooling, typecheck, and relevant API/schema tests. Done means no z.any() calls remain, lint rejects reintroduction, and unknown payload and supported-consumer tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, testing, tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.