fix(types): align schema types with Sentry API#169
Conversation
The Sentry API returns annotations as objects with displayName and url fields, not strings. This was causing ZodError when parsing issues with annotations. Closes CLI-R
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
🤖 This preview updates automatically when you update the PR. |
Codecov Results 📊❌ Patch coverage is 75.00%. Project has 2024 uncovered lines. Files with missing lines (29)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 69.20% 69.22% +0.02%
==========================================
Files 57 57 —
Lines 6565 6576 +11
Branches 0 0 —
==========================================
+ Hits 4543 4552 +9
- Misses 2022 2024 +2
- Partials 0 0 —Generated by Codecov Action |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
The Sentry API defines sdk.name and sdk.version as nullable fields. Making them nullable prevents potential ZodError if the API returns null values for these fields. Also updates the formatter to handle null values gracefully instead of displaying 'null null'.
51d6bc7 to
0696572
Compare
|
Thank. I got the same issue with this one today and cant not using cli |
|
@kingkong0905 sorry you hit this one. we'll probably do a release today with this patch ;) Thanks for using the CLI! |
Summary
Fixes ZodError when parsing issues with annotations by aligning the CLI's Zod schemas with the official Sentry API schema.
Issue: https://sentry.sentry.io/issues/7237665256/
Changes
annotations- Changed fromstring[]to{displayName, url}[]to match the actual API response structuresdk.name/sdk.version- Made nullable to match API schema (defensive fix)Both issues were identified by comparing our types against
/Users/bete/code/sentry-api-schema/openapi-derefed.json.Test Plan
bun run typecheckpassesbun run lintpassesbun test test/typespasses