Conversation
X-API-Version: 2 header
There was a problem hiding this comment.
Pull request overview
This pull request enhances the recommendation API to support the X-API-Version header for score retrieval. When clients set X-API-Version: 2, the API returns recommendation results with scores (as []cache.Score) instead of just item IDs (as []string). This maintains backward compatibility by defaulting to the original behavior when the header is not provided.
Changes:
- Added X-API-Version header parameter to recommendation endpoint documentation and specifications
- Implemented version checking logic in getRecommend handler to return scores when version 2 is requested
- Added test case verifying that version 2 returns scores with proper values
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| server/rest.go | Added X-API-Version header parameter to endpoint specs, updated documentation, and implemented conditional response logic to return scores for version 2 |
| server/rest_test.go | Added test case verifying X-API-Version: 2 returns scores instead of just IDs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1140 +/- ##
==========================================
- Coverage 71.59% 71.59% -0.01%
==========================================
Files 84 84
Lines 15249 15255 +6
==========================================
+ Hits 10918 10922 +4
- Misses 3243 3245 +2
Partials 1088 1088 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…retrieval