Skip to content

Conversation

ahanoff
Copy link
Contributor

@ahanoff ahanoff commented Sep 5, 2025

Fixes #35159

Swift Package Manager expects an 'author.name' field in package metadata, but Gitea was only providing schema.org format fields (givenName, middleName, familyName). This caused SPM to fail with keyNotFound error when fetching package metadata.

Changes:

  • Add 'name' field to Person struct (inherited from https://schema.org/Thing)
  • Populate 'name' field in API response using existing String() method
  • Maintains backward compatibility with existing schema.org fields
  • Provides both formats for maximum compatibility

The fix ensures Swift Package Manager can successfully resolve packages while preserving full schema.org compliance.

Fixes go-gitea#35159

Swift Package Manager expects an 'author.name' field in package metadata,
but Gitea was only providing schema.org format fields (givenName, middleName,
familyName). This caused SPM to fail with keyNotFound error when fetching
package metadata.

Changes:
- Add 'name' field to Person struct (inherited from schema.org Thing)
- Populate 'name' field in API response using existing String() method
- Maintains backward compatibility with existing schema.org fields
- Provides both formats for maximum compatibility

The fix ensures Swift Package Manager can successfully resolve packages
while preserving full schema.org compliance.
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 5, 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 Sep 5, 2025
@wxiaoguang
Copy link
Contributor

Maybe add some tests here ?

assert.Equal(t, packageAuthor, result.Metadata.Author.GivenName)

@techknowlogick techknowlogick added type/bug backport/v1.24 This PR should be backported to Gitea 1.24 labels Sep 5, 2025
@lunny
Copy link
Member

lunny commented Sep 5, 2025

It seems this only resolves the issue when retrieving package information, but not when uploading a package.

@ahanoff ahanoff marked this pull request as draft September 6, 2025 02:42
@ahanoff
Copy link
Contributor Author

ahanoff commented Sep 6, 2025

It seems this only resolves the issue when retrieving package information, but not when uploading a package.

@lunny before I finalize the fix, I want to clarify the intended behavior for the name field in upload package metadata:

Should it be:

  1. A separate field that users can set independently
  2. Always auto-generated from givenName + middleName + familyName
  3. A combination - use explicit name if provided, otherwise generate from components

Which approach aligns better with Gitea's design?

@wxiaoguang
Copy link
Contributor

A combination - use explicit name if provided, otherwise generate from components

I guess the design could be this one? As long as end users can provide the "name" field, then use the value provided by them.

@ahanoff ahanoff force-pushed the fix/swift-package-registry-author-name branch from 3cb1899 to ae68917 Compare September 6, 2025 07:37
@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 Sep 6, 2025
@ahanoff ahanoff marked this pull request as ready for review September 7, 2025 10:25
@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 Sep 7, 2025
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Sep 7, 2025
@lunny lunny enabled auto-merge (squash) September 7, 2025 18:09
@lunny lunny merged commit 87362b4 into go-gitea:main Sep 7, 2025
26 checks passed
@GiteaBot GiteaBot added this to the 1.26.0 milestone Sep 7, 2025
GiteaBot pushed a commit to GiteaBot/gitea that referenced this pull request Sep 7, 2025
…-gitea#35410)

Fixes go-gitea#35159

Swift Package Manager expects an 'author.name' field in package
metadata, but Gitea was only providing schema.org format fields
(givenName, middleName, familyName). This caused SPM to fail with
keyNotFound error when fetching package metadata.

Changes:
- Add 'name' field to Person struct (inherited from
https://schema.org/Thing)
- Populate 'name' field in API response using existing String() method
- Maintains backward compatibility with existing schema.org fields
- Provides both formats for maximum compatibility

The fix ensures Swift Package Manager can successfully resolve packages
while preserving full schema.org compliance.
@GiteaBot GiteaBot added backport/done All backports for this PR have been created and removed reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. labels Sep 7, 2025
wxiaoguang pushed a commit that referenced this pull request Sep 7, 2025
…5410) (#35431)

Backport #35410 by ahanoff

Fixes #35159

Swift Package Manager expects an 'author.name' field in package
metadata, but Gitea was only providing schema.org format fields
(givenName, middleName, familyName). This caused SPM to fail with
keyNotFound error when fetching package metadata.

Changes:
- Add 'name' field to Person struct (inherited from
https://schema.org/Thing)
- Populate 'name' field in API response using existing String() method
- Maintains backward compatibility with existing schema.org fields
- Provides both formats for maximum compatibility

The fix ensures Swift Package Manager can successfully resolve packages
while preserving full schema.org compliance.

Co-authored-by: Akhan Zhakiyanov <[email protected]>
@lunny lunny modified the milestones: 1.26.0, 1.25.0 Sep 7, 2025
zjjhot added a commit to zjjhot/gitea that referenced this pull request Sep 8, 2025
* giteaofficial/main:
  fix: add author.name field to Swift Package Registry API response (go-gitea#35410)
  Update js dependencies (go-gitea#35429)
  Support Node.js 22.6 with type stripping (go-gitea#35427)
  [skip ci] Updated translations via Crowdin
  apply as maintainer (go-gitea#35424)
  Upgrade golang to 1.25.1 and add descriptions for the swagger structs' fields (go-gitea#35418)
  Migrate tools and configs to typescript, require node.js >= 22.18.0 (go-gitea#35421)
  [skip ci] Updated translations via Crowdin
  Switch to `@resvg/resvg-wasm` for `generate-images` (go-gitea#35415)
  fix(webhook/discord): fixed username cannot be empty error (go-gitea#35412)
  add `/.pnpm-store` to .gitignore (go-gitea#35414)
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/v1.24 This PR should be backported to Gitea 1.24 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 type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Author Field Name Inconsistency in Gitea Swift Package Registry
5 participants