Skip to content

Commit

Permalink
add the name
Browse files Browse the repository at this point in the history
  • Loading branch information
Kemosabert committed Dec 3, 2024
1 parent 39e374f commit 2fa3de5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions syft/internal/packagemetadata/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ var jsonTypes = makeJSONTypes(
jsonNamesWithoutLookup(pkg.RustBinaryAuditEntry{}, "rust-cargo-audit-entry", "RustCargoPackageMetadata"), // the legacy value is split into two types, where the other is preferred
jsonNames(pkg.WordpressPluginEntry{}, "wordpress-plugin-entry", "WordpressMetadata"),
jsonNames(pkg.LuaRocksPackage{}, "luarocks-package"),
jsonNames(pkg.DotnetPackagesLockEntry{}, "dotnet-packages-lock-entry", "DotnetPackagesLockEntry"),
)

func expandLegacyNameVariants(names ...string) []string {
Expand Down
11 changes: 11 additions & 0 deletions syft/internal/packagemetadata/names_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ func TestReflectTypeFromJSONName_LegacyValues(t *testing.T) {
input: "RpmdbMetadata",
expected: reflect.TypeOf(pkg.RpmDBEntry{}),
},
{
name: "map pkg.RpmDBEntry struct type",
input: "RpmdbMetadata",
expected: reflect.TypeOf(pkg.RpmDBEntry{}),
},
// these cases are 1:many
{
name: "map pkg.RpmDBEntry struct type - overlap with RpmArchiveMetadata",
Expand Down Expand Up @@ -317,6 +322,12 @@ func Test_JSONName_JSONLegacyName(t *testing.T) {
expectedJSONName: "dotnet-deps-entry",
expectedLegacyName: "DotnetDepsMetadata",
},
{
name: "DotnetPackagesLockEntry",
metadata: pkg.DotnetPackagesLockEntry{},
expectedJSONName: "dotnet-packages-lock-entry",
expectedLegacyName: "DotnetPackagesLockEntry",
},
{
name: "DotnetPortableExecutableMetadata",
metadata: pkg.DotnetPortableExecutableEntry{},
Expand Down

0 comments on commit 2fa3de5

Please sign in to comment.