fix: Correct Schemas#45
Conversation
📝 WalkthroughWalkthroughThis PR updates two Zod schemas: ChangesScore Status Handling
Golfer Schema
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/client/ghin/models/scores/post-response.ts (1)
8-8: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReuse shared status enum instead of duplicating literals.
This enum duplicates
rawScoreStatuses/schemaRawScoreStatusinscore.ts. This very PR required updating both places identically to addTemporary— export and reuse the shared enum to prevent future drift.♻️ Proposed fix
- status: z.enum(['Validated', 'UnderReview', 'Temporary']), + status: schemaRawScoreStatus,(export
schemaRawScoreStatusfromscore.tsand import it here)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/client/ghin/models/scores/post-response.ts` at line 8, The status enum in the post response schema is duplicated and should reuse the shared score status definition instead of hardcoding literals. Export the existing shared enum from score.ts (schemaRawScoreStatus / rawScoreStatuses) and import it into post-response.ts, then wire the status field to that shared symbol so both schemas stay in sync.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/client/ghin/models/scores/post-response.ts`:
- Line 8: The status enum in the post response schema is duplicated and should
reuse the shared score status definition instead of hardcoding literals. Export
the existing shared enum from score.ts (schemaRawScoreStatus / rawScoreStatuses)
and import it into post-response.ts, then wire the status field to that shared
symbol so both schemas stay in sync.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f3bcff33-81b2-4039-bbad-588c6f7b193e
📒 Files selected for processing (3)
src/client/ghin/models/golfers/search.tssrc/client/ghin/models/scores/post-response.tssrc/client/ghin/models/scores/score.ts
This PR fixes schema validation issues caused by GHIN API responses that are more flexible than the current models expected.
What changed
Why
GHIN sometimes returns:
These were previously rejected by the strict Zod schemas, causing unnecessary validation failures. The update aligns the client model with real GHIN behavior and removes those unneeded errors.
Summary by CodeRabbit