foojayio / discoapi

The foojay discovery api (discoapi) is made to discover java packages (jre/jdk) from different distributions.
GNU General Public License v2.0
111 stars 13 forks source link

Packages for aoj miss a platform for Java 12 #26

Closed marchof closed 3 years ago

marchof commented 3 years ago

Actual

https://api.foojay.io/disco/v1.0/packages?distro=aoj&version=12&latest=overall

Expected

The platform aix-ppc64 should be reported, see:

https://adoptopenjdk.net/releases.html?variant=openjdk12

HanSolo commented 3 years ago

Interesting, the pkgs are in the database but the general search leave them out, if you add &operating_system=aix to the call it will show them. Will investigate why that happens, thx for the heads up.

HanSolo commented 3 years ago

So the overall switch gives us 12.0.2 as version back but for 12.0.2 there is no ga version for aix but only an ea. So if you add &release_status=ea&release_status_ga to the call you will see the pkgs. The latest ga for aix is 12.0.1 as far as I can see

marchof commented 3 years ago

Thanks @HanSolo for the analysis! I will see what is a generic solution how to add this to my client. Do you think it is safe to always add &release_status=ea&release_status_ga to the package queries?

HanSolo commented 3 years ago

Well it depends, including ea builds will return a huge list of packages sometimes, depending on the distro (e.g. SAP Machine). But could make sense if you are looking for all available builds.

marchof commented 3 years ago

I see. Here is how the the user interface looks like:

https://javaalmanac.io/jdk/download/#product=oracle&version=16

I think what the user would expect to get a list of all distributions that matches the criteria. If "latest updated only" is checked I would expect the latest update of the distribution that matches the criteria (even if there are newer updates not matching the criteria). Is this possible with the API?

HanSolo commented 3 years ago

The problem with calls like &version=15 is that this would give you all pkgs with version=15.0.0.0 and that is correct. So for the usecase you described it would make sense to have the ability to define ranges, e.g. give me all pkgs with versions between 16.0.0.0 and 16.0.1.0 or similar.

This morning I've implemented ranges in v2.0. Here are some examples of what you should be able to do now:

15.0.1 >= version <= 15.0.3 url parameter: &version=15.0.1...15.0.3

15.0.1 >= version < 15.0.3 url parameter: &version=15.0.1..<15.0.3

15.0.1 > version <= 15.0.3 url parameter: &version=15.0.1>..15.0.3

15.0.1 > version < 15.0.3 url parameter &version=15.0.1>.<15.0.3

version >= 15.0.1 url parameter &version=>=15.0.1

version > 15.0.1 url parameter &version=>15.0.1

version <= 15.0.3 url parameter &version=<=15.0.3

version < 15.0.3 url parameter &version=<15.0.3

So I hope with this we cover all things needed to be able to define ranges. I'm currently doing a deployment so it might take another hour before you will be able to test it.

marchof commented 3 years ago

Hi @HanSolo not sure whether my use case is about range queries: Users are simply interested in the latest updates of a specific feature version that fulfill their requirements (distro, jre/jdk, plarform). Or will this be possible with the following?

version=>=15&version=<16
HanSolo commented 3 years ago

Ah, I think now I got it, sorry, I think I misunderstood. So if I get it right you ask for something like follows: I look for the latest available version of JDK12 for all distributions and you would like to see for example aoj 12.0.2 for all platforms except aix where it should show 12.0.1 (which is the latest for this architecture). Did I get it right?

marchof commented 3 years ago

Exactly! That would be gold. But especially if the user specifically searches for aix the user wants to see 12.0.1 (and not getting an empty result). Maybe this UI gives you an idea:

https://javaalmanac.io/jdk/download/#product=aoj&version=12

If you think this UI can be improved or you had a complete different approach in mind when designing the API I'm happy to change the UI.

HanSolo commented 3 years ago

Ok...got it and I agree that absolutely makes sense, I've started working on that but did not finished yet. Will try to finish asap as it really seems to be a good usecase. Will ping you when it will be in.

HanSolo commented 3 years ago

So I've added another option for latest called "available". If you would call the api with: https://api.foojay.io/disco/v2.0/packages?version=12&distro=aoj&package_type=jdk&latest=available It should give you a list of all packages of distro aoj of type jdk with the latest available version number within JDK12. This would for example show the 12.0.1 for aix but 12.0.2 for mac, linux and windows etc. Currently deploying, might be available within the next hour.

marchof commented 3 years ago

Nice, works as expected. I just pushed the update:

https://javaalmanac.io/jdk/download/#version=12&platform=aix-ppc64

marchof commented 3 years ago

Not sure though whether is works on all cases: For example

https://api.foojay.io/disco/v1.0/packages?distro=aoj&version=9&latest=available

Misses several platforms from the version "9" release.

HanSolo commented 3 years ago

Ok will check, I also saw that it fails for GraalVM based distros but already started fixing it.

HanSolo commented 3 years ago

The problem was that I only checked for packages that are available in multiple versions and left out packages where for example only one version exists. Fixed it and currently deploy a new version which should be available within the next 1-2h

marchof commented 3 years ago

Ok, they show up now!

What is the intended behaviour then the latest option is not specified at all? Previously we received all versions. Now the result set seems to limited to 9 only:

https://api.foojay.io/disco/v1.0/packages?distro=aoj&version=9

HanSolo commented 3 years ago

Yep that is correct because in the former version it was not easily possible to select for example version 9 because it did show all versions. If nothing is set for latest it will try to get the exact given version.

marchof commented 3 years ago

Is there another option to get all releases from a specified feature release? Otherwise I will remove the toggle from my UI, I don't think this is important.

HanSolo commented 3 years ago

You should be able to select all releases from a specific feature release by using e.g. version=9..<10

marchof commented 3 years ago

What would be the correct query? For example

https://api.foojay.io/disco/v1.0/packages?distro=aoj&version=9..<10

Only returns versions "9" but misses "9.0.4".

HanSolo commented 3 years ago

Oh this is only available from version 2.0 so if you change v1.0 to v2.0 you will also get 9.0.4 :)

marchof commented 3 years ago

But on v2.0 can this be combined with latest=available? Looks like

https://api.foojay.io/disco/v2.0/packages?distro=aoj&version=11..%3C12&latest=available

Returns all versions again.

HanSolo commented 3 years ago

Yep the range has priority, so latest=available makes more sense if you simply give it a major version number like version=12 etc.

marchof commented 3 years ago

Ok, I'll keep it simple and always go for latest=available. Should I switch to v2.0 API?

HanSolo commented 3 years ago

Yep I would recommend switching to v2.0 API, it will be made public soon and is the version which will be worked on.