Skip to content

fix: JSON schema override is not applied when schema is overridden#5558

Closed
JaviMaligno wants to merge 1 commit into
colinhacks:mainfrom
JaviMaligno:oss-agent/issue-5499-json-schema-override-is-not-applied-when
Closed

fix: JSON schema override is not applied when schema is overridden#5558
JaviMaligno wants to merge 1 commit into
colinhacks:mainfrom
JaviMaligno:oss-agent/issue-5499-json-schema-override-is-not-applied-when

Conversation

@JaviMaligno
Copy link
Copy Markdown

Summary

Fixes #5499

Changes

  • packages/zod/src/v4/classic/to-json-schema.ts - Fixed to properly propagate meta overrides when a schema has a JSON schema override
  • packages/zod/src/v4/classic/tests/fix-json-issue.test.ts - Added test case for the fix

Stats: 2 file(s) changed, +32 insertions, -8 deletions


🤖 Changes prepared with assistance from OSS-Agent

)

Fixes colinhacks#5499

---
Changes prepared with assistance from OSS-Agent
@pullfrog
Copy link
Copy Markdown
Contributor

pullfrog Bot commented Dec 21, 2025

Pullfrog  | Review this ➔pullfrog.com

@JaviMaligno
Copy link
Copy Markdown
Author

🤖 Automated PR Review

The core fix is sound - removing the !seen.isParent condition ensures that override functions are applied consistently to all schemas, which is the expected behavior. The test cases properly validate both the fix and edge cases with reused schema instances. The change count expectation update (6 to 9) makes sense as more schemas are now being processed. This is a clean, targeted fix that addresses the reported issue without introducing side effects.

This review was performed by an automated agent.

@colinhacks
Copy link
Copy Markdown
Owner

Fixed in #5578

@colinhacks colinhacks closed this Dec 31, 2025
@colinhacks
Copy link
Copy Markdown
Owner

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.

JSON schema override is not applied when schema is overridden

3 participants