Trying to construct PURLs for Swift Package Registry dependencies through MakePURL and BuildPURLString.
Swift registry identifiers use scope.name. For example, the native identifier apple.swift-argument-parser appears in registry HTTP paths as apple/swift-argument-parser.
With v0.1.16, MakePURL has no Swift registry-specific mapping. A caller that splits the HTTP path into namespace and name produces:
pkg:swift/apple/swift-argument-parser@1.8.2
This looks valid but has the wrong meaning. The Swift PURL definition requires the namespace to contain the source host and owner, and the name to contain the repository name. A registry identifier does not necessarily expose that source information.
Steps to reproduce:
- Receive the Swift registry identity apple.swift-argument-parser.
- Represent its HTTP path as apple/swift-argument-parser.
- Construct a Swift PURL from those two components.
- Observe that apple is treated as a source namespace even though it is only the registry scope.
The proxy currently needs this for git-pkgs/proxy#259. The shared package should expose a way to distinguish source coordinates from registry identities. Registry identities should not produce source-based pkg:swift values unless their source repository has been resolved. Tests should cover both apple.swift-argument-parser and a source coordinate such as github.com/apple/swift-argument-parser.
The missing standard representation is already tracked in package-url/purl-spec#929. Until that is resolved, this package should return an explicit unsupported result or use a representation that does not claim the registry scope is a source namespace.
Trying to construct PURLs for Swift Package Registry dependencies through MakePURL and BuildPURLString.
Swift registry identifiers use scope.name. For example, the native identifier apple.swift-argument-parser appears in registry HTTP paths as apple/swift-argument-parser.
With v0.1.16, MakePURL has no Swift registry-specific mapping. A caller that splits the HTTP path into namespace and name produces:
This looks valid but has the wrong meaning. The Swift PURL definition requires the namespace to contain the source host and owner, and the name to contain the repository name. A registry identifier does not necessarily expose that source information.
Steps to reproduce:
The proxy currently needs this for git-pkgs/proxy#259. The shared package should expose a way to distinguish source coordinates from registry identities. Registry identities should not produce source-based pkg:swift values unless their source repository has been resolved. Tests should cover both apple.swift-argument-parser and a source coordinate such as github.com/apple/swift-argument-parser.
The missing standard representation is already tracked in package-url/purl-spec#929. Until that is resolved, this package should return an explicit unsupported result or use a representation that does not claim the registry scope is a source namespace.