Skip to content

fix(helpers/zod): avoid circular refs for branded zod/v3 schemas#1799

Open
raashish1601 wants to merge 1 commit intoopenai:masterfrom
raashish1601:contributor-10/openai-node-1739
Open

fix(helpers/zod): avoid circular refs for branded zod/v3 schemas#1799
raashish1601 wants to merge 1 commit intoopenai:masterfrom
raashish1601:contributor-10/openai-node-1739

Conversation

@raashish1601
Copy link
Copy Markdown

Fixes #1739.

Summary

  • preserve force-resolution when materializing extracted definitions for branded zod/v3 schemas
  • keep branded aliases from collapsing into self-referential $ref definitions
  • add helper coverage for zodTextFormat() with repeated branded array items across nullable and non-nullable fields

Validation

  • ./node_modules/.bin/jest tests/helpers/zod.test.ts --runInBand
  • corepack yarn ts-node -r tsconfig-paths/register -e "..." to confirm the extracted definition now resolves to { "type": "string" }
  • git diff --check

@raashish1601 raashish1601 requested a review from a team as a code owner March 27, 2026 22:49
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.

zodTextFormat generates invalid circular $ref in JSON schema definitions

1 participant