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

Normalize version numbers in API calls #4879

Open
Cohen-Carlisle opened this issue Mar 21, 2024 · 2 comments
Open

Normalize version numbers in API calls #4879

Cohen-Carlisle opened this issue Mar 21, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@Cohen-Carlisle
Copy link

Cohen-Carlisle commented Mar 21, 2024

Is your feature request related to a problem? Please describe.
Yes. Currently, the API is inconsistent (e.g., for React) in that it sometimes requires major.minor and sometimes requires only major in the URL. E.g., React requires major.minor for 18+ but requires only Major for < 18.

Describe the solution you'd like
It would be very nice from an api perspective if the API was able to discard overly specific version information. For example, if I call https://endoflife.date/api/react/16.14.json it would be nice to get the response at https://endoflife.date/api/react/16.json instead of a 404. This would let me call with major.minor at all times (e.g., https://endoflife.date/api/react/18.2.json or https://endoflife.date/api/react/16.14.json) and get a valid response instead of having to know the exact cycles (which seems like it may change after a major version release).

Describe alternatives you've considered
None of these are currently supported by our tooling, but in theory there are several workarounds (if you completely control the code calling the API)

  1. Call https://endoflife.date/api/${product}.json and do some string comparisons with our version strings to figure out which api path to call.
  2. Retry calls with less specificity (e.g., start with major.minor.patch), and if 404, drop the rightmost part of the version.
  3. Store known patterns in how to call the API (the amount of version numbers of include). This seems more brittle than 1 or 2.
  4. Write very clever regex that uses known patterns to extract the correct api version strings for eol.date. This is both brittle and hard to maintain.

Additional context
We are using https://github.com/natecox/corrator to extract software versions from containers and get currency info for them from eol.date. We are not the maintainers and it currently only supports a static regex to extract the version string used to call eol.date.

@Cohen-Carlisle Cohen-Carlisle added the enhancement New feature or request label Mar 21, 2024
Copy link

welcome bot commented Mar 21, 2024

Thank you for opening your first issue here 👍. Be sure to follow the issue template if you chose one.

@marcwrobel
Copy link
Member

marcwrobel commented Apr 3, 2024

Hi @Cohen-Carlisle, I don't know if it applies to react, but we try to follow how particular releases are supported by the product vendor. So this type of inconsistency can happen if the vendor changed the way the product is supported (for example if the support was in the past on major, but is now on major.minor).

Having said that, for React I can think of two cases:

  1. Either the support was always on major.minor : in this case the product must be updated to reflect that and it will fix the issue you are facing.
  2. Or it changed over time, and in this case the product is properly documented. So this means we need to do something in the API to accommodate your request.

For the second point, I think it would be hard to specialize the documented releases from major to major.minor. Generalizing major.minor to just major may be a bit simpler, but this must be done only for the latest major.minor. Another solution could be to respond to each specific version (major.minor.patch), but this would require to have an up-to-date list of all versions.

So I agree this would be nice to "normalize" the version number, but except if it's an error in the way the product is documented (case 1) it won't be easy to implement.

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

No branches or pull requests

2 participants