Skip to content

Improve NuGet API Parity (#21291) #34940

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

Merged
merged 4 commits into from
Jul 7, 2025

Conversation

ScionOfDesign
Copy link
Contributor

@ScionOfDesign ScionOfDesign commented Jul 3, 2025

Summary

Fixes #21291, allowing icons and other missing attributes to appear for NuGet packages from inside Visual Studio like they do with GitHub Nuget packages.

Adds additional NuGet package information, particularly IconURL, to bring the Gitea NuGet API more in-line with GitHub's NuGet API.

  • Adds the following .nuspec values to the NuGet query responses:
    • copyright
    • iconUrl
      • Adding this allows Visual Studio to display and Icon for the package.
    • isPrerelease
    • language
    • licenseUrl
      • The license now appears in Visual Studio.
    • summary
    • tags
      • Tags now appear in Visual Studio.
    • dependencyGroups
      • Now appears in all requests for a package like with GitHub.
    • totalDownloads
      • Now calculated while gathering the different package versions.
  • Re-orders the values in the response to more closely align with GitHub.

References

Octopus Samples - Examples of NuGet packages being pushed to GitHub.
When querying for packages, Visual Studio makes a request to a route like this one:
https://nuget.pkg.github.com/OctopusSamples/OctopusSamples.accept-message/index.json

Gitea was missing the properties that GitHub responds with.
Both Gitea and Github should now look like the following with the attached package, for example. (Rename it to .nupkg)
image

It should be noted that GitHub also has a boolean property called verified, but this is not part of the NuGet specification.

Please let me know if anything else should be changed.

… bring the Gitea NuGet api more in-line with GitHub's NuGet API.

This allows fixes go-gitea#21291, allowing icons to appear for NuGet packages from inside Visual Studio.
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 3, 2025
@github-actions github-actions bot added modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code labels Jul 3, 2025
@lunny lunny added this to the 1.25.0 milestone Jul 3, 2025
@wxiaoguang
Copy link
Contributor

Can we have some tests? Existing tests are in api_packages_nuget_test.go

@ScionOfDesign
Copy link
Contributor Author

Alright, let me look into updating the tests.

@ScionOfDesign
Copy link
Contributor Author

I have updated the tests to check for the additional values present in the API response.

Copy link
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

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

Thank you very much!

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jul 7, 2025
@wxiaoguang wxiaoguang added the type/enhancement An improvement of existing functionality label Jul 7, 2025
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 7, 2025
@wxiaoguang wxiaoguang enabled auto-merge (squash) July 7, 2025 10:20
@wxiaoguang wxiaoguang merged commit f88800d into go-gitea:main Jul 7, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code topic/packages type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nuget extra Catalog entries
5 participants