Skip to content

fix: avoid deep Deno Zod types#1980

Open
HAYDEN-OAI wants to merge 1 commit into
mainfrom
codex/fix-deno-zod-types
Open

fix: avoid deep Deno Zod types#1980
HAYDEN-OAI wants to merge 1 commit into
mainfrom
codex/fix-deno-zod-types

Conversation

@HAYDEN-OAI

Copy link
Copy Markdown
Contributor

Summary

  • narrow the public zodResponseFormat() generic constraint to the small Zod surface the helper actually needs
  • infer parsed output directly from the schema _output type
  • keep the existing Zod v3/v4 runtime schema conversion unchanged
  • add coverage that the returned parser still preserves inferred output types

Why

Issue #984 reports that deno check can fail with TS2589 or exhaust the JavaScript heap when calling zodResponseFormat(). The previous public signature asked Deno to structurally compare the supplied schema against the complete Zod v3 and v4 type graphs before inferring the output type.

Impact

Deno no longer needs to expand those full Zod graphs at the call site. The helper still accepts Zod v3 and v4 schemas, produces the same JSON Schema at runtime, and preserves the inferred parsed result through _output.

Validation

  • reproduced the Deno 2.9.0 heap exhaustion before the change and verified the same call no longer enters the OOM path afterward
  • pnpm exec jest tests/helpers/zod.test.ts --runInBand
  • pnpm exec tsc --noEmit
  • pnpm run lint

Resolves #984

@openai-sdks

openai-sdks Bot commented Jul 6, 2026

Copy link
Copy Markdown

OkTest Summary

237/237 SDK tests passed in 11.226s for Node SDK PR #1980.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 262ms
tests/chat-completions-create.test.ts ✅ Passed 262ms
tests/chat-completions-stream.test.ts ✅ Passed 267ms
tests/files-content-binary.test.ts ✅ Passed 195ms
tests/files-create-multipart.test.ts ✅ Passed 258ms
tests/files-list-pagination.test.ts ✅ Passed 309ms
tests/initialize-config.test.ts ✅ Passed 164ms
tests/instance-isolation.test.ts ✅ Passed 132ms
tests/models-list.test.ts ✅ Passed 195ms
tests/responses-background-lifecycle.test.ts ✅ Passed 193ms
tests/responses-body-method-errors.test.ts ✅ Passed 307ms
tests/responses-cancel-timeout.test.ts ✅ Passed 197ms
tests/responses-cancel.test.ts ✅ Passed 196ms
tests/responses-compact-retries.test.ts ✅ Passed 253ms
tests/responses-compact.test.ts ✅ Passed 229ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 163ms
tests/responses-create-advanced.test.ts ✅ Passed 172ms
tests/responses-create-disconnect.test.ts ✅ Passed 1.207s
tests/responses-create-errors.test.ts ✅ Passed 189ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 179ms
tests/responses-create-retries.test.ts ✅ Passed 288ms
tests/responses-create-stream-failures.test.ts ✅ Passed 252ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 2.259s
tests/responses-create-stream-wire.test.ts ✅ Passed 2.683s
tests/responses-create-stream.test.ts ✅ Passed 92ms
tests/responses-create-terminal-states.test.ts ✅ Passed 207ms
tests/responses-create-timeout.test.ts ✅ Passed 210ms
tests/responses-create.test.ts ✅ Passed 274ms
tests/responses-delete.test.ts ✅ Passed 227ms
tests/responses-input-items-errors.test.ts ✅ Passed 363ms
tests/responses-input-items-list.test.ts ✅ Passed 219ms
tests/responses-input-items-options.test.ts ✅ Passed 196ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 225ms
tests/responses-input-tokens-count.test.ts ✅ Passed 232ms
tests/responses-malformed-inputs.test.ts ✅ Passed 2.438s
tests/responses-not-found-errors.test.ts ✅ Passed 251ms
tests/responses-parse.test.ts ✅ Passed 182ms
tests/responses-retrieve-retries.test.ts ✅ Passed 262ms
tests/responses-retrieve.test.ts ✅ Passed 237ms
tests/responses-stored-method-errors.test.ts ✅ Passed 599ms
tests/retry-behavior.test.ts ✅ Passed 3.126s
tests/sdk-error-shape.test.ts ✅ Passed 292ms

View OkTest run #28825739887

SDK merge (71f3c7c1fae5) · head (2f8e7ef19a4f) · base (95b54e589491) · OkTest (7fc645091b1a)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

openai-deno: Type-checking error for zodResponseFormat with Deno and deno.land imports

1 participant