-
Notifications
You must be signed in to change notification settings - Fork 3
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
fix(bug): resolve data type issue #32
Conversation
WalkthroughThe changes in this pull request involve modifications to the Changes
Possibly related PRs
Suggested labels
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #32 +/- ##
=======================================
Coverage 53.75% 53.75%
=======================================
Files 21 21
Lines 1025 1025
=======================================
Hits 551 551
Misses 384 384
Partials 90 90 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
api_bug.go (1)
Line range hint
1-467
: Consider architectural improvements for custom fieldsThe current design with 150 custom fields and 10 plan fields suggests an opportunity for a more maintainable structure:
- Consider using a map for custom fields:
type GetBugsRequest struct { // ... other fields ... CustomFields map[string]*string `url:"-"` }
- Add a custom URL encoder that handles the map fields appropriately:
func (r *GetBugsRequest) EncodeValues(key string, v *url.Values) error { // ... encode regular fields ... for k, v := range r.CustomFields { if v != nil { v.Add(k, *v) } } return nil }Benefits:
- Reduced struct size and improved maintainability
- Easier to add new custom fields without code changes
- More flexible for handling dynamic field names
Would you like me to create a detailed proposal for this refactoring?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
api_bug.go
(2 hunks)
🔇 Additional comments (1)
api_bug.go (1)
308-467
: LGTM: Good improvements to request parameters
The addition of omitempty
tags to custom fields is a positive change that:
- Reduces URL query parameter size by omitting empty fields
- Follows Go best practices for optional parameters
- Maintains consistency with other optional fields in the struct
@@ -47,9 +47,9 @@ type Bug struct { | |||
TestType string `json:"testtype"` | |||
TestPhase string `json:"testphase"` | |||
Frequency string `json:"frequency"` | |||
CC *string `json:"cc"` | |||
CC string `json:"cc"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider implications of removing pointer types
The changes to CC
and Flows
fields from pointer to non-pointer types have several implications:
- JSON serialization will never omit these fields, potentially increasing payload size
- Breaking change for clients expecting null values
- For
Flows
, removing*Enum[string]
loses type safety and validation
Consider keeping pointer types if:
- Null values are meaningful in your API
- You need to distinguish between unset and empty values
- Type safety through
Enum[string]
is important for theFlows
field
- CC string `json:"cc"`
- Flows string `json:"flows"`
+ CC *string `json:"cc"`
+ Flows *Enum[string] `json:"flows"`
Also applies to: 52-52
Summary by CodeRabbit
New Features
Bug Fixes