Could the server always return arrays of releases?
io7m opened this issue · 6 comments
Take a look at the output of https://api.adoptopenjdk.net/openjdk8-openj9/releases:
{
"release_name": "jdk8u152-b16",
"timestamp": "2018-01-31T11:41:36Z",
"binaries": [
{
"platform": "Linux ppc64le",
"binary_name": "OpenJDK8-OPENJ9_ppc64le_Linux_jdk8u152-b16.tar.gz",
"binary_link": "https://github.com/AdoptOpenJDK/openjdk8-openj9-releases/releases/download/jdk8u152-b16/OpenJDK8-OPENJ9_ppc64le_Linux_jdk8u152-b16.tar.gz",
"binary_size": "78 MB",
"checksum_link": "https://github.com/AdoptOpenJDK/openjdk8-openj9-releases/releases/download/jdk8u152-b16/OpenJDK8-OPENJ9_ppc64le_Linux_jdk8u152-b16.sha256.txt"
},
...
Now take a look at the output of https://api.adoptopenjdk.net/openjdk8/releases:
[
{
"release_name": "jdk8u144-b01",
"timestamp": "2017-07-27T22:01:53Z",
"binaries": [
{
"platform": "Linux aarch64",
"binary_name": "OpenJDK8_aarch64_Linux_jdk8u144-b01.tar.gz",
"binary_link": "https://github.com/AdoptOpenJDK/openjdk8-releases/releases/download/jdk8u144-b01/OpenJDK8_aarch64_Linux_jdk8u144-b01.tar.gz",
"binary_size": "72 MB",
"checksum_link": "https://github.com/AdoptOpenJDK/openjdk8-releases/releases/download/jdk8u144-b01/OpenJDK8_aarch64_Linux_jdk8u144-b01.sha256.txt"
},
...
Note that the endpoint returns an array when there's more than one release. The problem with this is that if you think of the endpoint as a method call, then the type of the method changes based on how many releases there are... I feel like it'd be cleaner if the endpoint could commit to always returning an array, even if there's only a single element.
Hmm yeah, this seems like a bug... we should be able to fix it
'Ello.
Any movement on this? It's still causing the Java API test suite to fail. If this isn't going to change any time soon, I can probably update the Java API to be tolerant of receiving objects in addition to arrays.
I've allowed the v1 implementation to accept objects in addition to arrays. I'm currently blocked on #75 as it's not possible to produce an API with equivalent functionality without that info.
For specifically this issue, I believe any request to the v2 api that has the possibility to return more than 1 request will return an array. As for the v1 api, I dont think any more changes are going to go into it, so this issue should probably be closed