Add JSON format for compatibility of a gem#148
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #148 +/- ##
==========================================
+ Coverage 86.88% 87.00% +0.11%
==========================================
Files 48 48
Lines 694 708 +14
==========================================
+ Hits 603 616 +13
- Misses 91 92 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a JSON response format for the existing gem “show” endpoint so external consumers (e.g., agents/tools) can fetch gem compatibility information per Rails version.
Changes:
- Add
respond_tohandling inGemmiesController#showforformat.json, including JSON 404 behavior. - Implement a JSON payload builder that returns gem name plus compatibility entries per Rails release.
- Add request specs covering existing gem (compatible/incompatible), pending/no compats (“checking”), and not-found behavior.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| spec/requests/api/compats_spec.rb | Adds request coverage for the new .json response behavior and payload shape |
| app/controllers/gemmies_controller.rb | Implements JSON responder + payload construction for gem compatibility |
| Gemfile.lock | Adds an additional supported platform entry |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This reverts commit 9e8fe1f.
JuanVqz
left a comment
There was a problem hiding this comment.
I'll be honest, I don't like this rescue in the show action and the test in the api since the controller is not in the api folder. i would have used jbuilder as well, but you have a coupon for today's review.
spec/requests/api/compats_spec.rb
Outdated
| it "returns not found and lets Rails handle the response" do | ||
| get "/gems/nonexistent_gem_12345.json" | ||
|
|
||
| expect(response).to have_http_status(:not_found) |
Replace find_by_name! + rescue with find_by_name + conditional to avoid using exceptions for control flow. Return head :not_found for HTML requests when the gem is not found. Remove the corresponding "gem does not exist" test case. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@JuanVqz Thanks for your review. Valid points. I just addressed them. Please let me know if you see anything else. |
Hi there,
I think it'd be useful to have a JSON format responder, in case an AI agent wants to consume this information.
Please check it out.
Thanks!