Skip to content
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

Swift fails to resolve from package registry #29094

Closed
CEnnis91 opened this issue Feb 8, 2024 · 1 comment · Fixed by #29095
Closed

Swift fails to resolve from package registry #29094

CEnnis91 opened this issue Feb 8, 2024 · 1 comment · Fixed by #29095

Comments

@CEnnis91
Copy link
Contributor

CEnnis91 commented Feb 8, 2024

Description

Resolving swift packages (swift package resolve) against the Gitea package registry fails:

error: 'scope.name': Failed fetching release checksum from registry: keyNotFound(CodingKeys(stringValue: "name", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "resources", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0)], debugDescription: "No value associated with key CodingKeys(stringValue: "name", intValue: nil) ("name").", underlyingError: nil))

The issue comes from the Resource struct found here sending id in place of name.

type Resource struct {
	Name     string `json:"id"`
	Type     string `json:"type"`
	Checksum string `json:"checksum"`
}

I double checked to see if the specification changed or if this was just a typo. As far as I can tell, this was always meant to be name and not id (it seems to have been established here), so it's probably just a typo and not a breaking change.


For completeness:

.swiftpm/configuration/registries.json:

{
  "authentication" : {
    "gitea.example.com" : {
      "type" : "token"
    }
  },
  "registries" : {
    "[default]" : {
      "url" : "https://gitea.example.com/api/packages/user/swift"
    }
  },
  "version" : 1
}

Package.swift:

// swift-tools-version:5.8.1

import PackageDescription

let package = Package(
    name: "ExamplePackage",
    dependencies: [
        .package(id: "scope.name", from: "1.0.0")
    ]
)

Gitea Version

1.21.4

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

docker and command line

Database

None

@lunny lunny added this to the 1.21.6 milestone Feb 8, 2024
lunny pushed a commit that referenced this issue Feb 8, 2024
CEnnis91 added a commit to CEnnis91/gitea that referenced this issue Feb 8, 2024
silverwind pushed a commit to silverwind/gitea that referenced this issue Feb 20, 2024
6543 pushed a commit to 6543-forks/gitea that referenced this issue Feb 26, 2024
Copy link

Automatically locked because of our CONTRIBUTING guidelines

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants