-
-
Notifications
You must be signed in to change notification settings - Fork 272
Fix writeOnly regression: response types incorrectly use writable variants #2850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
🦋 Changeset detectedLatest commit: 16cc0e7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@copilot update all snapshots with |
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2850 +/- ##
==========================================
+ Coverage 30.36% 30.38% +0.01%
==========================================
Files 485 485
Lines 39803 39802 -1
Branches 2413 2415 +2
==========================================
+ Hits 12088 12092 +4
+ Misses 27684 27678 -6
- Partials 31 32 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
commit: |
Summary
Fixed a regression introduced in v0.86.4 where response types incorrectly used writable variants instead of read-only ones when schemas reference other schemas with
writeOnlyfields.The Problem
When a schema like
ItemreferencesPayload(which haswriteOnlyfields and is split intoPayloadandPayloadWritable), both request and response types were using the writable variant. This is incorrect - responses should use the read variant.Before (buggy):
After (fixed):
Root Cause
The
splitSchemasfunction compared pruned read/write variants and skipped splitting if identical. However, schemas that only reference split schemas (via $refs) don't change during pruning, so they were incorrectly not split.Solution
Check transitive dependencies: if a schema references any schema that needs read/write variants, split it even if pruning doesn't change it directly.
Testing
✅ All 954 unit tests pass
✅ All 613 integration tests pass
✅ All 150 zod tests pass
✅ Linting and type checking pass
✅ Automated code review found no issues
✅ Manually verified with issue reproduction case
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.