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

Add optional query parameter (include_prereleases) to [GemVersion] #6451

Merged

Conversation

profgrammer
Copy link
Contributor

@profgrammer profgrammer commented May 6, 2021

Added an optional query parameter (include_prereleases) to the GemVersion service, with reference to #3222

  • If passed, it will fetch the latest version for the gem, otherwise it will default to the latest stable version

@shields-ci
Copy link

shields-ci commented May 6, 2021

Messages
📖 ✨ Thanks for your contribution to Shields, @profgrammer!

Generated by 🚫 dangerJS against 08c4157

@PyvesB PyvesB added the service-badge Accepted and actionable changes, features, and bugs label May 6, 2021
Copy link
Member

@PyvesB PyvesB left a comment

Choose a reason for hiding this comment

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

Hello @profgrammer ! 👋🏻

Thanks for your contribution to Shields.io! In my opinion, having the new optional parameter as a query parameter rather than an element in the path would be a better fit.

Do we foresee any values other than stable or latest in the near future? If not, we could even make it a "valueless" query parameter, e.g. https://img.shields.io/gem/v/formatador?latest or something appropriately named like that.

@profgrammer
Copy link
Contributor Author

Hi @PyvesB, thank you for your inputs. I don't think we expect values other than stable or latest in the future, and the valueless query param seems like a good alternative.

@PyvesB
Copy link
Member

PyvesB commented May 7, 2021

In that case, I can point you to this implementation here: https://github.com/badges/shields/blob/master/services/youtube/youtube-likes.service.js

Note the withDislikes query parameter being used.

@profgrammer profgrammer changed the title Add optional distribution parameter to [GemVersion] Add optional query parameter (latest) to [GemVersion] May 7, 2021
@shields-cd shields-cd temporarily deployed to shields-staging-pr-6451 May 8, 2021 02:55 Inactive
@calebcartwright
Copy link
Member

I'm not terribly familiar with the Ruby ecosystem, but would it make sense to use the prerelease type naming/conventions we use in other version badges?

@profgrammer
Copy link
Contributor Author

@calebcartwright I see 2 options for this -

  • create a new route /gem/vpre that includes preleases
  • renaming the latest query param to include_prereleases

I think the latter would be a better option, will go ahead and rename the query parameter. Thanks!

@profgrammer profgrammer changed the title Add optional query parameter (latest) to [GemVersion] Add optional query parameter (include_prereleases) to [GemVersion] May 8, 2021
@shields-cd shields-cd temporarily deployed to shields-staging-pr-6451 May 8, 2021 06:28 Inactive
Copy link
Member

@PyvesB PyvesB left a comment

Choose a reason for hiding this comment

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

Thanks for polishing the implementation promptly @profgrammer, it mostly looks good to me at this point. 👍🏻

services/gem/gem-version.service.js Outdated Show resolved Hide resolved

// this is the same as isVPlusDottedVersionNClausesWithOptionalSuffix from test-validators.js
// except that it also accepts regexes like 5.0.0.rc5 - the . before the rc5 is not accepted in the original
const isVPlusDottedVersionNClausesWithOptionalSuffix = withRegex(
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering whether it would have been better to modify the original regex directly. Admittedly I've not seen many projects use a dot as the separator for the pre-release tag outside the Ruby ecosystem, so what you've done may make more sense. Let's leave it as is for now, but another maintainer will possibly have a stronger view on this one. :)

Copy link
Member

Choose a reason for hiding this comment

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

generally agreed but also content with leaving this here for now. we probably do have some minor proliferation of duplicative regexes but I don't have any concerns with having this one here

@shields-cd shields-cd temporarily deployed to shields-staging-pr-6451 May 8, 2021 08:44 Inactive
Copy link
Member

@PyvesB PyvesB left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks for the good work! Won't merge just yet in case @calebcartwright has some additional thoughts. :)

@PyvesB PyvesB linked an issue May 8, 2021 that may be closed by this pull request
Copy link
Member

@calebcartwright calebcartwright left a comment

Choose a reason for hiding this comment

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

LGTM as well. Thanks for this @profgrammer, nice first contribution to the Shields project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-badge Accepted and actionable changes, features, and bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option for unstable Ruby gem version
5 participants