GlitchEnzo / NuGetForUnity

A NuGet Package Manager for Unity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Artifactory issues vi APIv3

igor84 opened this issue · comments

It seems Artifactory is not following the standards completely and so NugetForUnity does not work with it at the moment.

  1. The first issue is that NugetForUnity only recognized a Source as V3 if it ends with index.json but Artifactory nuget url looks like this: https://artifactory.in.mycompany.com/artifactory/api/nuget/v3/mycompany-nuget-local. We need to also recognize source as V3 if its url contains '/v3/'. We should also add the '/' at the end if it is not entered since currently it doesn't work unless slash is manually added.
  2. Second issue is that NugetApiClientV3.InitializeApiAddresses method will not find PackageBaseAddress/3.0.0 resource type which will log the The NuGet package source at '{0}' has no PackageBaseAddress resource defined. error and package download will not work. I will attach the Artifactory response in case someone figures out a better way but it seems none of the links there specify a proper download link which looks something like this: https://artifactory.in.mycompany.com:443/artifactory/api/nuget/mycompany-nuget-local/Download/mycompany.litjson/1.0.87. I got to this URL by first finding @id field of the specific package version in query response to be https://artifactory.in.mycompany.com:443/artifactory/api/nuget/v3/mycompany-nuget-local/registration/mycompany.litjson/1.0.87.json and then after opening that url the packageContent field had the download URL. It seems that same fields can be followed on main nuget repository.
  3. Third issue is that artifactory doesn't support queries in form of packageId:ID1 packageId:ID2, and I can't figure out how to make a query like that work. I thought I saw it worked when I used comma instead but it seems the response was not right. Comma does not work with main nuget repo anyway so we have to figure out what to do here. The change should be made in NugetPackageSourceV3.GetUpdates.

I was planning to test / implement artifactoty support tomorrow. I also found out that the URL is non standard, I will planned to use protocolVersion="3" like in the standard nuget.config format.

We can use PackageVersionDisplayMetadataUriTemplate/3.0.0-rc -> packageContent instead of PackageBaseAddress.
Fortunately all other APIs nuget.pkg.github.com / pkgs.dev.azure.com seam to support PackageBaseAddress see https://github.com/joelverhagen/data-nuget-service-index

It still requires one additional request per download so I guess it doesn't matter which one we choose...