diff --git a/sourcebundle/builder.go b/sourcebundle/builder.go index e25d1b1..c120a6b 100644 --- a/sourcebundle/builder.go +++ b/sourcebundle/builder.go @@ -360,7 +360,12 @@ func (b *Builder) findRegistryPackageSource(ctx context.Context, sourceAddr sour } return sourceaddrs.RemoteSource{}, fmt.Errorf("failed to query available versions for %s: %w", pkgAddr, err) } - vs := resp.Versions + + modPackageVersions := resp.Versions + vs := make(versions.List, len(modPackageVersions)) + for _, v := range modPackageVersions { + vs = append(vs, v.Version) + } vs.Sort() availableVersions = vs b.registryPackageVersions[pkgAddr] = availableVersions diff --git a/sourcebundle/builder_test.go b/sourcebundle/builder_test.go index 61cfffc..6404e4d 100644 --- a/sourcebundle/builder_test.go +++ b/sourcebundle/builder_test.go @@ -621,9 +621,11 @@ func testingBuilder(t *testing.T, targetDir string, remotePackages map[string]st if pkg.pkgAddr != pkgAddr { continue } - ret.Versions = make(versions.List, len(pkg.versions)) + ret.Versions = make([]ModulePackageVersion, len(pkg.versions)) for version := range pkg.versions { - ret.Versions = append(ret.Versions, version) + ret.Versions = append(ret.Versions, ModulePackageVersion{ + Version: version, + }) } return ret, nil } diff --git a/sourcebundle/registry_client.go b/sourcebundle/registry_client.go index fa3fc57..7027f68 100644 --- a/sourcebundle/registry_client.go +++ b/sourcebundle/registry_client.go @@ -34,7 +34,17 @@ type RegistryClient interface { // of the package versions client operation. This type may grow to add more // functionality over time in later minor releases. type ModulePackageVersionsResponse struct { - Versions versions.List + Versions []ModulePackageVersion `json:"versions"` +} + +type ModulePackageVersion struct { + Version versions.Version + Deprecation Deprecation `json:"deprecation"` +} + +type Deprecation struct { + Reason string `json:"reason"` + Link string `json:"link"` } // ModulePackageSourceAddrResponse is an opaque type which represents the