Skip to content

Swift registry metadata: preserve submitted JSON fields (repositoryURLs/licenseURL) and accept empty metadata payloads#37254

Merged
wxiaoguang merged 10 commits intomainfrom
copilot/fix-issue37246-add-tests
Apr 17, 2026
Merged

Swift registry metadata: preserve submitted JSON fields (repositoryURLs/licenseURL) and accept empty metadata payloads#37254
wxiaoguang merged 10 commits intomainfrom
copilot/fix-issue37246-add-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 17, 2026

Description

Swift package upload/metadata handling diverged from the registry schema in multiple ways: user-provided metadata fields were not fully reflected back, and empty JSON metadata needed to be accepted cleanly. This change aligns upload+read behavior with those expectations and adds regression coverage.

  • Metadata round-trip behavior

    • GET .../swift/{scope}/{name}/{version} now returns metadata.repositoryURLs from stored Swift version properties (all submitted URLs, not just one).
    • GET .../swift/{scope}/{name}/{version} now returns metadata.licenseURL when provided in upload metadata JSON.
    • metadata.author is now omitted when no author data exists, instead of returning an empty Person object.
  • Empty JSON metadata handling

    • Parsing safely handles metadata={} (and null) without producing invalid/empty-author artifacts.
    • Uploads with empty metadata continue to succeed while still extracting manifests from the source archive.
  • Regression coverage

    • Integration tests now verify:
      • user-provided metadata JSON is preserved in API output (repositoryURLs, licenseURL),
      • empty metadata JSON uploads succeed and return empty/omitted optional metadata fields.
    • Unit tests add explicit coverage for metadata parsing of licenseURL and empty JSON metadata.
type SoftwareSourceCode struct {
    // ...
    Author         *Person  `json:"author,omitempty"`
    RepositoryURLs []string `json:"repositoryURLs,omitempty"`
    LicenseURL     string   `json:"licenseURL,omitempty"`
}

Testing

  • make fmt
  • go test ./modules/packages/swift
  • make 'test-sqlite#TestPackageSwift'
  • ✅ Parallel validation (Code Review + CodeQL)

Copilot AI and others added 2 commits April 17, 2026 13:43
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 17, 2026
@wxiaoguang wxiaoguang linked an issue Apr 17, 2026 that may be closed by this pull request
@wxiaoguang wxiaoguang marked this pull request as ready for review April 17, 2026 14:38
@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 Apr 17, 2026
@wxiaoguang wxiaoguang added the backport/v1.26 This PR should be backported to Gitea 1.26 label Apr 17, 2026
@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 Apr 17, 2026
@wxiaoguang wxiaoguang enabled auto-merge (squash) April 17, 2026 16:28
@wxiaoguang wxiaoguang marked this pull request as draft April 17, 2026 16:41
auto-merge was automatically disabled April 17, 2026 16:41

Pull request was converted to draft

@wxiaoguang
Copy link
Copy Markdown
Contributor

Double checked, licenseURL is still missing.

@copilot Also need to add licenseURL support, the sample data is like this (besides repositoryURLs and author fields)

{
  "description": "One thing links to another.",
  "repositoryURLs": ["https://github.com/mona/LinkedList"],
  "licenseURL": "https://www.apache.org/licenses/LICENSE-2.0",
  "author": {
      "name": "Mona Lisa Octocat"
  }
}

Co-Authored-By: Copilot GPT-5.4 <copilot-gpt-5.4@users.noreply.github.com>

Co-authored-by: wxiaoguang <2114189+wxiaoguang@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 17, 2026

Double checked, licenseURL is still missing.

...

Implemented in ffe068b: Swift upload/response metadata now supports licenseURL end-to-end (parse, persist, and return in package version metadata), and tests were updated to cover it in both unit and integration paths. Authorship: Copilot GPT-5.4.

@wxiaoguang wxiaoguang marked this pull request as ready for review April 17, 2026 16:51
Copilot AI changed the title Swift registry metadata: preserve submitted JSON fields and accept empty metadata payloads Swift registry metadata: preserve submitted JSON fields (repositoryURLs/licenseURL) and accept empty metadata payloads Apr 17, 2026
Copilot AI requested a review from wxiaoguang April 17, 2026 16:51
@bircni bircni added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 17, 2026
@wxiaoguang wxiaoguang merged commit e43422b into main Apr 17, 2026
30 checks passed
@wxiaoguang wxiaoguang deleted the copilot/fix-issue37246-add-tests branch April 17, 2026 20:16
@GiteaBot GiteaBot added this to the 1.27.0 milestone Apr 17, 2026
wxiaoguang pushed a commit to wxiaoguang/gitea that referenced this pull request Apr 17, 2026
@wxiaoguang wxiaoguang added backport/done All backports for this PR have been created backport/manual No power to the bots! Create your backport yourself! labels Apr 17, 2026
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 17, 2026
wxiaoguang pushed a commit to wxiaoguang/gitea that referenced this pull request Apr 17, 2026
silverwind pushed a commit that referenced this pull request Apr 17, 2026
…etadata (#37254) (#37261)

Backport #37254

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 20, 2026
* main: (25 commits)
  Add WebKit to e2e test matrix (go-gitea#37298)
  Don't add useless labels which will bother changelog generation (go-gitea#37267)
  Fix Repository transferring page (go-gitea#37277)
  Stabilize issue-project e2e test, increase timeout factor (go-gitea#37297)
  Fix Mermaid diagrams failing when node labels contain line breaks (go-gitea#37296)
  Add project column picker to issue and pull request sidebar (go-gitea#37037)
  Fix container auth for public instance (go-gitea#37290)
  Refactor frontend `tw-justify-between` layouts to `flex-left-right` (go-gitea#37291)
  Update Nix flake (go-gitea#37284)
  Workflow Artifact Info Hover (go-gitea#37100)
  [skip ci] Updated translations via Crowdin
  release notes for 1.26.0 (go-gitea#37282)
  Enhance GetActionWorkflow to support fallback references (go-gitea#37189)
  Refactor LDAP tests (go-gitea#37274)
  Remove `SubmitEvent` polyfill (go-gitea#37276)
  Upgrade go-git to v5.18.0 (go-gitea#37268)
  Avoid top-level await (go-gitea#37272)
  Frontend iframe renderer framework: 3D models, OpenAPI (go-gitea#37233)
  pull: Fix CODEOWNERS absolute path matching. (go-gitea#37244)
  Swift registry metadata: preserve more JSON fields and accept empty metadata (go-gitea#37254)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/done All backports for this PR have been created backport/manual No power to the bots! Create your backport yourself! backport/v1.26 This PR should be backported to Gitea 1.26 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect Swift package manifest schema

6 participants