Skip to content
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

Simplify the "version already exists" check by using RubyGems v2 API #11712

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

jeffwidman
Copy link
Member

@jeffwidman jeffwidman commented Mar 3, 2025

The v2 API added endpoints specific for a specific version of a gem: https://guides.rubygems.org/rubygems-org-api-v2/

Benefits:

  1. Less data gets returned over the wire.
    Compare:
  2. Less brittle since we no longer parse the response.body
  3. Faster since we only check response.code

I verified that sending a non-existent version returns a 404: https://rubygems.org/api/v2/rubygems/dependabot-omnibus/versions/0.7.1.json

@jeffwidman jeffwidman requested a review from a team as a code owner March 3, 2025 09:06
@jeffwidman
Copy link
Member Author

jeffwidman commented Mar 3, 2025

@deivid-rodriguez can we safely assume this v2 endpoint is a stable API?

Copy link
Contributor

@markhallen markhallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jeffwidman jeffwidman enabled auto-merge (squash) March 3, 2025 16:50
The v2 API has endpoints specific to each version: https://guides.rubygems.org/rubygems-org-api-v2/

Benefits:

1. Less data gets returned over the wire
    Compare:
       * https://rubygems.org/api/v1/versions/dependabot-omnibus.json
        * https://rubygems.org/api/v2/rubygems/dependabot-omnibus/versions/0.299.1.json
2. Less brittle since we no longer parse the `response.body`
3. Faster since we only check `response.code`

I verified that sending a non-existent version returns a `404`:
https://rubygems.org/api/v2/rubygems/dependabot-omnibus/versions/0.7.1.json
@jeffwidman jeffwidman force-pushed the use-v2-api-for-simpler-and-faster-existence-check branch from 08f8ddb to 89c603a Compare March 3, 2025 16:51
@jeffwidman jeffwidman merged commit d0b3517 into main Mar 3, 2025
59 of 60 checks passed
@jeffwidman jeffwidman deleted the use-v2-api-for-simpler-and-faster-existence-check branch March 3, 2025 16:55
@deivid-rodriguez
Copy link
Contributor

Yes, yes, we should keep this public and documented API working 😅.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants