From fceb4ce57473ca12d835789cf759ce9d3556735d Mon Sep 17 00:00:00 2001 From: Tushar Goel Date: Sun, 31 Aug 2025 09:08:35 +0530 Subject: [PATCH 01/11] Add validation tests Signed-off-by: Tushar Goel --- schemas/purl-test.schema.json | 40 ++++++++- tests/types/alpm-test.json | 98 ++++++++++++++++++++++ tests/types/apk-test.json | 101 ++++++++++++++++++++++ tests/types/bitbucket-test.json | 62 ++++++++++++++ tests/types/bitnami-test.json | 66 +++++++++++++++ tests/types/cargo-test.json | 58 +++++++++++++ tests/types/cocoapods-test.json | 58 +++++++++++++ tests/types/composer-test.json | 90 ++++++++++++++++++++ tests/types/conan-test.json | 85 +++++++++++++++++++ tests/types/conda-test.json | 65 ++++++++++++++ tests/types/cpan-test.json | 135 ++++++++++++++++++++++++++++++ tests/types/cran-test.json | 58 +++++++++++++ tests/types/deb-test.json | 83 ++++++++++++++++++ tests/types/docker-test.json | 78 +++++++++++++++++ tests/types/gem-test.json | 76 +++++++++++++++++ tests/types/generic-test.json | 91 ++++++++++++++++++++ tests/types/github-test.json | 44 ++++++++++ tests/types/golang-test.json | 76 ++++++++++++++++- tests/types/hackage-test.json | 86 +++++++++++++++++++ tests/types/hex-test.json | 114 +++++++++++++++++++++++++ tests/types/huggingface-test.json | 58 +++++++++++++ tests/types/luarocks-test.json | 76 +++++++++++++++++ tests/types/maven-test.json | 95 +++++++++++++++++++++ tests/types/mlflow-test.json | 98 ++++++++++++++++++++++ tests/types/npm-test.json | 72 ++++++++++++++++ tests/types/nuget-test.json | 84 +++++++++++++++++++ tests/types/oci-test.json | 120 ++++++++++++++++++++++++++ tests/types/pub-test.json | 74 +++++++++++++++- tests/types/pypi-test.json | 88 +++++++++++++++++++ tests/types/qpkg-test.json | 74 ++++++++++++++++ tests/types/rpm-test.json | 88 +++++++++++++++++++ tests/types/swid-test.json | 98 ++++++++++++++++++++++ tests/types/swift-test.json | 58 +++++++++++++ 33 files changed, 2643 insertions(+), 4 deletions(-) diff --git a/schemas/purl-test.schema.json b/schemas/purl-test.schema.json index baa6eade..5b60c0a8 100644 --- a/schemas/purl-test.schema.json +++ b/schemas/purl-test.schema.json @@ -104,12 +104,14 @@ "enum": [ "build", "parse", - "roundtrip" + "roundtrip", + "validation" ], "meta:enum": { "build": "A PURL building test from decoded components to a canonical PURL string.", "parse": "A PURL building test from decoded components to a canonical PURL string.", - "roundtrip": "A PURL roundtrip test, parsing then building back a PURL from a canonical string input." + "roundtrip": "A PURL roundtrip test, parsing then building back a PURL from a canonical string input.", + "validation": "A PURL validation test, checking if a PURL follows all the rules for a particular ecosystem." } }, "expected_failure": { @@ -126,7 +128,16 @@ "string", "null" ] + }, + "expected_messages": { + "title": "Expected messages", + "description": "Validation messages expected for this test. Can be null or a list of strings.", + "default": null, + "type": ["null", "array"], + "items": { + "type": "string" } + } }, "allOf": [ { @@ -284,6 +295,31 @@ "expected_failure_reason" ] } + }, + { + "if": { + "properties": { + "test_type": { "const": "validation" } + }, + "required": ["test_type"] + }, + "then": { + "properties": { + "input": { + "title": "Expected decoded PURL components", + "description": "Test input as an object with decoded PURL components for validation.", + "$ref": "#/definitions/purl_components" + }, + "expected_messages": { + "title": "Expected messages", + "description": "Validation messages expected for this test. Can be null or a list of strings.", + "default": null, + "type": ["null", "array"], + "items": { "type": "string" } + } + }, + "required": ["input"] + } } ] } diff --git a/tests/types/alpm-test.json b/tests/types/alpm-test.json index 92d75e74..248a513d 100644 --- a/tests/types/alpm-test.json +++ b/tests/types/alpm-test.json @@ -135,6 +135,104 @@ "expected_output": "pkg:alpm/arch/containers-common@1:0.47.4-4?arch=x86_64", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid alpm package with arch qualifier", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "alpm", + "namespace": "arch", + "name": "pacman", + "version": "6.0.1-1", + "qualifiers": { + "arch": "x86_64" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "alpm package with uppercase nmamespace", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "alpm", + "namespace": "Arch", + "name": "pacman", + "version": "6.0.1-1", + "qualifiers": { + "arch": "x86_64" + }, + "subpath": null + }, + "expected_messages": ["Namespace is not lowercased for purl type: 'alpm'"] + }, + { + "description": "alpm package with uppercase nmamespace (advanced)", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "alpm", + "namespace": "Arch", + "name": "pacman", + "version": "6.0.1-1", + "qualifiers": { + "arch": "x86_64" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid alpm package with 'any' arch", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "alpm", + "namespace": "arch", + "name": "python-pip", + "version": "21.0-1", + "qualifiers": { + "arch": "any" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid alpm package with epoch in version", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "alpm", + "namespace": "arch", + "name": "containers-common", + "version": "1:0.47.4-4", + "qualifiers": { + "arch": "x86_64" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "alpm package missing namespace", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "alpm", + "namespace": null, + "name": "pacman", + "version": "6.0.1-1", + "qualifiers": { + "arch": "x86_64" + }, + "subpath": null + }, + "expected_messages": [ + "Namespace is required for purl type: 'alpm'" + ] } ] } diff --git a/tests/types/apk-test.json b/tests/types/apk-test.json index a2f4506e..a4c45725 100644 --- a/tests/types/apk-test.json +++ b/tests/types/apk-test.json @@ -90,6 +90,107 @@ "expected_output": "pkg:apk/alpine/apk@2.12.9-r3?arch=x86", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid apk package with arch qualifier", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "apk", + "namespace": "alpine", + "name": "curl", + "version": "7.83.0-r0", + "qualifiers": { + "arch": "x86" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid apk package with higher version and arch qualifier", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "apk", + "namespace": "alpine", + "name": "apk", + "version": "2.12.9-r3", + "qualifiers": { + "arch": "x86" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid apk package with openwrt vendor", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "apk", + "namespace": "openwrt", + "name": "busybox", + "version": "1.35.0-r5", + "qualifiers": { + "arch": "mips" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "apk package missing namespace", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "apk", + "namespace": null, + "name": "curl", + "version": "7.83.0-r0", + "qualifiers": { + "arch": "x86" + }, + "subpath": null + }, + "expected_messages": [ + "Namespace is required for purl type: 'apk'" + ] + }, + { + "description": "apk package with uppercase namespace and name", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "apk", + "namespace": "FOO", + "name": "BAR", + "version": "7.83.0-r0", + "qualifiers": { + "arch": "x86" + }, + "subpath": null + }, + "expected_messages": [ + "Namespace is not lowercased for purl type: 'apk'", + "Name is not lowercased for purl type: 'apk'" + ] + }, + { + "description": "apk package with uppercase namespace and name (advanced)", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "apk", + "namespace": "FOO", + "name": "BAR", + "version": "7.83.0-r0", + "qualifiers": { + "arch": "x86" + }, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/bitbucket-test.json b/tests/types/bitbucket-test.json index 8bc5c017..9e21211a 100644 --- a/tests/types/bitbucket-test.json +++ b/tests/types/bitbucket-test.json @@ -91,6 +91,68 @@ "expected_output": "pkg:bitbucket/birkenfeld/pygments-main@244fd47e07d1014f0aed9c", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid Bitbucket package with commit hash as version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "bitbucket", + "namespace": "birkenfeld", + "name": "pygments-main", + "version": "244fd47e07d1014f0aed9c", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid Bitbucket package with subpath", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "bitbucket", + "namespace": "teamname", + "name": "repo-name", + "version": "1.0.0", + "qualifiers": null, + "subpath": "src/main" + }, + "expected_messages": null + }, + { + "description": "Valid Bitbucket package with qualifiers", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "bitbucket", + "namespace": "company", + "name": "service", + "version": "release-2024", + "qualifiers": { + "arch": "x86_64", + "os": "linux" + }, + "subpath": null + }, + "expected_messages": ["Invalid qualifiers found: arch, os. Allowed qualifiers are: repository_url"] + }, + { + "description": "Valid Bitbucket package with qualifiers", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "bitbucket", + "namespace": "company", + "name": "service", + "version": "release-2024", + "qualifiers": { + "arch": "x86_64", + "os": "linux" + }, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/bitnami-test.json b/tests/types/bitnami-test.json index 497e7f1e..4c2bd396 100644 --- a/tests/types/bitnami-test.json +++ b/tests/types/bitnami-test.json @@ -184,6 +184,72 @@ "expected_output": "pkg:bitnami/wordpress@6.2.0?arch=arm64&distro=photon-4", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid Bitnami package without version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "bitnami", + "namespace": null, + "name": "wordpress", + "version": null, + "qualifiers": { + "distro": "debian-12" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid Bitnami package with version and distro", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "bitnami", + "namespace": null, + "name": "wordpress", + "version": "6.2.0", + "qualifiers": { + "distro": "debian-12" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid Bitnami package with arch and distro", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "bitnami", + "namespace": null, + "name": "wordpress", + "version": "6.2.0", + "qualifiers": { + "arch": "arm64", + "distro": "debian-12" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid Bitnami package with another distro", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "bitnami", + "namespace": null, + "name": "wordpress", + "version": "6.2.0", + "qualifiers": { + "arch": "arm64", + "distro": "photon-4" + }, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/cargo-test.json b/tests/types/cargo-test.json index d29d89f8..334e36c2 100644 --- a/tests/types/cargo-test.json +++ b/tests/types/cargo-test.json @@ -123,6 +123,64 @@ "expected_output": "pkg:cargo/structopt@0.3.11", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid Cargo package with name and version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "cargo", + "namespace": null, + "name": "rand", + "version": "0.7.2", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid Cargo package with another example", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "cargo", + "namespace": null, + "name": "clap", + "version": "2.33.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Cargo package without version", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "cargo", + "namespace": null, + "name": "structopt", + "version": null, + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Cargo package with namespace (not allowed)", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "cargo", + "namespace": "rustlang", + "name": "serde", + "version": "1.0.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [ + "Namespace is prohibited for purl type: 'cargo'" + ] } ] } diff --git a/tests/types/cocoapods-test.json b/tests/types/cocoapods-test.json index 82ddde5f..cb0e688e 100644 --- a/tests/types/cocoapods-test.json +++ b/tests/types/cocoapods-test.json @@ -164,6 +164,64 @@ "expected_output": "pkg:cocoapods/GoogleUtilities@7.5.2#NSData%2Bzlib", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid CocoaPods package with name and version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "cocoapods", + "namespace": null, + "name": "AFNetworking", + "version": "4.0.1", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid CocoaPods package with subspec in subpath", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "cocoapods", + "namespace": null, + "name": "GoogleUtilities", + "version": "7.5.2", + "qualifiers": null, + "subpath": "NSData+zlib" + }, + "expected_messages": [] + }, + { + "description": "CocoaPods package without version", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "cocoapods", + "namespace": null, + "name": "MapsIndoors", + "version": null, + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "CocoaPods package with namespace (not allowed)", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "cocoapods", + "namespace": "apple", + "name": "ShareKit", + "version": "2.0", + "qualifiers": null, + "subpath": "Twitter" + }, + "expected_messages": [ + "Namespace is prohibited for purl type: 'cocoapods'" + ] } ] } diff --git a/tests/types/composer-test.json b/tests/types/composer-test.json index 9e37fd22..269f7b91 100644 --- a/tests/types/composer-test.json +++ b/tests/types/composer-test.json @@ -116,6 +116,96 @@ "expected_output": "pkg:composer/laravel/laravel@5.5.0", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid Composer package with vendor, name, and version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "composer", + "namespace": "laravel", + "name": "laravel", + "version": "5.5.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Composer package without version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "composer", + "namespace": "symfony", + "name": "console", + "version": null, + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Composer package with uppercase namespace (should normalize to lowercase)", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "composer", + "namespace": "Laravel", + "name": "Framework", + "version": "10.0.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [ + "Namespace is not lowercased for purl type: 'composer'", "Name is not lowercased for purl type: 'composer'" + ] + }, + { + "description": "Composer package with uppercase namespace (should normalize to lowercase)", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "composer", + "namespace": "Laravel", + "name": "Framework", + "version": "10.0.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Composer package missing namespace", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "composer", + "namespace": null, + "name": "console", + "version": "5.0.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [ + "Namespace is required for purl type: 'composer'" + ] + }, + { + "description": "Composer package with qualifiers", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "composer", + "namespace": "laravel", + "name": "laravel", + "version": "5.5.0", + "qualifiers": { + "repository_url": "https://packagist.org" + }, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/conan-test.json b/tests/types/conan-test.json index b8dcbba2..e90a9fb4 100644 --- a/tests/types/conan-test.json +++ b/tests/types/conan-test.json @@ -323,6 +323,91 @@ "expected_output": "pkg:conan/openssl.org/openssl@3.0.3?arch=x86_64&build_type=Debug&compiler=Visual%20Studio&compiler.runtime=MDd&compiler.version=16&os=Windows&prev=b429db8a0e324114c25ec387bfd8281f330d7c5c&rrev=93a82349c31917d2d674d22065c7a9ef9f380c8e&shared=True", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid Conan package with name and version only", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "conan", + "namespace": null, + "name": "openssl", + "version": "3.0.3", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid Conan package with namespace (vendor) and qualifiers user+channel", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "conan", + "namespace": "openssl.org", + "name": "openssl", + "version": "3.0.3", + "qualifiers": { + "user": "bincrafters", + "channel": "stable" + }, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid Conan package with namespace, complex qualifiers including rrev and prev", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "conan", + "namespace": "openssl.org", + "name": "openssl", + "version": "3.0.3", + "qualifiers": { + "arch": "x86_64", + "build_type": "Debug", + "compiler": "Visual Studio", + "compiler.runtime": "MDd", + "compiler.version": "16", + "os": "Windows", + "shared": "True", + "rrev": "93a82349c31917d2d674d22065c7a9ef9f380c8e", + "prev": "b429db8a0e324114c25ec387bfd8281f330d7c5c" + }, + "subpath": null + }, + "expected_messages": ["Invalid qualifiers found: arch, build_type, compiler, compiler.runtime, compiler.version, os, shared. Allowed qualifiers are: channel, prev, repository_url, rrev, user"] + }, + { + "description": "Valid Conan package with only namespace and no qualifiers", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "conan", + "namespace": "openssl.org", + "name": "openssl", + "version": "3.0.3", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Conan package with unsupported qualifier key", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "conan", + "namespace": null, + "name": "openssl", + "version": "3.0.3", + "qualifiers": { + "foo": "bar" + }, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/conda-test.json b/tests/types/conda-test.json index a148142e..c143a10f 100644 --- a/tests/types/conda-test.json +++ b/tests/types/conda-test.json @@ -111,6 +111,71 @@ "expected_output": "pkg:conda/absl-py@0.4.1?build=py36h06a4308_0&channel=main&subdir=linux-64&type=tar.bz2", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid Conda package with name and version only", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "conda", + "namespace": null, + "name": "absl-py", + "version": "0.4.1", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid Conda package with full qualifiers (build, channel, subdir, type)", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "conda", + "namespace": null, + "name": "absl-py", + "version": "0.4.1", + "qualifiers": { + "build": "py36h06a4308_0", + "channel": "main", + "subdir": "linux-64", + "type": "tar.bz2" + }, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Conda package with namespace (not allowed)", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "conda", + "namespace": "anaconda", + "name": "absl-py", + "version": "0.4.1", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [ + "Namespace is prohibited for purl type: 'conda'" + ] + }, + { + "description": "Conda package with unsupported qualifier", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "conda", + "namespace": null, + "name": "absl-py", + "version": "0.4.1", + "qualifiers": { + "foo": "bar" + }, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/cpan-test.json b/tests/types/cpan-test.json index fdbc00d8..fefa88f4 100644 --- a/tests/types/cpan-test.json +++ b/tests/types/cpan-test.json @@ -555,6 +555,141 @@ "expected_output": "pkg:cpan/URI", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid CPAN module without namespace", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "cpan", + "namespace": null, + "name": "Perl::Version", + "version": "1.013", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid CPAN distribution with uppercase namespace (author ID)", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "cpan", + "namespace": "DROLSKY", + "name": "DateTime", + "version": "1.55", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid CPAN distribution without version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "cpan", + "namespace": "GDT", + "name": "URI-PackageURL", + "version": null, + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid CPAN module with :: in name and no namespace", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "cpan", + "namespace": null, + "name": "LWP::UserAgent", + "version": null, + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "CPAN distribution with lowercase namespace (must be uppercase)", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "cpan", + "namespace": "oalders", + "name": "libwww-perl", + "version": "6.76", + "qualifiers": null, + "subpath": null + }, + "expected_messages": ["Namespace must be uppercase for purl type: 'cpan'"] + }, + { + "description": "CPAN distribution with lowercase namespace (must be uppercase)", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "cpan", + "namespace": "oalders", + "name": "libwww-perl", + "version": "6.76", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "CPAN module with '-' in name (not allowed without namespace)", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "cpan", + "namespace": null, + "name": "libwww-perl", + "version": "6.76", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [ + "Name must not contain '-' when Namespace is absent for purl type: 'cpan'" + ] + }, + { + "description": "CPAN distribution name containing '::' (not allowed with namespace)", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "cpan", + "namespace": "TESTUSER", + "name": "Bad::Dist", + "version": "1.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [ + "Name must not contain '::' when Namespace is absent for purl type: 'cpan'" + ] + }, + { + "description": "Valid CPAN package with qualifiers (repository_url, download_url, vcs_url)", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "cpan", + "namespace": "OALDERS", + "name": "libwww-perl", + "version": "6.76", + "qualifiers": { + "repository_url": "https://cpan.metacpan.org", + "download_url": "https://cpan.metacpan.org/authors/id/O/OA/OALDERS/libwww-perl-6.76.tar.gz", + "vcs_url": "https://github.com/libwww-perl", + "ext": "tar.gz" + }, + "subpath": null + }, + "expected_messages": [] } ] } diff --git a/tests/types/cran-test.json b/tests/types/cran-test.json index d027639a..4043acaa 100644 --- a/tests/types/cran-test.json +++ b/tests/types/cran-test.json @@ -241,6 +241,64 @@ "expected_output": "pkg:cran/caret@6.0-88", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid CRAN package with name and version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "cran", + "namespace": null, + "name": "A3", + "version": "1.0.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid CRAN package with hyphen in version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "cran", + "namespace": null, + "name": "rJava", + "version": "1.0-4", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid CRAN package with complex version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "cran", + "namespace": null, + "name": "caret", + "version": "6.0-88", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "CRAN package with namespace (not allowed)", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "cran", + "namespace": "ml", + "name": "caret", + "version": "6.0-88", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [ + "Namespace is prohibited for purl type: 'cran'" + ] } ] } diff --git a/tests/types/deb-test.json b/tests/types/deb-test.json index 55b5fb90..983a0bc6 100644 --- a/tests/types/deb-test.json +++ b/tests/types/deb-test.json @@ -285,6 +285,89 @@ "expected_output": "pkg:deb/debian/attr@1:2.4.47-2%2Bb1?arch=amd64", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid deb package with vendor, name, version, and arch", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "deb", + "namespace": "debian", + "name": "curl", + "version": "7.50.3-1", + "qualifiers": { + "arch": "i386", + "distro": "jessie" + }, + "subpath": null + }, + "expected_messages": ["Invalid qualifiers found: distro. Allowed qualifiers are: arch, repository_url"] + }, + { + "description": "Valid deb package with vendor, name, version, without distro", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "deb", + "namespace": "ubuntu", + "name": "dpkg", + "version": "1.19.0.4", + "qualifiers": { + "arch": "amd64" + }, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid deb source package", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "deb", + "namespace": "debian", + "name": "attr", + "version": "1:2.4.47-2", + "qualifiers": { + "arch": "source" + }, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Deb package missing vendor", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "deb", + "namespace": null, + "name": "curl", + "version": "7.50.3-1", + "qualifiers": { + "arch": "amd64" + }, + "subpath": null + }, + "expected_messages": [ + "Namespace is required for purl type: 'deb'" + ] + }, + { + "description": "deb package with unsupported qualifier", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "deb", + "namespace": "debian", + "name": "curl", + "version": "7.50.3-1", + "qualifiers": { + "foo": "bar" + }, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/docker-test.json b/tests/types/docker-test.json index 0ecb38df..c91870a7 100644 --- a/tests/types/docker-test.json +++ b/tests/types/docker-test.json @@ -181,6 +181,84 @@ "expected_output": "pkg:docker/customer/dockerimage@sha256:244fd47e07d10?repository_url=gcr.io", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid Docker image with tag only", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "docker", + "namespace": null, + "name": "cassandra", + "version": "latest", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid Docker image with namespace and sha256 digest", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "docker", + "namespace": "smartentry", + "name": "debian", + "version": "dc437cc87d10", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid Docker image with repository_url qualifier", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "docker", + "namespace": "customer", + "name": "dockerimage", + "version": "sha256:244fd47e07d10", + "qualifiers": { + "repository_url": "gcr.io" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Docker image with unsupported qualifier", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "docker", + "namespace": null, + "name": "ubuntu", + "version": "20.04", + "qualifiers": { + "bad": "value" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Docker image with unsupported qualifier", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "docker", + "namespace": null, + "name": "ubuntu", + "version": "20.04", + "qualifiers": { + "bad": "value" + }, + "subpath": null + }, + "expected_messages": [ + "Invalid qualifiers found: bad. Allowed qualifiers are: repository_url" + ] } ] } diff --git a/tests/types/gem-test.json b/tests/types/gem-test.json index 0f2df1bd..db66c9ef 100644 --- a/tests/types/gem-test.json +++ b/tests/types/gem-test.json @@ -140,6 +140,82 @@ "expected_output": "pkg:gem/jruby-launcher@1.1.2?platform=java", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid RubyGem with default platform", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "gem", + "namespace": null, + "name": "ruby-advisory-db-check", + "version": "0.12.4", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid RubyGem with java platform", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "gem", + "namespace": null, + "name": "jruby-launcher", + "version": "1.1.2", + "qualifiers": { + "platform": "java" + }, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Subpath included", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "gem", + "namespace": null, + "name": "nokogiri", + "version": "1.14.3", + "qualifiers": null, + "subpath": "lib/nokogiri.rb" + }, + "expected_messages": [] + }, + { + "description": "Extra unknown qualifier", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "gem", + "namespace": null, + "name": "sinatra", + "version": "3.1.2", + "qualifiers": { + "unknown": "value" + }, + "subpath": null + }, + "expected_messages": ["Invalid qualifiers found: unknown. Allowed qualifiers are: platform, repository_url"] + }, + { + "description": "Extra unknown qualifier", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "gem", + "namespace": null, + "name": "sinatra", + "version": "3.1.2", + "qualifiers": { + "unknown": "value" + }, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/generic-test.json b/tests/types/generic-test.json index cefb0062..b58f17a4 100644 --- a/tests/types/generic-test.json +++ b/tests/types/generic-test.json @@ -133,6 +133,97 @@ "expected_output": "pkg:generic/bitwarderl?vcs_url=git%2Bhttps://git.fsfe.org/dxtr/bitwarderl%40cc55108da32", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid generic package with version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "generic", + "namespace": null, + "name": "openssl", + "version": "1.1.10g", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid generic package with download_url and checksum", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "generic", + "namespace": null, + "name": "openssl", + "version": "1.1.10g", + "qualifiers": { + "download_url": "https://openssl.org/source/openssl-1.1.0g.tar.gz", + "checksum": "sha256:de4d501267da" + }, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid generic package with vcs_url", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "generic", + "namespace": null, + "name": "bitwarderl", + "version": null, + "qualifiers": { + "vcs_url": "git+https://git.fsfe.org/dxtr/bitwarderl@cc55108da32" + }, + "subpath": null + }, + "expected_messages": ["Invalid qualifiers found: vcs_url. Allowed qualifiers are: checksum, download_url"] + }, + { + "description": "Extra unknown qualifier", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "generic", + "namespace": null, + "name": "mypkg", + "version": "3.0.0", + "qualifiers": { + "foo": "bar" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Subpath included", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "generic", + "namespace": null, + "name": "libexample", + "version": "0.5.2", + "qualifiers": null, + "subpath": "src/libexample.c" + }, + "expected_messages": [] + }, + { + "description": "Missing version and no qualifiers", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "generic", + "namespace": null, + "name": "noversionpkg", + "version": null, + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] } ] } diff --git a/tests/types/github-test.json b/tests/types/github-test.json index fa2c8811..bef95f9b 100644 --- a/tests/types/github-test.json +++ b/tests/types/github-test.json @@ -132,6 +132,50 @@ "expected_output": "pkg:github/package-url/purl-spec@244fd47e07d1004#everybody/loves/dogs", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid GitHub package with namespace, name, and version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "github", + "namespace": "package-url", + "name": "purl-spec", + "version": "244fd47e07d1004", + "subpath": null, + "qualifiers": {} + }, + "expected_messages": [] + }, + { + "description": "Valid GitHub package with subpath", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "github", + "namespace": "package-url", + "name": "purl-spec", + "version": "244fd47e07d1004", + "subpath": "everybody/loves/dogs", + "qualifiers": {} + }, + "expected_messages": [] + }, + { + "description": "GitHub package missing namespace", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "github", + "namespace": null, + "name": "purl-spec", + "version": "244fd47e07d1004", + "subpath": null, + "qualifiers": {} + }, + "expected_messages": [ + "Namespace is required for purl type: 'github'" + ] } ] } diff --git a/tests/types/golang-test.json b/tests/types/golang-test.json index 11da72b4..487dcd53 100644 --- a/tests/types/golang-test.json +++ b/tests/types/golang-test.json @@ -223,6 +223,80 @@ "expected_output": "pkg:golang/github.com/gorilla/context@234fd47e07d1004f0aed9c#api", "expected_failure": false, "expected_failure_reason": null - } + }, + { + "description": "Valid golang package with namespace, name, and version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "golang", + "namespace": "github.com/gorilla", + "name": "context", + "version": "234fd47e07d1004f0aed9c", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid golang package with namespace and name only (no version)", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "golang", + "namespace": "golang.org/x", + "name": "crypto", + "version": null, + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid golang package with subpath", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "golang", + "namespace": "google.golang.org", + "name": "genproto", + "version": null, + "qualifiers": null, + "subpath": "googleapis/api/annotations" + }, + "expected_messages": [] + }, + { + "description": "Golang package with uppercase namespace", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "golang", + "namespace": "GitHub.com/Gorilla", + "name": "context", + "version": "234fd47e07d1004f0aed9c", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [ + "Namespace is not lowercased for purl type: 'golang'" + ] + }, + { + "description": "Golang package with missing namespace", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "golang", + "namespace": null, + "name": "context", + "version": "234fd47e07d1004f0aed9c", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [ + "Namespace is required for purl type: 'golang'" + ] + } ] } diff --git a/tests/types/hackage-test.json b/tests/types/hackage-test.json index d8d88cfe..f88066c9 100644 --- a/tests/types/hackage-test.json +++ b/tests/types/hackage-test.json @@ -207,6 +207,92 @@ "expected_output": "pkg:hackage/3d-graphics-examples@0.0.0.2", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid Hackage package with simple kebab-case name", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "hackage", + "namespace": null, + "name": "lens", + "version": "5.0.1", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid Hackage package with uppercase letters", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "hackage", + "namespace": null, + "name": "AC-HalfInteger", + "version": "1.2.1", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid Hackage package with numbers and dots in version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "hackage", + "namespace": null, + "name": "3d-graphics-examples", + "version": "0.0.0.2", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Hackage package with namespace included", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "hackage", + "namespace": "haskell", + "name": "text", + "version": "1.2.4", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [ + "Namespace is prohibited for purl type: 'hackage'" + ] + }, + { + "description": "Hackage package with name not in kebab-case", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "hackage", + "namespace": null, + "name": "My_Package", + "version": "0.1", + "qualifiers": null, + "subpath": null + }, + "expected_messages": ["Name contains underscores but should be kebab-case for purl type: 'hackage'"] + }, + { + "description": "Hackage package with name not in kebab-case", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "hackage", + "namespace": null, + "name": "My_Package", + "version": "0.1", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/hex-test.json b/tests/types/hex-test.json index 5d58d636..a6fe85ca 100644 --- a/tests/types/hex-test.json +++ b/tests/types/hex-test.json @@ -168,6 +168,120 @@ "expected_output": "pkg:hex/bar@1.2.3?repository_url=https://myrepo.example.com", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid Hex package with lowercase name", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "hex", + "namespace": null, + "name": "jason", + "version": "1.1.2", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid Hex package with optional namespace", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "hex", + "namespace": "acme", + "name": "foo", + "version": "2.3.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid Hex package with subpath", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "hex", + "namespace": null, + "name": "phoenix_html", + "version": "2.13.3", + "qualifiers": null, + "subpath": "priv/static/phoenix_html.js" + }, + "expected_messages": null + }, + { + "description": "Valid Hex package with repository_url qualifier", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "hex", + "namespace": null, + "name": "bar", + "version": "1.2.3", + "qualifiers": { + "repository_url": "https://myrepo.example.com" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Hex package with uppercase name", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "hex", + "namespace": null, + "name": "Phoenix_HTML", + "version": "1.0.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": ["Name is not lowercased for purl type: 'hex'"] + }, + { + "description": "Hex package with uppercase name", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "hex", + "namespace": null, + "name": "Phoenix_HTML", + "version": "1.0.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Hex package with uppercase namespace", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "hex", + "namespace": "ACME", + "name": "foo", + "version": "1.0.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": ["Namespace is not lowercased for purl type: 'hex'"] + }, + { + "description": "Hex package with uppercase namespace", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "hex", + "namespace": "ACME", + "name": "foo", + "version": "1.0.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/huggingface-test.json b/tests/types/huggingface-test.json index 4849193a..b05734fe 100644 --- a/tests/types/huggingface-test.json +++ b/tests/types/huggingface-test.json @@ -240,6 +240,64 @@ "expected_output": "pkg:huggingface/microsoft/deberta-v3-base@559062ad13d311b87b2c455e67dcd5f1c8f65111?repository_url=https://hub-ci.huggingface.co", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid minimal Hugging Face model", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "huggingface", + "namespace": null, + "name": "distilbert-base-uncased", + "version": "043235d6088ecd3dd5fb5ca3592b6913fd516027", + "qualifiers": null, + "subpath": null + }, + "expected_messages": ["Namespace is required for purl type: 'huggingface'"] + }, + { + "description": "Valid Hugging Face model with namespace", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "huggingface", + "namespace": "microsoft", + "name": "deberta-v3-base", + "version": "559062ad13d311b87b2c455e67dcd5f1c8f65111", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid Hugging Face model with subpath", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "huggingface", + "namespace": "EleutherAI", + "name": "gpt-neo-1.3B", + "version": "797174552ae47f449ab70b684cabcb6603e5e85e", + "qualifiers": null, + "subpath": "tokenizer/config.json" + }, + "expected_messages": [] + }, + { + "description": "Valid Hugging Face model with repository_url qualifier", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "huggingface", + "namespace": "EleutherAI", + "name": "gpt-neo-1.3B", + "version": "797174552ae47f449ab70b684cabcb6603e5e85e", + "qualifiers": { + "repository_url": "https://hub-ci.huggingface.co" + }, + "subpath": null + }, + "expected_messages": [] } ] } diff --git a/tests/types/luarocks-test.json b/tests/types/luarocks-test.json index a822563f..c90d4c65 100644 --- a/tests/types/luarocks-test.json +++ b/tests/types/luarocks-test.json @@ -127,6 +127,82 @@ "expected_output": "pkg:luarocks/username/packagename@0.1.0-1?repository_url=https://example.com/private_rocks_server/", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid LuaRocks package with only name and version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "luarocks", + "namespace": null, + "name": "luasocket", + "version": "3.1.0-1", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid LuaRocks package with namespace and version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "luarocks", + "namespace": "hisham", + "name": "luafilesystem", + "version": "1.8.0-1", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid LuaRocks package with private repository_url qualifier", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "luarocks", + "namespace": "username", + "name": "packagename", + "version": "0.1.0-1", + "qualifiers": { + "repository_url": "https://example.com/private_rocks_server/" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Unsupported qualifier is provided", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "luarocks", + "namespace": "username", + "name": "packagename", + "version": "0.1.0-1", + "qualifiers": { + "channel": "beta" + }, + "subpath": null + }, + "expected_messages": ["Invalid qualifiers found: channel. Allowed qualifiers are: repository_url"] + }, + { + "description": "Advanced validation for name with uppercase letters", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "luarocks", + "namespace": null, + "name": "LuaSocket", + "version": "3.1.0-1", + "qualifiers": { + "private_url": "https://example.com/private_rocks_server/" + }, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/maven-test.json b/tests/types/maven-test.json index 3fea512f..62a12921 100644 --- a/tests/types/maven-test.json +++ b/tests/types/maven-test.json @@ -898,6 +898,101 @@ "expected_output": "pkg:maven/groovy/groovy@1.0?repository_url=https://maven.google.com", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid Maven package with groupId, artifactId, and version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "maven", + "namespace": "org.apache.xmlgraphics", + "name": "batik-anim", + "version": "1.9.1", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid Maven package with type qualifier (pom)", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "maven", + "namespace": "org.apache.xmlgraphics", + "name": "batik-anim", + "version": "1.9.1", + "qualifiers": { + "type": "pom" + }, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid Maven package with classifier qualifier (sources)", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "maven", + "namespace": "org.apache.xmlgraphics", + "name": "batik-anim", + "version": "1.9.1", + "qualifiers": { + "classifier": "sources" + }, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid Maven package with both type and classifier qualifiers", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "maven", + "namespace": "org.apache.xmlgraphics", + "name": "batik-anim", + "version": "1.9.1", + "qualifiers": { + "type": "zip", + "classifier": "dist" + }, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid Maven package with repository_url qualifier", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "maven", + "namespace": "groovy", + "name": "groovy", + "version": "1.0", + "qualifiers": { + "repository_url": "https://maven.google.com" + }, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Maven package missing namespace (groupId required)", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "maven", + "namespace": null, + "name": "batik-anim", + "version": "1.9.1", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [ + "Namespace is required for purl type: 'maven'" + ] } ] } diff --git a/tests/types/mlflow-test.json b/tests/types/mlflow-test.json index 9b1ed365..fed73337 100644 --- a/tests/types/mlflow-test.json +++ b/tests/types/mlflow-test.json @@ -260,6 +260,104 @@ "expected_output": "pkg:mlflow/trafficsigns@10?model_uuid=36233173b22f4c89b451f1228d700d49&repository_url=https://adb-5245952564735461.0.azuredatabricks.net/api/2.0/mlflow&run_id=410a3121-2709-4f88-98dd-dba0ef056b0a", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid MLflow package with name and version only", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "mlflow", + "namespace": null, + "name": "creditfraud", + "version": "3", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid MLflow package with repository_url qualifier", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "mlflow", + "namespace": null, + "name": "creditfraud", + "version": "3", + "qualifiers": { + "repository_url": "https://westus2.api.azureml.ms/mlflow/v1.0/subscriptions/a50f2011-fab8-4164-af23-c62881ef8c95/resourceGroups/TestResourceGroup/providers/Microsoft.MachineLearningServices/workspaces/TestWorkspace" + }, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid MLflow package with model_uuid and run_id qualifiers", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "mlflow", + "namespace": null, + "name": "trafficsigns", + "version": "10", + "qualifiers": { + "model_uuid": "36233173b22f4c89b451f1228d700d49", + "run_id": "410a3121-2709-4f88-98dd-dba0ef056b0a", + "repository_url": "https://adb-5245952564735461.0.azuredatabricks.net/api/2.0/mlflow" + }, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "MLflow package with namespace (not allowed)", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "mlflow", + "namespace": "azure", + "name": "creditfraud", + "version": "3", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [ + "Namespace is prohibited for purl type: 'mlflow'" + ] + }, + { + "description": "MLflow package with unsupported qualifier", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "mlflow", + "namespace": null, + "name": "creditfraud", + "version": "3", + "qualifiers": { + "foo": "bar" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "MLflow package with unsupported qualifier", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "mlflow", + "namespace": null, + "name": "creditfraud", + "version": "3", + "qualifiers": { + "foo": "bar" + }, + "subpath": null + }, + "expected_messages": [ + "Invalid qualifiers found: foo. Allowed qualifiers are: model_uuid, repository_url, run_id" + ] } ] } diff --git a/tests/types/npm-test.json b/tests/types/npm-test.json index 7167f42d..43cb55a7 100644 --- a/tests/types/npm-test.json +++ b/tests/types/npm-test.json @@ -254,6 +254,78 @@ "expected_output": "pkg:npm/core@2.0.1#googleapis/api/annotations", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid npm package without scope", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "npm", + "namespace": null, + "name": "foobar", + "version": "12.3.1", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid npm package with scope", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "npm", + "namespace": "%40angular", + "name": "animation", + "version": "12.3.1", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid npm package with qualifier vcs_url", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "npm", + "namespace": null, + "name": "mypackage", + "version": "12.4.5", + "qualifiers": { + "vcs_url": "git://host.com/path/to/repo.git%404345abcd34343" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "npm package with uppercase name", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "npm", + "namespace": null, + "name": "MyPackage", + "version": "1.0.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": ["Name is not lowercased for purl type: 'npm'"] + }, + { + "description": "npm package with uppercase name", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "npm", + "namespace": null, + "name": "MyPackage", + "version": "1.0.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/nuget-test.json b/tests/types/nuget-test.json index 67d97916..caab63f8 100644 --- a/tests/types/nuget-test.json +++ b/tests/types/nuget-test.json @@ -91,6 +91,90 @@ "expected_output": "pkg:nuget/EnterpriseLibrary.Common@6.0.1304", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid NuGet package with name and version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "nuget", + "namespace": null, + "name": "EnterpriseLibrary.Common", + "version": "6.0.1304", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid NuGet package with lowercase name", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "nuget", + "namespace": null, + "name": "newtonsoft.json", + "version": "13.0.3", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "NuGet package without version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "nuget", + "namespace": null, + "name": "NUnit", + "version": null, + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "NuGet package with namespace (should be prohibited)", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "nuget", + "namespace": "microsoft", + "name": "aspnetcore.mvc", + "version": "2.2.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": ["Namespace is prohibited for purl type: 'nuget'"] + }, + { + "description": "NuGet package with pre-release version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "nuget", + "namespace": null, + "name": "EntityFramework", + "version": "7.0.0-preview.2", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "NuGet package with 4-part version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "nuget", + "namespace": null, + "name": "System.Data.SqlClient", + "version": "4.8.5.1234", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/oci-test.json b/tests/types/oci-test.json index 2072ed20..08b43773 100644 --- a/tests/types/oci-test.json +++ b/tests/types/oci-test.json @@ -188,6 +188,126 @@ "expected_output": "pkg:oci/hello-wasm@sha256:244fd47e07d10?tag=v1", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid OCI package with repository_url, arch, and tag", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "oci", + "namespace": null, + "name": "debian", + "version": "sha256:244fd47e07d10", + "qualifiers": { + "repository_url": "docker.io/library/debian", + "arch": "amd64", + "tag": "latest" + }, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid OCI package with repository_url and tag only", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "oci", + "namespace": null, + "name": "debian", + "version": "sha256:244fd47e07d10", + "qualifiers": { + "repository_url": "ghcr.io/debian", + "tag": "bullseye" + }, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid OCI package without repository_url (allowed, registry agnostic)", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "oci", + "namespace": null, + "name": "hello-wasm", + "version": "sha256:244fd47e07d10", + "qualifiers": { + "tag": "v1" + }, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "OCI package with namespace provided (prohibited)", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "oci", + "namespace": "library", + "name": "debian", + "version": "sha256:244fd47e07d10", + "qualifiers": { + "repository_url": "docker.io/library/debian" + }, + "subpath": null + }, + "expected_messages": [ + "Namespace is prohibited for purl type: 'oci'" + ] + }, + { + "description": "OCI package with missing version (required digest)", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "oci", + "namespace": null, + "name": "debian", + "version": null, + "qualifiers": { + "repository_url": "docker.io/library/debian", + "tag": "latest" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "OCI package with uppercase name", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "oci", + "namespace": null, + "name": "Debian", + "version": "sha256:244fd47e07d10", + "qualifiers": { + "repository_url": "docker.io/library/debian" + }, + "subpath": null + }, + "expected_messages": [ + "Name is not lowercased for purl type: 'oci'" + ] + }, + { + "description": "OCI package with uppercase name", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "oci", + "namespace": null, + "name": "Debian", + "version": "sha256:244fd47e07d10", + "qualifiers": { + "repository_url": "docker.io/library/debian" + }, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/pub-test.json b/tests/types/pub-test.json index ef8daf24..09ed05ef 100644 --- a/tests/types/pub-test.json +++ b/tests/types/pub-test.json @@ -82,6 +82,78 @@ "expected_output": "pkg:pub/flutter@0.0.0", "expected_failure": false, "expected_failure_reason": null - } + }, + { + "description": "Valid pub package with version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "pub", + "namespace": null, + "name": "characters", + "version": "1.2.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid pub package without version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "pub", + "namespace": null, + "name": "flutter", + "version": null, + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Pub package with uppercase letters", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "pub", + "namespace": null, + "name": "Flutter", + "version": "1.0.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": ["Name is not lowercased for purl type: 'pub'", "Name contains invalid characters but should only contain lowercase letters, digits, or underscores for purl type: 'pub'"] + }, + { + "description": "Pub package with hyphen", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "pub", + "namespace": null, + "name": "http-client", + "version": "0.13.6", + "qualifiers": null, + "subpath": null + }, + "expected_messages": ["Name contains invalid characters but should only contain lowercase letters, digits, or underscores for purl type: 'pub'"] + }, + { + "description": "Pub package with qualifiers", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "pub", + "namespace": null, + "name": "characters", + "version": "1.2.0", + "qualifiers": { + "repository_url": "https://pub.dev" + }, + "subpath": null + }, + "expected_messages": null + } ] } diff --git a/tests/types/pypi-test.json b/tests/types/pypi-test.json index 23eb979d..07705ee5 100644 --- a/tests/types/pypi-test.json +++ b/tests/types/pypi-test.json @@ -222,6 +222,94 @@ "expected_output": "pkg:pypi/django-allauth@12.23", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid PyPI package with version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "pypi", + "namespace": null, + "name": "django", + "version": "1.11.1", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid PyPI package with file_name qualifier", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "pypi", + "namespace": null, + "name": "django", + "version": "1.11.1", + "qualifiers": { + "file_name": "Django-1.11.1.tar.gz" + }, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "Valid PyPI package with wheel file_name", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "pypi", + "namespace": null, + "name": "django", + "version": "1.11.1", + "qualifiers": { + "file_name": "Django-1.11.1-py2.py3-none-any.whl" + }, + "subpath": null + }, + "expected_messages": [] + }, + { + "description": "PyPI package with name containing underscores and dots", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "pypi", + "namespace": null, + "name": "django_allauth", + "version": "12.23", + "qualifiers": null, + "subpath": null + }, + "expected_messages": ["Name cannot contain `_` for purl type:'pypi'"] + }, + { + "description": "PyPI package with name containing underscores and dots", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "pypi", + "namespace": null, + "name": "django_allauth", + "version": "12.23", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Name with uppercase letters", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "pypi", + "namespace": null, + "name": "Django-AllAuth", + "version": "12.23", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/qpkg-test.json b/tests/types/qpkg-test.json index 9450bf3d..b5c9dd3b 100644 --- a/tests/types/qpkg-test.json +++ b/tests/types/qpkg-test.json @@ -82,6 +82,80 @@ "expected_output": "pkg:qpkg/blackberry/com.qnx.qnx710.foo.bar.qux@0.0.4.01449T202205040833L", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid QPKG with vendor and version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "qpkg", + "namespace": "blackberry", + "name": "com.qnx.sdp", + "version": "7.0.0.SGA201702151847", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid QPKG with complex name and version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "qpkg", + "namespace": "blackberry", + "name": "com.qnx.qnx710.foo.bar.qux", + "version": "0.0.4.01449T202205040833L", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid QPKG with repository_url qualifier", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "qpkg", + "namespace": "blackberry", + "name": "com.qnx.sdp", + "version": "7.0.0", + "qualifiers": { + "repository_url": "https://example.com/qpkg" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "QPKG missing vendor (namespace)", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "qpkg", + "namespace": null, + "name": "com.qnx.sdp", + "version": "7.0.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": [ + "Namespace is required for purl type: 'qpkg'" + ] + }, + { + "description": "Namespace should be lowercased", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "qpkg", + "namespace": "BlackBerry", + "name": "com.qnx.sdp", + "version": "7.0.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/rpm-test.json b/tests/types/rpm-test.json index d940a7d8..a1a7ed34 100644 --- a/tests/types/rpm-test.json +++ b/tests/types/rpm-test.json @@ -152,6 +152,94 @@ "expected_output": "pkg:rpm/centerim@4.22.10-1.el6?arch=i686&distro=fedora-25&epoch=1", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid RPM with vendor, name, version and arch", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "rpm", + "namespace": "fedora", + "name": "curl", + "version": "7.50.3-1.fc25", + "qualifiers": { + "arch": "i386" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid RPM with epoch qualifier", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "rpm", + "namespace": "fedora", + "name": "centerim", + "version": "4.22.10-1.el6", + "qualifiers": { + "arch": "i686", + "epoch": "1", + "distro": "fedora-25" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "RPM missing vendor (namespace)", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "rpm", + "namespace": null, + "name": "curl", + "version": "7.50.3-1.fc25", + "qualifiers": { + "arch": "i386", + "distro": "fedora-25" + }, + "subpath": null + }, + "expected_messages": [ + "Namespace is required for purl type: 'rpm'", + "Invalid qualifiers found: distro. Allowed qualifiers are: arch, epoch, repository_url" + ] + }, + { + "description": "Valid RPM without version", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "rpm", + "namespace": "opensuse", + "name": "zsh", + "version": null, + "qualifiers": { + "arch": "x86_64", + "distro": "opensuse-15.3" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid RPM with repository_url instead of distro", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "rpm", + "namespace": "centos", + "name": "vim", + "version": "8.0-1.el7", + "qualifiers": { + "arch": "x86_64", + "repository_url": "https://mirror.centos.org/centos/7/os/x86_64" + }, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/swid-test.json b/tests/types/swid-test.json index 1312a6a3..9716f654 100644 --- a/tests/types/swid-test.json +++ b/tests/types/swid-test.json @@ -135,6 +135,104 @@ "expected_output": "pkg:swid/Adobe%2BSystems%2BIncorporated/Adobe%2BInDesign@CC?tag_id=CreativeCloud-CS6-Win-GM-MUL", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid SWID with namespace, name, version and tag_id", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "swid", + "namespace": "Acme", + "name": "example.com/Enterprise+Server", + "version": "1.0.0", + "qualifiers": { + "tag_id": "75b8c285-fa7b-485b-b199-4745e3004d0d" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid SWID with only name and tag_id (no namespace)", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "swid", + "namespace": null, + "name": "Fedora", + "version": "29", + "qualifiers": { + "tag_id": "org.fedoraproject.Fedora-29" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid SWID with tag_creator_name and tag_creator_regid qualifiers", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "swid", + "namespace": "Adobe Systems Incorporated", + "name": "Adobe InDesign", + "version": "CC", + "qualifiers": { + "tag_id": "CreativeCloud-CS6-Win-GM-MUL", + "tag_creator_name": "AdobeCorp", + "tag_creator_regid": "com.adobe" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "SWID missing required tag_id qualifier", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "swid", + "namespace": "Acme", + "name": "example.com/Enterprise+Server", + "version": "1.0.0", + "qualifiers": {}, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "SWID with empty tag_id", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "swid", + "namespace": "Acme", + "name": "example.com/Enterprise+Server", + "version": "1.0.0", + "qualifiers": { + "tag_id": "" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid SWID with optional patch and tag_version", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "swid", + "namespace": "Acme", + "name": "example.com/Enterprise+Server", + "version": "1.0.0", + "qualifiers": { + "tag_id": "75b8c285-fa7b-485b-b199-4745e3004d0d", + "tag_version": "3", + "patch": "true" + }, + "subpath": null + }, + "expected_messages": null } ] } diff --git a/tests/types/swift-test.json b/tests/types/swift-test.json index ef3d1fb1..7f6dd00b 100644 --- a/tests/types/swift-test.json +++ b/tests/types/swift-test.json @@ -234,6 +234,64 @@ "expected_output": "pkg:swift/github.com/RxSwiftCommunity/RxFlow@2.12.4", "expected_failure": false, "expected_failure_reason": null + }, + { + "description": "Valid Swift package with namespace, name, and version", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "swift", + "namespace": "github.com/Alamofire", + "name": "Alamofire", + "version": "5.4.3", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "namespace is missing", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "swift", + "namespace": null, + "name": "Alamofire", + "version": "5.4.3", + "qualifiers": null, + "subpath": null + }, + "expected_messages": ["Namespace is required for purl type: 'swift'"] + }, + { + "description": "unsupported qualifier is provided", + "test_group": "base", + "test_type": "validation", + "input": { + "type": "swift", + "namespace": "github.com/Alamofire", + "name": "Alamofire", + "version": "5.4.3", + "qualifiers": { + "repository_url": "https://swiftpm.example.com/" + }, + "subpath": null + }, + "expected_messages": null + }, + { + "description": "Valid Swift package with case-sensitive namespace and name", + "test_group": "advanced", + "test_type": "validation", + "input": { + "type": "swift", + "namespace": "GitHub.com/SomeOrg", + "name": "MyLibrary", + "version": "1.0.0", + "qualifiers": null, + "subpath": null + }, + "expected_messages": null } ] } From 9f32657806e8ea1b6649ef20c7b01024e2749227 Mon Sep 17 00:00:00 2001 From: Tushar Goel Date: Wed, 3 Sep 2025 11:57:31 +0530 Subject: [PATCH 02/11] Remove unknown qualifiers check Signed-off-by: Tushar Goel --- tests/types/bitbucket-test.json | 2 +- tests/types/conan-test.json | 2 +- tests/types/deb-test.json | 2 +- tests/types/docker-test.json | 4 +--- tests/types/gem-test.json | 2 +- tests/types/generic-test.json | 2 +- tests/types/luarocks-test.json | 2 +- tests/types/mlflow-test.json | 4 +--- tests/types/rpm-test.json | 1 - 9 files changed, 8 insertions(+), 13 deletions(-) diff --git a/tests/types/bitbucket-test.json b/tests/types/bitbucket-test.json index 9e21211a..9c61d420 100644 --- a/tests/types/bitbucket-test.json +++ b/tests/types/bitbucket-test.json @@ -135,7 +135,7 @@ }, "subpath": null }, - "expected_messages": ["Invalid qualifiers found: arch, os. Allowed qualifiers are: repository_url"] + "expected_messages": null }, { "description": "Valid Bitbucket package with qualifiers", diff --git a/tests/types/conan-test.json b/tests/types/conan-test.json index e90a9fb4..fa64e0c2 100644 --- a/tests/types/conan-test.json +++ b/tests/types/conan-test.json @@ -377,7 +377,7 @@ }, "subpath": null }, - "expected_messages": ["Invalid qualifiers found: arch, build_type, compiler, compiler.runtime, compiler.version, os, shared. Allowed qualifiers are: channel, prev, repository_url, rrev, user"] + "expected_messages": null }, { "description": "Valid Conan package with only namespace and no qualifiers", diff --git a/tests/types/deb-test.json b/tests/types/deb-test.json index 983a0bc6..d5b720f6 100644 --- a/tests/types/deb-test.json +++ b/tests/types/deb-test.json @@ -301,7 +301,7 @@ }, "subpath": null }, - "expected_messages": ["Invalid qualifiers found: distro. Allowed qualifiers are: arch, repository_url"] + "expected_messages": null }, { "description": "Valid deb package with vendor, name, version, without distro", diff --git a/tests/types/docker-test.json b/tests/types/docker-test.json index c91870a7..7da1466a 100644 --- a/tests/types/docker-test.json +++ b/tests/types/docker-test.json @@ -256,9 +256,7 @@ }, "subpath": null }, - "expected_messages": [ - "Invalid qualifiers found: bad. Allowed qualifiers are: repository_url" - ] + "expected_messages": null } ] } diff --git a/tests/types/gem-test.json b/tests/types/gem-test.json index db66c9ef..ed367d49 100644 --- a/tests/types/gem-test.json +++ b/tests/types/gem-test.json @@ -199,7 +199,7 @@ }, "subpath": null }, - "expected_messages": ["Invalid qualifiers found: unknown. Allowed qualifiers are: platform, repository_url"] + "expected_messages": null }, { "description": "Extra unknown qualifier", diff --git a/tests/types/generic-test.json b/tests/types/generic-test.json index b58f17a4..81bf4473 100644 --- a/tests/types/generic-test.json +++ b/tests/types/generic-test.json @@ -179,7 +179,7 @@ }, "subpath": null }, - "expected_messages": ["Invalid qualifiers found: vcs_url. Allowed qualifiers are: checksum, download_url"] + "expected_messages": null }, { "description": "Extra unknown qualifier", diff --git a/tests/types/luarocks-test.json b/tests/types/luarocks-test.json index c90d4c65..bfe60564 100644 --- a/tests/types/luarocks-test.json +++ b/tests/types/luarocks-test.json @@ -186,7 +186,7 @@ }, "subpath": null }, - "expected_messages": ["Invalid qualifiers found: channel. Allowed qualifiers are: repository_url"] + "expected_messages": null }, { "description": "Advanced validation for name with uppercase letters", diff --git a/tests/types/mlflow-test.json b/tests/types/mlflow-test.json index fed73337..64c83f0d 100644 --- a/tests/types/mlflow-test.json +++ b/tests/types/mlflow-test.json @@ -355,9 +355,7 @@ }, "subpath": null }, - "expected_messages": [ - "Invalid qualifiers found: foo. Allowed qualifiers are: model_uuid, repository_url, run_id" - ] + "expected_messages": null } ] } diff --git a/tests/types/rpm-test.json b/tests/types/rpm-test.json index a1a7ed34..73f3aa50 100644 --- a/tests/types/rpm-test.json +++ b/tests/types/rpm-test.json @@ -204,7 +204,6 @@ }, "expected_messages": [ "Namespace is required for purl type: 'rpm'", - "Invalid qualifiers found: distro. Allowed qualifiers are: arch, epoch, repository_url" ] }, { From d55e6a7bd2c6ad1319cf1900a0dc6360ad4dd779 Mon Sep 17 00:00:00 2001 From: Tushar Goel Date: Wed, 3 Sep 2025 17:51:54 +0530 Subject: [PATCH 03/11] Add new schema Signed-off-by: Tushar Goel --- schemas/purl-test.schema.json | 89 +++++++++++++++++++++++++++++------ 1 file changed, 75 insertions(+), 14 deletions(-) diff --git a/schemas/purl-test.schema.json b/schemas/purl-test.schema.json index 5b60c0a8..2d9d85d7 100644 --- a/schemas/purl-test.schema.json +++ b/schemas/purl-test.schema.json @@ -68,6 +68,34 @@ } } }, + "purl_validation_message": { + "title": "PURL validation message", + "description": "Validation severity and message to use as a test expected output when validating a PURL.", + "type": "object", + "additionalProperties": false, + "properties": { + "severity": { + "title": "Validation severity", + "description": "Validation severity.", + "type": "string", + "enum": [ + "info", + "warning", + "error" + ], + "meta:enum": { + "info": "Informational validation message", + "warning": "Warning validation message", + "error": "Error validation message" + } + }, + "message": { + "title": "Validation message", + "description": "Validation message.", + "type": "string" + } + } + }, "purl_test": { "title": "PURL test", "description": "A PURL test with input and expected output.", @@ -128,16 +156,7 @@ "string", "null" ] - }, - "expected_messages": { - "title": "Expected messages", - "description": "Validation messages expected for this test. Can be null or a list of strings.", - "default": null, - "type": ["null", "array"], - "items": { - "type": "string" } - } }, "allOf": [ { @@ -299,9 +318,44 @@ { "if": { "properties": { - "test_type": { "const": "validation" } + "test_type": { + "const": "validation" + } }, - "required": ["test_type"] + "required": [ + "test_type" + ] + }, + "then": { + "properties": { + "input": { + "title": "Input test PURL", + "description": "A PURL string to use as a test input (canonical or not).", + "type": "string" + }, + "expected_output": { + "title": "Expected validation messages and severities", + "description": "List of validation objects with message and severity expected for this test. Can be an empty list.", + "type": "array", + "$ref": "#/definitions/purl_validation_message" + } + }, + "required": [ + "input", + "expected_output" + ] + } + }, + { + "if": { + "properties": { + "test_type": { + "const": "validation" + } + }, + "required": [ + "test_type" + ] }, "then": { "properties": { @@ -314,11 +368,18 @@ "title": "Expected messages", "description": "Validation messages expected for this test. Can be null or a list of strings.", "default": null, - "type": ["null", "array"], - "items": { "type": "string" } + "type": [ + "null", + "array" + ], + "items": { + "type": "string" + } } }, - "required": ["input"] + "required": [ + "input" + ] } } ] From 4a6a64393bce8f7b18ccfcbda025862797d0d904 Mon Sep 17 00:00:00 2001 From: Tushar Goel Date: Wed, 3 Sep 2025 18:05:39 +0530 Subject: [PATCH 04/11] Change input to purl string Signed-off-by: Tushar Goel --- tests/types/alpm-test.json | 70 ++++-------------------- tests/types/apk-test.json | 66 +++-------------------- tests/types/bitbucket-test.json | 42 ++------------- tests/types/bitnami-test.json | 46 ++-------------- tests/types/cargo-test.json | 36 ++----------- tests/types/cocoapods-test.json | 36 ++----------- tests/types/composer-test.json | 59 +++----------------- tests/types/conan-test.json | 60 ++------------------- tests/types/conda-test.json | 43 ++------------- tests/types/cpan-test.json | 90 +++++-------------------------- tests/types/cran-test.json | 36 ++----------- tests/types/deb-test.json | 56 ++----------------- tests/types/docker-test.json | 51 ++---------------- tests/types/gem-test.json | 51 ++---------------- tests/types/generic-test.json | 61 +++------------------ tests/types/github-test.json | 27 ++-------- tests/types/golang-test.json | 47 +++------------- tests/types/hackage-test.json | 58 ++++---------------- tests/types/hex-test.json | 82 +++++----------------------- tests/types/huggingface-test.json | 42 +++------------ tests/types/luarocks-test.json | 51 ++---------------- tests/types/maven-test.json | 63 +++------------------- tests/types/mlflow-test.json | 64 +++------------------- tests/types/npm-test.json | 51 +++--------------- tests/types/nuget-test.json | 58 ++++---------------- tests/types/oci-test.json | 81 +++------------------------- tests/types/pub-test.json | 58 +++++--------------- tests/types/pypi-test.json | 62 ++++----------------- tests/types/qpkg-test.json | 47 ++-------------- tests/types/rpm-test.json | 62 +++------------------ tests/types/swid-test.json | 68 +++-------------------- tests/types/swift-test.json | 42 +++------------ 32 files changed, 211 insertions(+), 1555 deletions(-) diff --git a/tests/types/alpm-test.json b/tests/types/alpm-test.json index 248a513d..e6dbd17b 100644 --- a/tests/types/alpm-test.json +++ b/tests/types/alpm-test.json @@ -140,96 +140,44 @@ "description": "Valid alpm package with arch qualifier", "test_group": "base", "test_type": "validation", - "input": { - "type": "alpm", - "namespace": "arch", - "name": "pacman", - "version": "6.0.1-1", - "qualifiers": { - "arch": "x86_64" - }, - "subpath": null - }, + "input": "pkg:alpm/arch/pacman@6.0.1-1?arch=x86_64", "expected_messages": null }, { "description": "alpm package with uppercase nmamespace", "test_group": "base", "test_type": "validation", - "input": { - "type": "alpm", - "namespace": "Arch", - "name": "pacman", - "version": "6.0.1-1", - "qualifiers": { - "arch": "x86_64" - }, - "subpath": null - }, - "expected_messages": ["Namespace is not lowercased for purl type: 'alpm'"] + "input": "pkg:alpm/Arch/pacman@6.0.1-1?arch=x86_64", + "expected_messages": [ + "Namespace is not lowercased for purl type: 'alpm'" + ] }, { "description": "alpm package with uppercase nmamespace (advanced)", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "alpm", - "namespace": "Arch", - "name": "pacman", - "version": "6.0.1-1", - "qualifiers": { - "arch": "x86_64" - }, - "subpath": null - }, + "input": "pkg:alpm/Arch/pacman@6.0.1-1?arch=x86_64", "expected_messages": null }, { "description": "Valid alpm package with 'any' arch", "test_group": "base", "test_type": "validation", - "input": { - "type": "alpm", - "namespace": "arch", - "name": "python-pip", - "version": "21.0-1", - "qualifiers": { - "arch": "any" - }, - "subpath": null - }, + "input": "pkg:alpm/arch/python-pip@21.0-1?arch=any", "expected_messages": null }, { "description": "Valid alpm package with epoch in version", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "alpm", - "namespace": "arch", - "name": "containers-common", - "version": "1:0.47.4-4", - "qualifiers": { - "arch": "x86_64" - }, - "subpath": null - }, + "input": "pkg:alpm/arch/containers-common@1:0.47.4-4?arch=x86_64", "expected_messages": null }, { "description": "alpm package missing namespace", "test_group": "base", "test_type": "validation", - "input": { - "type": "alpm", - "namespace": null, - "name": "pacman", - "version": "6.0.1-1", - "qualifiers": { - "arch": "x86_64" - }, - "subpath": null - }, + "input": "pkg:alpm/pacman@6.0.1-1?arch=x86_64", "expected_messages": [ "Namespace is required for purl type: 'alpm'" ] diff --git a/tests/types/apk-test.json b/tests/types/apk-test.json index a4c45725..132973a0 100644 --- a/tests/types/apk-test.json +++ b/tests/types/apk-test.json @@ -95,64 +95,28 @@ "description": "Valid apk package with arch qualifier", "test_group": "base", "test_type": "validation", - "input": { - "type": "apk", - "namespace": "alpine", - "name": "curl", - "version": "7.83.0-r0", - "qualifiers": { - "arch": "x86" - }, - "subpath": null - }, + "input": "pkg:apk/alpine/curl@7.83.0-r0?arch=x86", "expected_messages": null }, { "description": "Valid apk package with higher version and arch qualifier", "test_group": "base", "test_type": "validation", - "input": { - "type": "apk", - "namespace": "alpine", - "name": "apk", - "version": "2.12.9-r3", - "qualifiers": { - "arch": "x86" - }, - "subpath": null - }, + "input": "pkg:apk/alpine/apk@2.12.9-r3?arch=x86", "expected_messages": null }, { "description": "Valid apk package with openwrt vendor", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "apk", - "namespace": "openwrt", - "name": "busybox", - "version": "1.35.0-r5", - "qualifiers": { - "arch": "mips" - }, - "subpath": null - }, + "input": "pkg:apk/openwrt/busybox@1.35.0-r5?arch=mips", "expected_messages": null }, { "description": "apk package missing namespace", "test_group": "base", "test_type": "validation", - "input": { - "type": "apk", - "namespace": null, - "name": "curl", - "version": "7.83.0-r0", - "qualifiers": { - "arch": "x86" - }, - "subpath": null - }, + "input": "pkg:apk/curl@7.83.0-r0?arch=x86", "expected_messages": [ "Namespace is required for purl type: 'apk'" ] @@ -161,16 +125,7 @@ "description": "apk package with uppercase namespace and name", "test_group": "base", "test_type": "validation", - "input": { - "type": "apk", - "namespace": "FOO", - "name": "BAR", - "version": "7.83.0-r0", - "qualifiers": { - "arch": "x86" - }, - "subpath": null - }, + "input": "pkg:apk/FOO/BAR@7.83.0-r0?arch=x86", "expected_messages": [ "Namespace is not lowercased for purl type: 'apk'", "Name is not lowercased for purl type: 'apk'" @@ -180,16 +135,7 @@ "description": "apk package with uppercase namespace and name (advanced)", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "apk", - "namespace": "FOO", - "name": "BAR", - "version": "7.83.0-r0", - "qualifiers": { - "arch": "x86" - }, - "subpath": null - }, + "input": "pkg:apk/FOO/BAR@7.83.0-r0?arch=x86", "expected_messages": null } ] diff --git a/tests/types/bitbucket-test.json b/tests/types/bitbucket-test.json index 9c61d420..888d673c 100644 --- a/tests/types/bitbucket-test.json +++ b/tests/types/bitbucket-test.json @@ -96,62 +96,28 @@ "description": "Valid Bitbucket package with commit hash as version", "test_group": "base", "test_type": "validation", - "input": { - "type": "bitbucket", - "namespace": "birkenfeld", - "name": "pygments-main", - "version": "244fd47e07d1014f0aed9c", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:bitbucket/birkenfeld/pygments-main@244fd47e07d1014f0aed9c", "expected_messages": null }, { "description": "Valid Bitbucket package with subpath", "test_group": "base", "test_type": "validation", - "input": { - "type": "bitbucket", - "namespace": "teamname", - "name": "repo-name", - "version": "1.0.0", - "qualifiers": null, - "subpath": "src/main" - }, + "input": "pkg:bitbucket/teamname/repo-name@1.0.0#src/main", "expected_messages": null }, { "description": "Valid Bitbucket package with qualifiers", "test_group": "base", "test_type": "validation", - "input": { - "type": "bitbucket", - "namespace": "company", - "name": "service", - "version": "release-2024", - "qualifiers": { - "arch": "x86_64", - "os": "linux" - }, - "subpath": null - }, + "input": "pkg:bitbucket/company/service@release-2024?arch=x86_64&os=linux", "expected_messages": null }, { "description": "Valid Bitbucket package with qualifiers", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "bitbucket", - "namespace": "company", - "name": "service", - "version": "release-2024", - "qualifiers": { - "arch": "x86_64", - "os": "linux" - }, - "subpath": null - }, + "input": "pkg:bitbucket/company/service@release-2024?arch=x86_64&os=linux", "expected_messages": null } ] diff --git a/tests/types/bitnami-test.json b/tests/types/bitnami-test.json index 4c2bd396..a866d36e 100644 --- a/tests/types/bitnami-test.json +++ b/tests/types/bitnami-test.json @@ -189,66 +189,28 @@ "description": "Valid Bitnami package without version", "test_group": "base", "test_type": "validation", - "input": { - "type": "bitnami", - "namespace": null, - "name": "wordpress", - "version": null, - "qualifiers": { - "distro": "debian-12" - }, - "subpath": null - }, + "input": "pkg:bitnami/wordpress?distro=debian-12", "expected_messages": null }, { "description": "Valid Bitnami package with version and distro", "test_group": "base", "test_type": "validation", - "input": { - "type": "bitnami", - "namespace": null, - "name": "wordpress", - "version": "6.2.0", - "qualifiers": { - "distro": "debian-12" - }, - "subpath": null - }, + "input": "pkg:bitnami/wordpress@6.2.0?distro=debian-12", "expected_messages": null }, { "description": "Valid Bitnami package with arch and distro", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "bitnami", - "namespace": null, - "name": "wordpress", - "version": "6.2.0", - "qualifiers": { - "arch": "arm64", - "distro": "debian-12" - }, - "subpath": null - }, + "input": "pkg:bitnami/wordpress@6.2.0?arch=arm64&distro=debian-12", "expected_messages": null }, { "description": "Valid Bitnami package with another distro", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "bitnami", - "namespace": null, - "name": "wordpress", - "version": "6.2.0", - "qualifiers": { - "arch": "arm64", - "distro": "photon-4" - }, - "subpath": null - }, + "input": "pkg:bitnami/wordpress@6.2.0?arch=arm64&distro=photon-4", "expected_messages": null } ] diff --git a/tests/types/cargo-test.json b/tests/types/cargo-test.json index 334e36c2..9c148c8f 100644 --- a/tests/types/cargo-test.json +++ b/tests/types/cargo-test.json @@ -128,56 +128,28 @@ "description": "Valid Cargo package with name and version", "test_group": "base", "test_type": "validation", - "input": { - "type": "cargo", - "namespace": null, - "name": "rand", - "version": "0.7.2", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:cargo/rand@0.7.2", "expected_messages": [] }, { "description": "Valid Cargo package with another example", "test_group": "base", "test_type": "validation", - "input": { - "type": "cargo", - "namespace": null, - "name": "clap", - "version": "2.33.0", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:cargo/clap@2.33.0", "expected_messages": null }, { "description": "Cargo package without version", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "cargo", - "namespace": null, - "name": "structopt", - "version": null, - "qualifiers": null, - "subpath": null - }, + "input": "pkg:cargo/structopt", "expected_messages": null }, { "description": "Cargo package with namespace (not allowed)", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "cargo", - "namespace": "rustlang", - "name": "serde", - "version": "1.0.0", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:cargo/rustlang/serde@1.0.0", "expected_messages": [ "Namespace is prohibited for purl type: 'cargo'" ] diff --git a/tests/types/cocoapods-test.json b/tests/types/cocoapods-test.json index cb0e688e..4010b2b1 100644 --- a/tests/types/cocoapods-test.json +++ b/tests/types/cocoapods-test.json @@ -169,56 +169,28 @@ "description": "Valid CocoaPods package with name and version", "test_group": "base", "test_type": "validation", - "input": { - "type": "cocoapods", - "namespace": null, - "name": "AFNetworking", - "version": "4.0.1", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:cocoapods/AFNetworking@4.0.1", "expected_messages": [] }, { "description": "Valid CocoaPods package with subspec in subpath", "test_group": "base", "test_type": "validation", - "input": { - "type": "cocoapods", - "namespace": null, - "name": "GoogleUtilities", - "version": "7.5.2", - "qualifiers": null, - "subpath": "NSData+zlib" - }, + "input": "pkg:cocoapods/GoogleUtilities@7.5.2#NSData+zlib", "expected_messages": [] }, { "description": "CocoaPods package without version", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "cocoapods", - "namespace": null, - "name": "MapsIndoors", - "version": null, - "qualifiers": null, - "subpath": null - }, + "input": "pkg:cocoapods/MapsIndoors", "expected_messages": [] }, { "description": "CocoaPods package with namespace (not allowed)", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "cocoapods", - "namespace": "apple", - "name": "ShareKit", - "version": "2.0", - "qualifiers": null, - "subpath": "Twitter" - }, + "input": "pkg:cocoapods/apple/ShareKit@2.0#Twitter", "expected_messages": [ "Namespace is prohibited for purl type: 'cocoapods'" ] diff --git a/tests/types/composer-test.json b/tests/types/composer-test.json index 269f7b91..4ba5e7e9 100644 --- a/tests/types/composer-test.json +++ b/tests/types/composer-test.json @@ -121,72 +121,38 @@ "description": "Valid Composer package with vendor, name, and version", "test_group": "base", "test_type": "validation", - "input": { - "type": "composer", - "namespace": "laravel", - "name": "laravel", - "version": "5.5.0", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:composer/laravel/laravel@5.5.0", "expected_messages": null }, { "description": "Composer package without version", "test_group": "base", "test_type": "validation", - "input": { - "type": "composer", - "namespace": "symfony", - "name": "console", - "version": null, - "qualifiers": null, - "subpath": null - }, + "input": "pkg:composer/symfony/console", "expected_messages": null }, { "description": "Composer package with uppercase namespace (should normalize to lowercase)", "test_group": "base", "test_type": "validation", - "input": { - "type": "composer", - "namespace": "Laravel", - "name": "Framework", - "version": "10.0.0", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:composer/Laravel/Framework@10.0.0", "expected_messages": [ - "Namespace is not lowercased for purl type: 'composer'", "Name is not lowercased for purl type: 'composer'" + "Namespace is not lowercased for purl type: 'composer'", + "Name is not lowercased for purl type: 'composer'" ] }, { "description": "Composer package with uppercase namespace (should normalize to lowercase)", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "composer", - "namespace": "Laravel", - "name": "Framework", - "version": "10.0.0", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:composer/Laravel/Framework@10.0.0", "expected_messages": null }, { "description": "Composer package missing namespace", "test_group": "base", "test_type": "validation", - "input": { - "type": "composer", - "namespace": null, - "name": "console", - "version": "5.0.0", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:composer/console@5.0.0", "expected_messages": [ "Namespace is required for purl type: 'composer'" ] @@ -195,16 +161,7 @@ "description": "Composer package with qualifiers", "test_group": "base", "test_type": "validation", - "input": { - "type": "composer", - "namespace": "laravel", - "name": "laravel", - "version": "5.5.0", - "qualifiers": { - "repository_url": "https://packagist.org" - }, - "subpath": null - }, + "input": "pkg:composer/laravel/laravel@5.5.0?repository_url=https://packagist.org", "expected_messages": null } ] diff --git a/tests/types/conan-test.json b/tests/types/conan-test.json index fa64e0c2..b78dba31 100644 --- a/tests/types/conan-test.json +++ b/tests/types/conan-test.json @@ -328,85 +328,35 @@ "description": "Valid Conan package with name and version only", "test_group": "base", "test_type": "validation", - "input": { - "type": "conan", - "namespace": null, - "name": "openssl", - "version": "3.0.3", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:conan/openssl@3.0.3", "expected_messages": [] }, { "description": "Valid Conan package with namespace (vendor) and qualifiers user+channel", "test_group": "base", "test_type": "validation", - "input": { - "type": "conan", - "namespace": "openssl.org", - "name": "openssl", - "version": "3.0.3", - "qualifiers": { - "user": "bincrafters", - "channel": "stable" - }, - "subpath": null - }, + "input": "pkg:conan/openssl.org/openssl@3.0.3?channel=stable&user=bincrafters", "expected_messages": [] }, { "description": "Valid Conan package with namespace, complex qualifiers including rrev and prev", "test_group": "base", "test_type": "validation", - "input": { - "type": "conan", - "namespace": "openssl.org", - "name": "openssl", - "version": "3.0.3", - "qualifiers": { - "arch": "x86_64", - "build_type": "Debug", - "compiler": "Visual Studio", - "compiler.runtime": "MDd", - "compiler.version": "16", - "os": "Windows", - "shared": "True", - "rrev": "93a82349c31917d2d674d22065c7a9ef9f380c8e", - "prev": "b429db8a0e324114c25ec387bfd8281f330d7c5c" - }, - "subpath": null - }, + "input": "pkg:conan/openssl.org/openssl@3.0.3?arch=x86_64&build_type=Debug&compiler=Visual Studio&compiler.runtime=MDd&compiler.version=16&os=Windows&prev=b429db8a0e324114c25ec387bfd8281f330d7c5c&rrev=93a82349c31917d2d674d22065c7a9ef9f380c8e&shared=True", "expected_messages": null }, { "description": "Valid Conan package with only namespace and no qualifiers", "test_group": "base", "test_type": "validation", - "input": { - "type": "conan", - "namespace": "openssl.org", - "name": "openssl", - "version": "3.0.3", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:conan/openssl.org/openssl@3.0.3", "expected_messages": [] }, { "description": "Conan package with unsupported qualifier key", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "conan", - "namespace": null, - "name": "openssl", - "version": "3.0.3", - "qualifiers": { - "foo": "bar" - }, - "subpath": null - }, + "input": "pkg:conan/openssl@3.0.3?foo=bar", "expected_messages": null } ] diff --git a/tests/types/conda-test.json b/tests/types/conda-test.json index c143a10f..8b01105e 100644 --- a/tests/types/conda-test.json +++ b/tests/types/conda-test.json @@ -116,47 +116,21 @@ "description": "Valid Conda package with name and version only", "test_group": "base", "test_type": "validation", - "input": { - "type": "conda", - "namespace": null, - "name": "absl-py", - "version": "0.4.1", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:conda/absl-py@0.4.1", "expected_messages": [] }, { "description": "Valid Conda package with full qualifiers (build, channel, subdir, type)", "test_group": "base", "test_type": "validation", - "input": { - "type": "conda", - "namespace": null, - "name": "absl-py", - "version": "0.4.1", - "qualifiers": { - "build": "py36h06a4308_0", - "channel": "main", - "subdir": "linux-64", - "type": "tar.bz2" - }, - "subpath": null - }, + "input": "pkg:conda/absl-py@0.4.1?build=py36h06a4308_0&channel=main&subdir=linux-64&type=tar.bz2", "expected_messages": [] }, { "description": "Conda package with namespace (not allowed)", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "conda", - "namespace": "anaconda", - "name": "absl-py", - "version": "0.4.1", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:conda/anaconda/absl-py@0.4.1", "expected_messages": [ "Namespace is prohibited for purl type: 'conda'" ] @@ -165,16 +139,7 @@ "description": "Conda package with unsupported qualifier", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "conda", - "namespace": null, - "name": "absl-py", - "version": "0.4.1", - "qualifiers": { - "foo": "bar" - }, - "subpath": null - }, + "input": "pkg:conda/absl-py@0.4.1?foo=bar", "expected_messages": null } ] diff --git a/tests/types/cpan-test.json b/tests/types/cpan-test.json index fefa88f4..143c3e87 100644 --- a/tests/types/cpan-test.json +++ b/tests/types/cpan-test.json @@ -560,98 +560,51 @@ "description": "Valid CPAN module without namespace", "test_group": "base", "test_type": "validation", - "input": { - "type": "cpan", - "namespace": null, - "name": "Perl::Version", - "version": "1.013", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:cpan/Perl::Version@1.013", "expected_messages": null }, { "description": "Valid CPAN distribution with uppercase namespace (author ID)", "test_group": "base", "test_type": "validation", - "input": { - "type": "cpan", - "namespace": "DROLSKY", - "name": "DateTime", - "version": "1.55", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:cpan/DROLSKY/DateTime@1.55", "expected_messages": null }, { "description": "Valid CPAN distribution without version", "test_group": "base", "test_type": "validation", - "input": { - "type": "cpan", - "namespace": "GDT", - "name": "URI-PackageURL", - "version": null, - "qualifiers": null, - "subpath": null - }, + "input": "pkg:cpan/GDT/URI-PackageURL", "expected_messages": null }, { "description": "Valid CPAN module with :: in name and no namespace", "test_group": "base", "test_type": "validation", - "input": { - "type": "cpan", - "namespace": null, - "name": "LWP::UserAgent", - "version": null, - "qualifiers": null, - "subpath": null - }, + "input": "pkg:cpan/LWP::UserAgent", "expected_messages": [] }, { "description": "CPAN distribution with lowercase namespace (must be uppercase)", "test_group": "base", "test_type": "validation", - "input": { - "type": "cpan", - "namespace": "oalders", - "name": "libwww-perl", - "version": "6.76", - "qualifiers": null, - "subpath": null - }, - "expected_messages": ["Namespace must be uppercase for purl type: 'cpan'"] + "input": "pkg:cpan/oalders/libwww-perl@6.76", + "expected_messages": [ + "Namespace must be uppercase for purl type: 'cpan'" + ] }, { "description": "CPAN distribution with lowercase namespace (must be uppercase)", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "cpan", - "namespace": "oalders", - "name": "libwww-perl", - "version": "6.76", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:cpan/oalders/libwww-perl@6.76", "expected_messages": null }, { "description": "CPAN module with '-' in name (not allowed without namespace)", "test_group": "base", "test_type": "validation", - "input": { - "type": "cpan", - "namespace": null, - "name": "libwww-perl", - "version": "6.76", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:cpan/libwww-perl@6.76", "expected_messages": [ "Name must not contain '-' when Namespace is absent for purl type: 'cpan'" ] @@ -660,14 +613,7 @@ "description": "CPAN distribution name containing '::' (not allowed with namespace)", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "cpan", - "namespace": "TESTUSER", - "name": "Bad::Dist", - "version": "1.0", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:cpan/TESTUSER/Bad::Dist@1.0", "expected_messages": [ "Name must not contain '::' when Namespace is absent for purl type: 'cpan'" ] @@ -676,19 +622,7 @@ "description": "Valid CPAN package with qualifiers (repository_url, download_url, vcs_url)", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "cpan", - "namespace": "OALDERS", - "name": "libwww-perl", - "version": "6.76", - "qualifiers": { - "repository_url": "https://cpan.metacpan.org", - "download_url": "https://cpan.metacpan.org/authors/id/O/OA/OALDERS/libwww-perl-6.76.tar.gz", - "vcs_url": "https://github.com/libwww-perl", - "ext": "tar.gz" - }, - "subpath": null - }, + "input": "pkg:cpan/OALDERS/libwww-perl@6.76?download_url=https://cpan.metacpan.org/authors/id/O/OA/OALDERS/libwww-perl-6.76.tar.gz&ext=tar.gz&repository_url=https://cpan.metacpan.org&vcs_url=https://github.com/libwww-perl", "expected_messages": [] } ] diff --git a/tests/types/cran-test.json b/tests/types/cran-test.json index 4043acaa..b7c08630 100644 --- a/tests/types/cran-test.json +++ b/tests/types/cran-test.json @@ -246,56 +246,28 @@ "description": "Valid CRAN package with name and version", "test_group": "base", "test_type": "validation", - "input": { - "type": "cran", - "namespace": null, - "name": "A3", - "version": "1.0.0", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:cran/A3@1.0.0", "expected_messages": [] }, { "description": "Valid CRAN package with hyphen in version", "test_group": "base", "test_type": "validation", - "input": { - "type": "cran", - "namespace": null, - "name": "rJava", - "version": "1.0-4", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:cran/rJava@1.0-4", "expected_messages": [] }, { "description": "Valid CRAN package with complex version", "test_group": "base", "test_type": "validation", - "input": { - "type": "cran", - "namespace": null, - "name": "caret", - "version": "6.0-88", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:cran/caret@6.0-88", "expected_messages": [] }, { "description": "CRAN package with namespace (not allowed)", "test_group": "base", "test_type": "validation", - "input": { - "type": "cran", - "namespace": "ml", - "name": "caret", - "version": "6.0-88", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:cran/ml/caret@6.0-88", "expected_messages": [ "Namespace is prohibited for purl type: 'cran'" ] diff --git a/tests/types/deb-test.json b/tests/types/deb-test.json index d5b720f6..a3e2fadb 100644 --- a/tests/types/deb-test.json +++ b/tests/types/deb-test.json @@ -290,65 +290,28 @@ "description": "Valid deb package with vendor, name, version, and arch", "test_group": "base", "test_type": "validation", - "input": { - "type": "deb", - "namespace": "debian", - "name": "curl", - "version": "7.50.3-1", - "qualifiers": { - "arch": "i386", - "distro": "jessie" - }, - "subpath": null - }, + "input": "pkg:deb/debian/curl@7.50.3-1?arch=i386&distro=jessie", "expected_messages": null }, { "description": "Valid deb package with vendor, name, version, without distro", "test_group": "base", "test_type": "validation", - "input": { - "type": "deb", - "namespace": "ubuntu", - "name": "dpkg", - "version": "1.19.0.4", - "qualifiers": { - "arch": "amd64" - }, - "subpath": null - }, + "input": "pkg:deb/ubuntu/dpkg@1.19.0.4?arch=amd64", "expected_messages": [] }, { "description": "Valid deb source package", "test_group": "base", "test_type": "validation", - "input": { - "type": "deb", - "namespace": "debian", - "name": "attr", - "version": "1:2.4.47-2", - "qualifiers": { - "arch": "source" - }, - "subpath": null - }, + "input": "pkg:deb/debian/attr@1:2.4.47-2?arch=source", "expected_messages": [] }, { "description": "Deb package missing vendor", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "deb", - "namespace": null, - "name": "curl", - "version": "7.50.3-1", - "qualifiers": { - "arch": "amd64" - }, - "subpath": null - }, + "input": "pkg:deb/curl@7.50.3-1?arch=amd64", "expected_messages": [ "Namespace is required for purl type: 'deb'" ] @@ -357,16 +320,7 @@ "description": "deb package with unsupported qualifier", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "deb", - "namespace": "debian", - "name": "curl", - "version": "7.50.3-1", - "qualifiers": { - "foo": "bar" - }, - "subpath": null - }, + "input": "pkg:deb/debian/curl@7.50.3-1?foo=bar", "expected_messages": null } ] diff --git a/tests/types/docker-test.json b/tests/types/docker-test.json index 7da1466a..ce0572b8 100644 --- a/tests/types/docker-test.json +++ b/tests/types/docker-test.json @@ -186,76 +186,35 @@ "description": "Valid Docker image with tag only", "test_group": "base", "test_type": "validation", - "input": { - "type": "docker", - "namespace": null, - "name": "cassandra", - "version": "latest", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:docker/cassandra@latest", "expected_messages": null }, { "description": "Valid Docker image with namespace and sha256 digest", "test_group": "base", "test_type": "validation", - "input": { - "type": "docker", - "namespace": "smartentry", - "name": "debian", - "version": "dc437cc87d10", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:docker/smartentry/debian@dc437cc87d10", "expected_messages": null }, { "description": "Valid Docker image with repository_url qualifier", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "docker", - "namespace": "customer", - "name": "dockerimage", - "version": "sha256:244fd47e07d10", - "qualifiers": { - "repository_url": "gcr.io" - }, - "subpath": null - }, + "input": "pkg:docker/customer/dockerimage@sha256:244fd47e07d10?repository_url=gcr.io", "expected_messages": null }, { "description": "Docker image with unsupported qualifier", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "docker", - "namespace": null, - "name": "ubuntu", - "version": "20.04", - "qualifiers": { - "bad": "value" - }, - "subpath": null - }, + "input": "pkg:docker/ubuntu@20.04?bad=value", "expected_messages": null }, { "description": "Docker image with unsupported qualifier", "test_group": "base", "test_type": "validation", - "input": { - "type": "docker", - "namespace": null, - "name": "ubuntu", - "version": "20.04", - "qualifiers": { - "bad": "value" - }, - "subpath": null - }, + "input": "pkg:docker/ubuntu@20.04?bad=value", "expected_messages": null } ] diff --git a/tests/types/gem-test.json b/tests/types/gem-test.json index ed367d49..2144c2d8 100644 --- a/tests/types/gem-test.json +++ b/tests/types/gem-test.json @@ -145,76 +145,35 @@ "description": "Valid RubyGem with default platform", "test_group": "base", "test_type": "validation", - "input": { - "type": "gem", - "namespace": null, - "name": "ruby-advisory-db-check", - "version": "0.12.4", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:gem/ruby-advisory-db-check@0.12.4", "expected_messages": [] }, { "description": "Valid RubyGem with java platform", "test_group": "base", "test_type": "validation", - "input": { - "type": "gem", - "namespace": null, - "name": "jruby-launcher", - "version": "1.1.2", - "qualifiers": { - "platform": "java" - }, - "subpath": null - }, + "input": "pkg:gem/jruby-launcher@1.1.2?platform=java", "expected_messages": [] }, { "description": "Subpath included", "test_group": "base", "test_type": "validation", - "input": { - "type": "gem", - "namespace": null, - "name": "nokogiri", - "version": "1.14.3", - "qualifiers": null, - "subpath": "lib/nokogiri.rb" - }, + "input": "pkg:gem/nokogiri@1.14.3#lib/nokogiri.rb", "expected_messages": [] }, { "description": "Extra unknown qualifier", "test_group": "base", "test_type": "validation", - "input": { - "type": "gem", - "namespace": null, - "name": "sinatra", - "version": "3.1.2", - "qualifiers": { - "unknown": "value" - }, - "subpath": null - }, + "input": "pkg:gem/sinatra@3.1.2?unknown=value", "expected_messages": null }, { "description": "Extra unknown qualifier", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "gem", - "namespace": null, - "name": "sinatra", - "version": "3.1.2", - "qualifiers": { - "unknown": "value" - }, - "subpath": null - }, + "input": "pkg:gem/sinatra@3.1.2?unknown=value", "expected_messages": null } ] diff --git a/tests/types/generic-test.json b/tests/types/generic-test.json index 81bf4473..75b8dc2d 100644 --- a/tests/types/generic-test.json +++ b/tests/types/generic-test.json @@ -138,91 +138,42 @@ "description": "Valid generic package with version", "test_group": "base", "test_type": "validation", - "input": { - "type": "generic", - "namespace": null, - "name": "openssl", - "version": "1.1.10g", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:generic/openssl@1.1.10g", "expected_messages": [] }, { "description": "Valid generic package with download_url and checksum", "test_group": "base", "test_type": "validation", - "input": { - "type": "generic", - "namespace": null, - "name": "openssl", - "version": "1.1.10g", - "qualifiers": { - "download_url": "https://openssl.org/source/openssl-1.1.0g.tar.gz", - "checksum": "sha256:de4d501267da" - }, - "subpath": null - }, + "input": "pkg:generic/openssl@1.1.10g?checksum=sha256:de4d501267da&download_url=https://openssl.org/source/openssl-1.1.0g.tar.gz", "expected_messages": [] }, { "description": "Valid generic package with vcs_url", "test_group": "base", "test_type": "validation", - "input": { - "type": "generic", - "namespace": null, - "name": "bitwarderl", - "version": null, - "qualifiers": { - "vcs_url": "git+https://git.fsfe.org/dxtr/bitwarderl@cc55108da32" - }, - "subpath": null - }, + "input": "pkg:generic/bitwarderl?vcs_url=git+https://git.fsfe.org/dxtr/bitwarderl@cc55108da32", "expected_messages": null }, { "description": "Extra unknown qualifier", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "generic", - "namespace": null, - "name": "mypkg", - "version": "3.0.0", - "qualifiers": { - "foo": "bar" - }, - "subpath": null - }, + "input": "pkg:generic/mypkg@3.0.0?foo=bar", "expected_messages": null }, { "description": "Subpath included", "test_group": "base", "test_type": "validation", - "input": { - "type": "generic", - "namespace": null, - "name": "libexample", - "version": "0.5.2", - "qualifiers": null, - "subpath": "src/libexample.c" - }, + "input": "pkg:generic/libexample@0.5.2#src/libexample.c", "expected_messages": [] }, { "description": "Missing version and no qualifiers", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "generic", - "namespace": null, - "name": "noversionpkg", - "version": null, - "qualifiers": null, - "subpath": null - }, + "input": "pkg:generic/noversionpkg", "expected_messages": [] } ] diff --git a/tests/types/github-test.json b/tests/types/github-test.json index bef95f9b..333a2fd8 100644 --- a/tests/types/github-test.json +++ b/tests/types/github-test.json @@ -137,42 +137,21 @@ "description": "Valid GitHub package with namespace, name, and version", "test_group": "base", "test_type": "validation", - "input": { - "type": "github", - "namespace": "package-url", - "name": "purl-spec", - "version": "244fd47e07d1004", - "subpath": null, - "qualifiers": {} - }, + "input": "pkg:github/package-url/purl-spec@244fd47e07d1004", "expected_messages": [] }, { "description": "Valid GitHub package with subpath", "test_group": "base", "test_type": "validation", - "input": { - "type": "github", - "namespace": "package-url", - "name": "purl-spec", - "version": "244fd47e07d1004", - "subpath": "everybody/loves/dogs", - "qualifiers": {} - }, + "input": "pkg:github/package-url/purl-spec@244fd47e07d1004#everybody/loves/dogs", "expected_messages": [] }, { "description": "GitHub package missing namespace", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "github", - "namespace": null, - "name": "purl-spec", - "version": "244fd47e07d1004", - "subpath": null, - "qualifiers": {} - }, + "input": "pkg:github/purl-spec@244fd47e07d1004", "expected_messages": [ "Namespace is required for purl type: 'github'" ] diff --git a/tests/types/golang-test.json b/tests/types/golang-test.json index 487dcd53..12d7a1e6 100644 --- a/tests/types/golang-test.json +++ b/tests/types/golang-test.json @@ -228,56 +228,28 @@ "description": "Valid golang package with namespace, name, and version", "test_group": "base", "test_type": "validation", - "input": { - "type": "golang", - "namespace": "github.com/gorilla", - "name": "context", - "version": "234fd47e07d1004f0aed9c", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:golang/github.com/gorilla/context@234fd47e07d1004f0aed9c", "expected_messages": [] }, { "description": "Valid golang package with namespace and name only (no version)", "test_group": "base", "test_type": "validation", - "input": { - "type": "golang", - "namespace": "golang.org/x", - "name": "crypto", - "version": null, - "qualifiers": null, - "subpath": null - }, + "input": "pkg:golang/golang.org/x/crypto", "expected_messages": [] }, { "description": "Valid golang package with subpath", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "golang", - "namespace": "google.golang.org", - "name": "genproto", - "version": null, - "qualifiers": null, - "subpath": "googleapis/api/annotations" - }, + "input": "pkg:golang/google.golang.org/genproto#googleapis/api/annotations", "expected_messages": [] }, { "description": "Golang package with uppercase namespace", "test_group": "base", "test_type": "validation", - "input": { - "type": "golang", - "namespace": "GitHub.com/Gorilla", - "name": "context", - "version": "234fd47e07d1004f0aed9c", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:golang/GitHub.com/Gorilla/context@234fd47e07d1004f0aed9c", "expected_messages": [ "Namespace is not lowercased for purl type: 'golang'" ] @@ -286,17 +258,10 @@ "description": "Golang package with missing namespace", "test_group": "base", "test_type": "validation", - "input": { - "type": "golang", - "namespace": null, - "name": "context", - "version": "234fd47e07d1004f0aed9c", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:golang/context@234fd47e07d1004f0aed9c", "expected_messages": [ "Namespace is required for purl type: 'golang'" ] - } + } ] } diff --git a/tests/types/hackage-test.json b/tests/types/hackage-test.json index f88066c9..a0bc8c76 100644 --- a/tests/types/hackage-test.json +++ b/tests/types/hackage-test.json @@ -212,56 +212,28 @@ "description": "Valid Hackage package with simple kebab-case name", "test_group": "base", "test_type": "validation", - "input": { - "type": "hackage", - "namespace": null, - "name": "lens", - "version": "5.0.1", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:hackage/lens@5.0.1", "expected_messages": null }, { "description": "Valid Hackage package with uppercase letters", "test_group": "base", "test_type": "validation", - "input": { - "type": "hackage", - "namespace": null, - "name": "AC-HalfInteger", - "version": "1.2.1", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:hackage/AC-HalfInteger@1.2.1", "expected_messages": null }, { "description": "Valid Hackage package with numbers and dots in version", "test_group": "base", "test_type": "validation", - "input": { - "type": "hackage", - "namespace": null, - "name": "3d-graphics-examples", - "version": "0.0.0.2", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:hackage/3d-graphics-examples@0.0.0.2", "expected_messages": null }, { "description": "Hackage package with namespace included", "test_group": "base", "test_type": "validation", - "input": { - "type": "hackage", - "namespace": "haskell", - "name": "text", - "version": "1.2.4", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:hackage/haskell/text@1.2.4", "expected_messages": [ "Namespace is prohibited for purl type: 'hackage'" ] @@ -270,28 +242,16 @@ "description": "Hackage package with name not in kebab-case", "test_group": "base", "test_type": "validation", - "input": { - "type": "hackage", - "namespace": null, - "name": "My_Package", - "version": "0.1", - "qualifiers": null, - "subpath": null - }, - "expected_messages": ["Name contains underscores but should be kebab-case for purl type: 'hackage'"] + "input": "pkg:hackage/My_Package@0.1", + "expected_messages": [ + "Name contains underscores but should be kebab-case for purl type: 'hackage'" + ] }, { "description": "Hackage package with name not in kebab-case", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "hackage", - "namespace": null, - "name": "My_Package", - "version": "0.1", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:hackage/My_Package@0.1", "expected_messages": null } ] diff --git a/tests/types/hex-test.json b/tests/types/hex-test.json index a6fe85ca..5fcb50c3 100644 --- a/tests/types/hex-test.json +++ b/tests/types/hex-test.json @@ -173,114 +173,60 @@ "description": "Valid Hex package with lowercase name", "test_group": "base", "test_type": "validation", - "input": { - "type": "hex", - "namespace": null, - "name": "jason", - "version": "1.1.2", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:hex/jason@1.1.2", "expected_messages": null }, { "description": "Valid Hex package with optional namespace", "test_group": "base", "test_type": "validation", - "input": { - "type": "hex", - "namespace": "acme", - "name": "foo", - "version": "2.3.0", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:hex/acme/foo@2.3.0", "expected_messages": null }, { "description": "Valid Hex package with subpath", "test_group": "base", "test_type": "validation", - "input": { - "type": "hex", - "namespace": null, - "name": "phoenix_html", - "version": "2.13.3", - "qualifiers": null, - "subpath": "priv/static/phoenix_html.js" - }, + "input": "pkg:hex/phoenix_html@2.13.3#priv/static/phoenix_html.js", "expected_messages": null }, { "description": "Valid Hex package with repository_url qualifier", "test_group": "base", "test_type": "validation", - "input": { - "type": "hex", - "namespace": null, - "name": "bar", - "version": "1.2.3", - "qualifiers": { - "repository_url": "https://myrepo.example.com" - }, - "subpath": null - }, + "input": "pkg:hex/bar@1.2.3?repository_url=https://myrepo.example.com", "expected_messages": null }, { "description": "Hex package with uppercase name", "test_group": "base", "test_type": "validation", - "input": { - "type": "hex", - "namespace": null, - "name": "Phoenix_HTML", - "version": "1.0.0", - "qualifiers": null, - "subpath": null - }, - "expected_messages": ["Name is not lowercased for purl type: 'hex'"] + "input": "pkg:hex/Phoenix_HTML@1.0.0", + "expected_messages": [ + "Name is not lowercased for purl type: 'hex'" + ] }, { "description": "Hex package with uppercase name", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "hex", - "namespace": null, - "name": "Phoenix_HTML", - "version": "1.0.0", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:hex/Phoenix_HTML@1.0.0", "expected_messages": null }, { "description": "Hex package with uppercase namespace", "test_group": "base", "test_type": "validation", - "input": { - "type": "hex", - "namespace": "ACME", - "name": "foo", - "version": "1.0.0", - "qualifiers": null, - "subpath": null - }, - "expected_messages": ["Namespace is not lowercased for purl type: 'hex'"] + "input": "pkg:hex/ACME/foo@1.0.0", + "expected_messages": [ + "Namespace is not lowercased for purl type: 'hex'" + ] }, { "description": "Hex package with uppercase namespace", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "hex", - "namespace": "ACME", - "name": "foo", - "version": "1.0.0", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:hex/ACME/foo@1.0.0", "expected_messages": null } ] diff --git a/tests/types/huggingface-test.json b/tests/types/huggingface-test.json index b05734fe..e47c9622 100644 --- a/tests/types/huggingface-test.json +++ b/tests/types/huggingface-test.json @@ -245,58 +245,30 @@ "description": "Valid minimal Hugging Face model", "test_group": "base", "test_type": "validation", - "input": { - "type": "huggingface", - "namespace": null, - "name": "distilbert-base-uncased", - "version": "043235d6088ecd3dd5fb5ca3592b6913fd516027", - "qualifiers": null, - "subpath": null - }, - "expected_messages": ["Namespace is required for purl type: 'huggingface'"] + "input": "pkg:huggingface/distilbert-base-uncased@043235d6088ecd3dd5fb5ca3592b6913fd516027", + "expected_messages": [ + "Namespace is required for purl type: 'huggingface'" + ] }, { "description": "Valid Hugging Face model with namespace", "test_group": "base", "test_type": "validation", - "input": { - "type": "huggingface", - "namespace": "microsoft", - "name": "deberta-v3-base", - "version": "559062ad13d311b87b2c455e67dcd5f1c8f65111", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:huggingface/microsoft/deberta-v3-base@559062ad13d311b87b2c455e67dcd5f1c8f65111", "expected_messages": [] }, { "description": "Valid Hugging Face model with subpath", "test_group": "base", "test_type": "validation", - "input": { - "type": "huggingface", - "namespace": "EleutherAI", - "name": "gpt-neo-1.3B", - "version": "797174552ae47f449ab70b684cabcb6603e5e85e", - "qualifiers": null, - "subpath": "tokenizer/config.json" - }, + "input": "pkg:huggingface/EleutherAI/gpt-neo-1.3B@797174552ae47f449ab70b684cabcb6603e5e85e#tokenizer/config.json", "expected_messages": [] }, { "description": "Valid Hugging Face model with repository_url qualifier", "test_group": "base", "test_type": "validation", - "input": { - "type": "huggingface", - "namespace": "EleutherAI", - "name": "gpt-neo-1.3B", - "version": "797174552ae47f449ab70b684cabcb6603e5e85e", - "qualifiers": { - "repository_url": "https://hub-ci.huggingface.co" - }, - "subpath": null - }, + "input": "pkg:huggingface/EleutherAI/gpt-neo-1.3B@797174552ae47f449ab70b684cabcb6603e5e85e?repository_url=https://hub-ci.huggingface.co", "expected_messages": [] } ] diff --git a/tests/types/luarocks-test.json b/tests/types/luarocks-test.json index bfe60564..9f1ea900 100644 --- a/tests/types/luarocks-test.json +++ b/tests/types/luarocks-test.json @@ -132,76 +132,35 @@ "description": "Valid LuaRocks package with only name and version", "test_group": "base", "test_type": "validation", - "input": { - "type": "luarocks", - "namespace": null, - "name": "luasocket", - "version": "3.1.0-1", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:luarocks/luasocket@3.1.0-1", "expected_messages": null }, { "description": "Valid LuaRocks package with namespace and version", "test_group": "base", "test_type": "validation", - "input": { - "type": "luarocks", - "namespace": "hisham", - "name": "luafilesystem", - "version": "1.8.0-1", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:luarocks/hisham/luafilesystem@1.8.0-1", "expected_messages": null }, { "description": "Valid LuaRocks package with private repository_url qualifier", "test_group": "base", "test_type": "validation", - "input": { - "type": "luarocks", - "namespace": "username", - "name": "packagename", - "version": "0.1.0-1", - "qualifiers": { - "repository_url": "https://example.com/private_rocks_server/" - }, - "subpath": null - }, + "input": "pkg:luarocks/username/packagename@0.1.0-1?repository_url=https://example.com/private_rocks_server/", "expected_messages": null }, { "description": "Unsupported qualifier is provided", "test_group": "base", "test_type": "validation", - "input": { - "type": "luarocks", - "namespace": "username", - "name": "packagename", - "version": "0.1.0-1", - "qualifiers": { - "channel": "beta" - }, - "subpath": null - }, + "input": "pkg:luarocks/username/packagename@0.1.0-1?channel=beta", "expected_messages": null }, { "description": "Advanced validation for name with uppercase letters", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "luarocks", - "namespace": null, - "name": "LuaSocket", - "version": "3.1.0-1", - "qualifiers": { - "private_url": "https://example.com/private_rocks_server/" - }, - "subpath": null - }, + "input": "pkg:luarocks/LuaSocket@3.1.0-1?private_url=https://example.com/private_rocks_server/", "expected_messages": null } ] diff --git a/tests/types/maven-test.json b/tests/types/maven-test.json index 62a12921..72782bd1 100644 --- a/tests/types/maven-test.json +++ b/tests/types/maven-test.json @@ -903,93 +903,42 @@ "description": "Valid Maven package with groupId, artifactId, and version", "test_group": "base", "test_type": "validation", - "input": { - "type": "maven", - "namespace": "org.apache.xmlgraphics", - "name": "batik-anim", - "version": "1.9.1", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:maven/org.apache.xmlgraphics/batik-anim@1.9.1", "expected_messages": [] }, { "description": "Valid Maven package with type qualifier (pom)", "test_group": "base", "test_type": "validation", - "input": { - "type": "maven", - "namespace": "org.apache.xmlgraphics", - "name": "batik-anim", - "version": "1.9.1", - "qualifiers": { - "type": "pom" - }, - "subpath": null - }, + "input": "pkg:maven/org.apache.xmlgraphics/batik-anim@1.9.1?type=pom", "expected_messages": [] }, { "description": "Valid Maven package with classifier qualifier (sources)", "test_group": "base", "test_type": "validation", - "input": { - "type": "maven", - "namespace": "org.apache.xmlgraphics", - "name": "batik-anim", - "version": "1.9.1", - "qualifiers": { - "classifier": "sources" - }, - "subpath": null - }, + "input": "pkg:maven/org.apache.xmlgraphics/batik-anim@1.9.1?classifier=sources", "expected_messages": [] }, { "description": "Valid Maven package with both type and classifier qualifiers", "test_group": "base", "test_type": "validation", - "input": { - "type": "maven", - "namespace": "org.apache.xmlgraphics", - "name": "batik-anim", - "version": "1.9.1", - "qualifiers": { - "type": "zip", - "classifier": "dist" - }, - "subpath": null - }, + "input": "pkg:maven/org.apache.xmlgraphics/batik-anim@1.9.1?classifier=dist&type=zip", "expected_messages": [] }, { "description": "Valid Maven package with repository_url qualifier", "test_group": "base", "test_type": "validation", - "input": { - "type": "maven", - "namespace": "groovy", - "name": "groovy", - "version": "1.0", - "qualifiers": { - "repository_url": "https://maven.google.com" - }, - "subpath": null - }, + "input": "pkg:maven/groovy/groovy@1.0?repository_url=https://maven.google.com", "expected_messages": [] }, { "description": "Maven package missing namespace (groupId required)", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "maven", - "namespace": null, - "name": "batik-anim", - "version": "1.9.1", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:maven/batik-anim@1.9.1", "expected_messages": [ "Namespace is required for purl type: 'maven'" ] diff --git a/tests/types/mlflow-test.json b/tests/types/mlflow-test.json index 64c83f0d..a4e358c2 100644 --- a/tests/types/mlflow-test.json +++ b/tests/types/mlflow-test.json @@ -265,62 +265,28 @@ "description": "Valid MLflow package with name and version only", "test_group": "base", "test_type": "validation", - "input": { - "type": "mlflow", - "namespace": null, - "name": "creditfraud", - "version": "3", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:mlflow/creditfraud@3", "expected_messages": [] }, { "description": "Valid MLflow package with repository_url qualifier", "test_group": "base", "test_type": "validation", - "input": { - "type": "mlflow", - "namespace": null, - "name": "creditfraud", - "version": "3", - "qualifiers": { - "repository_url": "https://westus2.api.azureml.ms/mlflow/v1.0/subscriptions/a50f2011-fab8-4164-af23-c62881ef8c95/resourceGroups/TestResourceGroup/providers/Microsoft.MachineLearningServices/workspaces/TestWorkspace" - }, - "subpath": null - }, + "input": "pkg:mlflow/creditfraud@3?repository_url=https://westus2.api.azureml.ms/mlflow/v1.0/subscriptions/a50f2011-fab8-4164-af23-c62881ef8c95/resourceGroups/TestResourceGroup/providers/Microsoft.MachineLearningServices/workspaces/TestWorkspace", "expected_messages": [] }, { "description": "Valid MLflow package with model_uuid and run_id qualifiers", "test_group": "base", "test_type": "validation", - "input": { - "type": "mlflow", - "namespace": null, - "name": "trafficsigns", - "version": "10", - "qualifiers": { - "model_uuid": "36233173b22f4c89b451f1228d700d49", - "run_id": "410a3121-2709-4f88-98dd-dba0ef056b0a", - "repository_url": "https://adb-5245952564735461.0.azuredatabricks.net/api/2.0/mlflow" - }, - "subpath": null - }, + "input": "pkg:mlflow/trafficsigns@10?model_uuid=36233173b22f4c89b451f1228d700d49&repository_url=https://adb-5245952564735461.0.azuredatabricks.net/api/2.0/mlflow&run_id=410a3121-2709-4f88-98dd-dba0ef056b0a", "expected_messages": [] }, { "description": "MLflow package with namespace (not allowed)", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "mlflow", - "namespace": "azure", - "name": "creditfraud", - "version": "3", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:mlflow/azure/creditfraud@3", "expected_messages": [ "Namespace is prohibited for purl type: 'mlflow'" ] @@ -329,32 +295,14 @@ "description": "MLflow package with unsupported qualifier", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "mlflow", - "namespace": null, - "name": "creditfraud", - "version": "3", - "qualifiers": { - "foo": "bar" - }, - "subpath": null - }, + "input": "pkg:mlflow/creditfraud@3?foo=bar", "expected_messages": null }, { "description": "MLflow package with unsupported qualifier", "test_group": "base", "test_type": "validation", - "input": { - "type": "mlflow", - "namespace": null, - "name": "creditfraud", - "version": "3", - "qualifiers": { - "foo": "bar" - }, - "subpath": null - }, + "input": "pkg:mlflow/creditfraud@3?foo=bar", "expected_messages": null } ] diff --git a/tests/types/npm-test.json b/tests/types/npm-test.json index 43cb55a7..f9a244ff 100644 --- a/tests/types/npm-test.json +++ b/tests/types/npm-test.json @@ -259,72 +259,37 @@ "description": "Valid npm package without scope", "test_group": "base", "test_type": "validation", - "input": { - "type": "npm", - "namespace": null, - "name": "foobar", - "version": "12.3.1", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:npm/foobar@12.3.1", "expected_messages": null }, { "description": "Valid npm package with scope", "test_group": "base", "test_type": "validation", - "input": { - "type": "npm", - "namespace": "%40angular", - "name": "animation", - "version": "12.3.1", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:npm/%40angular/animation@12.3.1", "expected_messages": null }, { "description": "Valid npm package with qualifier vcs_url", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "npm", - "namespace": null, - "name": "mypackage", - "version": "12.4.5", - "qualifiers": { - "vcs_url": "git://host.com/path/to/repo.git%404345abcd34343" - }, - "subpath": null - }, + "input": "pkg:npm/mypackage@12.4.5?vcs_url=git://host.com/path/to/repo.git%404345abcd34343", "expected_messages": null }, { "description": "npm package with uppercase name", "test_group": "base", "test_type": "validation", - "input": { - "type": "npm", - "namespace": null, - "name": "MyPackage", - "version": "1.0.0", - "qualifiers": null, - "subpath": null - }, - "expected_messages": ["Name is not lowercased for purl type: 'npm'"] + "input": "pkg:npm/MyPackage@1.0.0", + "expected_messages": [ + "Name is not lowercased for purl type: 'npm'" + ] }, { "description": "npm package with uppercase name", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "npm", - "namespace": null, - "name": "MyPackage", - "version": "1.0.0", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:npm/MyPackage@1.0.0", "expected_messages": null } ] diff --git a/tests/types/nuget-test.json b/tests/types/nuget-test.json index caab63f8..f58094b8 100644 --- a/tests/types/nuget-test.json +++ b/tests/types/nuget-test.json @@ -96,84 +96,44 @@ "description": "Valid NuGet package with name and version", "test_group": "base", "test_type": "validation", - "input": { - "type": "nuget", - "namespace": null, - "name": "EnterpriseLibrary.Common", - "version": "6.0.1304", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:nuget/EnterpriseLibrary.Common@6.0.1304", "expected_messages": null }, { "description": "Valid NuGet package with lowercase name", "test_group": "base", "test_type": "validation", - "input": { - "type": "nuget", - "namespace": null, - "name": "newtonsoft.json", - "version": "13.0.3", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:nuget/newtonsoft.json@13.0.3", "expected_messages": null }, { "description": "NuGet package without version", "test_group": "base", "test_type": "validation", - "input": { - "type": "nuget", - "namespace": null, - "name": "NUnit", - "version": null, - "qualifiers": null, - "subpath": null - }, + "input": "pkg:nuget/NUnit", "expected_messages": null }, { "description": "NuGet package with namespace (should be prohibited)", "test_group": "base", "test_type": "validation", - "input": { - "type": "nuget", - "namespace": "microsoft", - "name": "aspnetcore.mvc", - "version": "2.2.0", - "qualifiers": null, - "subpath": null - }, - "expected_messages": ["Namespace is prohibited for purl type: 'nuget'"] + "input": "pkg:nuget/microsoft/aspnetcore.mvc@2.2.0", + "expected_messages": [ + "Namespace is prohibited for purl type: 'nuget'" + ] }, { "description": "NuGet package with pre-release version", "test_group": "base", "test_type": "validation", - "input": { - "type": "nuget", - "namespace": null, - "name": "EntityFramework", - "version": "7.0.0-preview.2", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:nuget/EntityFramework@7.0.0-preview.2", "expected_messages": null }, { "description": "NuGet package with 4-part version", "test_group": "base", "test_type": "validation", - "input": { - "type": "nuget", - "namespace": null, - "name": "System.Data.SqlClient", - "version": "4.8.5.1234", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:nuget/System.Data.SqlClient@4.8.5.1234", "expected_messages": null } ] diff --git a/tests/types/oci-test.json b/tests/types/oci-test.json index 08b43773..41a118fa 100644 --- a/tests/types/oci-test.json +++ b/tests/types/oci-test.json @@ -193,67 +193,28 @@ "description": "Valid OCI package with repository_url, arch, and tag", "test_group": "base", "test_type": "validation", - "input": { - "type": "oci", - "namespace": null, - "name": "debian", - "version": "sha256:244fd47e07d10", - "qualifiers": { - "repository_url": "docker.io/library/debian", - "arch": "amd64", - "tag": "latest" - }, - "subpath": null - }, + "input": "pkg:oci/debian@sha256:244fd47e07d10?arch=amd64&repository_url=docker.io/library/debian&tag=latest", "expected_messages": [] }, { "description": "Valid OCI package with repository_url and tag only", "test_group": "base", "test_type": "validation", - "input": { - "type": "oci", - "namespace": null, - "name": "debian", - "version": "sha256:244fd47e07d10", - "qualifiers": { - "repository_url": "ghcr.io/debian", - "tag": "bullseye" - }, - "subpath": null - }, + "input": "pkg:oci/debian@sha256:244fd47e07d10?repository_url=ghcr.io/debian&tag=bullseye", "expected_messages": [] }, { "description": "Valid OCI package without repository_url (allowed, registry agnostic)", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "oci", - "namespace": null, - "name": "hello-wasm", - "version": "sha256:244fd47e07d10", - "qualifiers": { - "tag": "v1" - }, - "subpath": null - }, + "input": "pkg:oci/hello-wasm@sha256:244fd47e07d10?tag=v1", "expected_messages": [] }, { "description": "OCI package with namespace provided (prohibited)", "test_group": "base", "test_type": "validation", - "input": { - "type": "oci", - "namespace": "library", - "name": "debian", - "version": "sha256:244fd47e07d10", - "qualifiers": { - "repository_url": "docker.io/library/debian" - }, - "subpath": null - }, + "input": "pkg:oci/library/debian@sha256:244fd47e07d10?repository_url=docker.io/library/debian", "expected_messages": [ "Namespace is prohibited for purl type: 'oci'" ] @@ -262,33 +223,14 @@ "description": "OCI package with missing version (required digest)", "test_group": "base", "test_type": "validation", - "input": { - "type": "oci", - "namespace": null, - "name": "debian", - "version": null, - "qualifiers": { - "repository_url": "docker.io/library/debian", - "tag": "latest" - }, - "subpath": null - }, + "input": "pkg:oci/debian?repository_url=docker.io/library/debian&tag=latest", "expected_messages": null }, { "description": "OCI package with uppercase name", "test_group": "base", "test_type": "validation", - "input": { - "type": "oci", - "namespace": null, - "name": "Debian", - "version": "sha256:244fd47e07d10", - "qualifiers": { - "repository_url": "docker.io/library/debian" - }, - "subpath": null - }, + "input": "pkg:oci/Debian@sha256:244fd47e07d10?repository_url=docker.io/library/debian", "expected_messages": [ "Name is not lowercased for purl type: 'oci'" ] @@ -297,16 +239,7 @@ "description": "OCI package with uppercase name", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "oci", - "namespace": null, - "name": "Debian", - "version": "sha256:244fd47e07d10", - "qualifiers": { - "repository_url": "docker.io/library/debian" - }, - "subpath": null - }, + "input": "pkg:oci/Debian@sha256:244fd47e07d10?repository_url=docker.io/library/debian", "expected_messages": null } ] diff --git a/tests/types/pub-test.json b/tests/types/pub-test.json index 09ed05ef..20be3882 100644 --- a/tests/types/pub-test.json +++ b/tests/types/pub-test.json @@ -87,73 +87,41 @@ "description": "Valid pub package with version", "test_group": "base", "test_type": "validation", - "input": { - "type": "pub", - "namespace": null, - "name": "characters", - "version": "1.2.0", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:pub/characters@1.2.0", "expected_messages": null }, { "description": "Valid pub package without version", "test_group": "base", "test_type": "validation", - "input": { - "type": "pub", - "namespace": null, - "name": "flutter", - "version": null, - "qualifiers": null, - "subpath": null - }, + "input": "pkg:pub/flutter", "expected_messages": null }, { "description": "Pub package with uppercase letters", "test_group": "base", "test_type": "validation", - "input": { - "type": "pub", - "namespace": null, - "name": "Flutter", - "version": "1.0.0", - "qualifiers": null, - "subpath": null - }, - "expected_messages": ["Name is not lowercased for purl type: 'pub'", "Name contains invalid characters but should only contain lowercase letters, digits, or underscores for purl type: 'pub'"] + "input": "pkg:pub/Flutter@1.0.0", + "expected_messages": [ + "Name is not lowercased for purl type: 'pub'", + "Name contains invalid characters but should only contain lowercase letters, digits, or underscores for purl type: 'pub'" + ] }, { "description": "Pub package with hyphen", "test_group": "base", "test_type": "validation", - "input": { - "type": "pub", - "namespace": null, - "name": "http-client", - "version": "0.13.6", - "qualifiers": null, - "subpath": null - }, - "expected_messages": ["Name contains invalid characters but should only contain lowercase letters, digits, or underscores for purl type: 'pub'"] + "input": "pkg:pub/http-client@0.13.6", + "expected_messages": [ + "Name contains invalid characters but should only contain lowercase letters, digits, or underscores for purl type: 'pub'" + ] }, { "description": "Pub package with qualifiers", "test_group": "base", "test_type": "validation", - "input": { - "type": "pub", - "namespace": null, - "name": "characters", - "version": "1.2.0", - "qualifiers": { - "repository_url": "https://pub.dev" - }, - "subpath": null - }, + "input": "pkg:pub/characters@1.2.0?repository_url=https://pub.dev", "expected_messages": null - } + } ] } diff --git a/tests/types/pypi-test.json b/tests/types/pypi-test.json index 07705ee5..ee1f7ff5 100644 --- a/tests/types/pypi-test.json +++ b/tests/types/pypi-test.json @@ -227,88 +227,44 @@ "description": "Valid PyPI package with version", "test_group": "base", "test_type": "validation", - "input": { - "type": "pypi", - "namespace": null, - "name": "django", - "version": "1.11.1", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:pypi/django@1.11.1", "expected_messages": [] }, { "description": "Valid PyPI package with file_name qualifier", "test_group": "base", "test_type": "validation", - "input": { - "type": "pypi", - "namespace": null, - "name": "django", - "version": "1.11.1", - "qualifiers": { - "file_name": "Django-1.11.1.tar.gz" - }, - "subpath": null - }, + "input": "pkg:pypi/django@1.11.1?file_name=Django-1.11.1.tar.gz", "expected_messages": [] }, { "description": "Valid PyPI package with wheel file_name", "test_group": "base", "test_type": "validation", - "input": { - "type": "pypi", - "namespace": null, - "name": "django", - "version": "1.11.1", - "qualifiers": { - "file_name": "Django-1.11.1-py2.py3-none-any.whl" - }, - "subpath": null - }, + "input": "pkg:pypi/django@1.11.1?file_name=Django-1.11.1-py2.py3-none-any.whl", "expected_messages": [] }, { "description": "PyPI package with name containing underscores and dots", "test_group": "base", "test_type": "validation", - "input": { - "type": "pypi", - "namespace": null, - "name": "django_allauth", - "version": "12.23", - "qualifiers": null, - "subpath": null - }, - "expected_messages": ["Name cannot contain `_` for purl type:'pypi'"] + "input": "pkg:pypi/django_allauth@12.23", + "expected_messages": [ + "Name cannot contain `_` for purl type:'pypi'" + ] }, { "description": "PyPI package with name containing underscores and dots", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "pypi", - "namespace": null, - "name": "django_allauth", - "version": "12.23", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:pypi/django_allauth@12.23", "expected_messages": null }, { "description": "Name with uppercase letters", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "pypi", - "namespace": null, - "name": "Django-AllAuth", - "version": "12.23", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:pypi/Django-AllAuth@12.23", "expected_messages": null } ] diff --git a/tests/types/qpkg-test.json b/tests/types/qpkg-test.json index b5c9dd3b..337fcef8 100644 --- a/tests/types/qpkg-test.json +++ b/tests/types/qpkg-test.json @@ -87,58 +87,28 @@ "description": "Valid QPKG with vendor and version", "test_group": "base", "test_type": "validation", - "input": { - "type": "qpkg", - "namespace": "blackberry", - "name": "com.qnx.sdp", - "version": "7.0.0.SGA201702151847", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:qpkg/blackberry/com.qnx.sdp@7.0.0.SGA201702151847", "expected_messages": null }, { "description": "Valid QPKG with complex name and version", "test_group": "base", "test_type": "validation", - "input": { - "type": "qpkg", - "namespace": "blackberry", - "name": "com.qnx.qnx710.foo.bar.qux", - "version": "0.0.4.01449T202205040833L", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:qpkg/blackberry/com.qnx.qnx710.foo.bar.qux@0.0.4.01449T202205040833L", "expected_messages": null }, { "description": "Valid QPKG with repository_url qualifier", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "qpkg", - "namespace": "blackberry", - "name": "com.qnx.sdp", - "version": "7.0.0", - "qualifiers": { - "repository_url": "https://example.com/qpkg" - }, - "subpath": null - }, + "input": "pkg:qpkg/blackberry/com.qnx.sdp@7.0.0?repository_url=https://example.com/qpkg", "expected_messages": null }, { "description": "QPKG missing vendor (namespace)", "test_group": "base", "test_type": "validation", - "input": { - "type": "qpkg", - "namespace": null, - "name": "com.qnx.sdp", - "version": "7.0.0", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:qpkg/com.qnx.sdp@7.0.0", "expected_messages": [ "Namespace is required for purl type: 'qpkg'" ] @@ -147,14 +117,7 @@ "description": "Namespace should be lowercased", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "qpkg", - "namespace": "BlackBerry", - "name": "com.qnx.sdp", - "version": "7.0.0", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:qpkg/BlackBerry/com.qnx.sdp@7.0.0", "expected_messages": null } ] diff --git a/tests/types/rpm-test.json b/tests/types/rpm-test.json index 73f3aa50..8d475810 100644 --- a/tests/types/rpm-test.json +++ b/tests/types/rpm-test.json @@ -157,87 +157,37 @@ "description": "Valid RPM with vendor, name, version and arch", "test_group": "base", "test_type": "validation", - "input": { - "type": "rpm", - "namespace": "fedora", - "name": "curl", - "version": "7.50.3-1.fc25", - "qualifiers": { - "arch": "i386" - }, - "subpath": null - }, + "input": "pkg:rpm/fedora/curl@7.50.3-1.fc25?arch=i386", "expected_messages": null }, { "description": "Valid RPM with epoch qualifier", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "rpm", - "namespace": "fedora", - "name": "centerim", - "version": "4.22.10-1.el6", - "qualifiers": { - "arch": "i686", - "epoch": "1", - "distro": "fedora-25" - }, - "subpath": null - }, + "input": "pkg:rpm/fedora/centerim@4.22.10-1.el6?arch=i686&distro=fedora-25&epoch=1", "expected_messages": null }, { "description": "RPM missing vendor (namespace)", "test_group": "base", "test_type": "validation", - "input": { - "type": "rpm", - "namespace": null, - "name": "curl", - "version": "7.50.3-1.fc25", - "qualifiers": { - "arch": "i386", - "distro": "fedora-25" - }, - "subpath": null - }, + "input": "pkg:rpm/curl@7.50.3-1.fc25?arch=i386&distro=fedora-25", "expected_messages": [ - "Namespace is required for purl type: 'rpm'", + "Namespace is required for purl type: 'rpm'" ] }, { "description": "Valid RPM without version", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "rpm", - "namespace": "opensuse", - "name": "zsh", - "version": null, - "qualifiers": { - "arch": "x86_64", - "distro": "opensuse-15.3" - }, - "subpath": null - }, + "input": "pkg:rpm/opensuse/zsh?arch=x86_64&distro=opensuse-15.3", "expected_messages": null }, { "description": "Valid RPM with repository_url instead of distro", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "rpm", - "namespace": "centos", - "name": "vim", - "version": "8.0-1.el7", - "qualifiers": { - "arch": "x86_64", - "repository_url": "https://mirror.centos.org/centos/7/os/x86_64" - }, - "subpath": null - }, + "input": "pkg:rpm/centos/vim@8.0-1.el7?arch=x86_64&repository_url=https://mirror.centos.org/centos/7/os/x86_64", "expected_messages": null } ] diff --git a/tests/types/swid-test.json b/tests/types/swid-test.json index 9716f654..5fbef419 100644 --- a/tests/types/swid-test.json +++ b/tests/types/swid-test.json @@ -140,98 +140,42 @@ "description": "Valid SWID with namespace, name, version and tag_id", "test_group": "base", "test_type": "validation", - "input": { - "type": "swid", - "namespace": "Acme", - "name": "example.com/Enterprise+Server", - "version": "1.0.0", - "qualifiers": { - "tag_id": "75b8c285-fa7b-485b-b199-4745e3004d0d" - }, - "subpath": null - }, + "input": "pkg:swid/Acme/example.com/Enterprise+Server@1.0.0?tag_id=75b8c285-fa7b-485b-b199-4745e3004d0d", "expected_messages": null }, { "description": "Valid SWID with only name and tag_id (no namespace)", "test_group": "base", "test_type": "validation", - "input": { - "type": "swid", - "namespace": null, - "name": "Fedora", - "version": "29", - "qualifiers": { - "tag_id": "org.fedoraproject.Fedora-29" - }, - "subpath": null - }, + "input": "pkg:swid/Fedora@29?tag_id=org.fedoraproject.Fedora-29", "expected_messages": null }, { "description": "Valid SWID with tag_creator_name and tag_creator_regid qualifiers", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "swid", - "namespace": "Adobe Systems Incorporated", - "name": "Adobe InDesign", - "version": "CC", - "qualifiers": { - "tag_id": "CreativeCloud-CS6-Win-GM-MUL", - "tag_creator_name": "AdobeCorp", - "tag_creator_regid": "com.adobe" - }, - "subpath": null - }, + "input": "pkg:swid/Adobe Systems Incorporated/Adobe InDesign@CC?tag_creator_name=AdobeCorp&tag_creator_regid=com.adobe&tag_id=CreativeCloud-CS6-Win-GM-MUL", "expected_messages": null }, { "description": "SWID missing required tag_id qualifier", "test_group": "base", "test_type": "validation", - "input": { - "type": "swid", - "namespace": "Acme", - "name": "example.com/Enterprise+Server", - "version": "1.0.0", - "qualifiers": {}, - "subpath": null - }, + "input": "pkg:swid/Acme/example.com/Enterprise+Server@1.0.0", "expected_messages": null }, { "description": "SWID with empty tag_id", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "swid", - "namespace": "Acme", - "name": "example.com/Enterprise+Server", - "version": "1.0.0", - "qualifiers": { - "tag_id": "" - }, - "subpath": null - }, + "input": "pkg:swid/Acme/example.com/Enterprise+Server@1.0.0?tag_id=", "expected_messages": null }, { "description": "Valid SWID with optional patch and tag_version", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "swid", - "namespace": "Acme", - "name": "example.com/Enterprise+Server", - "version": "1.0.0", - "qualifiers": { - "tag_id": "75b8c285-fa7b-485b-b199-4745e3004d0d", - "tag_version": "3", - "patch": "true" - }, - "subpath": null - }, + "input": "pkg:swid/Acme/example.com/Enterprise+Server@1.0.0?patch=true&tag_id=75b8c285-fa7b-485b-b199-4745e3004d0d&tag_version=3", "expected_messages": null } ] diff --git a/tests/types/swift-test.json b/tests/types/swift-test.json index 7f6dd00b..1a922afd 100644 --- a/tests/types/swift-test.json +++ b/tests/types/swift-test.json @@ -239,58 +239,30 @@ "description": "Valid Swift package with namespace, name, and version", "test_group": "base", "test_type": "validation", - "input": { - "type": "swift", - "namespace": "github.com/Alamofire", - "name": "Alamofire", - "version": "5.4.3", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:swift/github.com/Alamofire/Alamofire@5.4.3", "expected_messages": null }, { "description": "namespace is missing", "test_group": "base", "test_type": "validation", - "input": { - "type": "swift", - "namespace": null, - "name": "Alamofire", - "version": "5.4.3", - "qualifiers": null, - "subpath": null - }, - "expected_messages": ["Namespace is required for purl type: 'swift'"] + "input": "pkg:swift/Alamofire@5.4.3", + "expected_messages": [ + "Namespace is required for purl type: 'swift'" + ] }, { "description": "unsupported qualifier is provided", "test_group": "base", "test_type": "validation", - "input": { - "type": "swift", - "namespace": "github.com/Alamofire", - "name": "Alamofire", - "version": "5.4.3", - "qualifiers": { - "repository_url": "https://swiftpm.example.com/" - }, - "subpath": null - }, + "input": "pkg:swift/github.com/Alamofire/Alamofire@5.4.3?repository_url=https://swiftpm.example.com/", "expected_messages": null }, { "description": "Valid Swift package with case-sensitive namespace and name", "test_group": "advanced", "test_type": "validation", - "input": { - "type": "swift", - "namespace": "GitHub.com/SomeOrg", - "name": "MyLibrary", - "version": "1.0.0", - "qualifiers": null, - "subpath": null - }, + "input": "pkg:swift/GitHub.com/SomeOrg/MyLibrary@1.0.0", "expected_messages": null } ] From f01b357196dfd0aff2f6f21915ae17cc342f597b Mon Sep 17 00:00:00 2001 From: Tushar Goel Date: Wed, 3 Sep 2025 18:16:28 +0530 Subject: [PATCH 05/11] Fix schema and bitbucket tests Signed-off-by: Tushar Goel --- schemas/purl-test.schema.json | 40 +++------------------------------ tests/types/bitbucket-test.json | 13 +++++++---- 2 files changed, 12 insertions(+), 41 deletions(-) diff --git a/schemas/purl-test.schema.json b/schemas/purl-test.schema.json index 2d9d85d7..b61160a9 100644 --- a/schemas/purl-test.schema.json +++ b/schemas/purl-test.schema.json @@ -337,48 +337,14 @@ "title": "Expected validation messages and severities", "description": "List of validation objects with message and severity expected for this test. Can be an empty list.", "type": "array", - "$ref": "#/definitions/purl_validation_message" - } - }, - "required": [ - "input", - "expected_output" - ] - } - }, - { - "if": { - "properties": { - "test_type": { - "const": "validation" - } - }, - "required": [ - "test_type" - ] - }, - "then": { - "properties": { - "input": { - "title": "Expected decoded PURL components", - "description": "Test input as an object with decoded PURL components for validation.", - "$ref": "#/definitions/purl_components" - }, - "expected_messages": { - "title": "Expected messages", - "description": "Validation messages expected for this test. Can be null or a list of strings.", - "default": null, - "type": [ - "null", - "array" - ], "items": { - "type": "string" + "$ref": "#/definitions/purl_validation_message" } } }, "required": [ - "input" + "input", + "expected_output" ] } } diff --git a/tests/types/bitbucket-test.json b/tests/types/bitbucket-test.json index 888d673c..37faaa1b 100644 --- a/tests/types/bitbucket-test.json +++ b/tests/types/bitbucket-test.json @@ -97,28 +97,33 @@ "test_group": "base", "test_type": "validation", "input": "pkg:bitbucket/birkenfeld/pygments-main@244fd47e07d1014f0aed9c", - "expected_messages": null + "expected_output": [] }, { "description": "Valid Bitbucket package with subpath", "test_group": "base", "test_type": "validation", "input": "pkg:bitbucket/teamname/repo-name@1.0.0#src/main", - "expected_messages": null + "expected_output": [] }, { "description": "Valid Bitbucket package with qualifiers", "test_group": "base", "test_type": "validation", "input": "pkg:bitbucket/company/service@release-2024?arch=x86_64&os=linux", - "expected_messages": null + "expected_output": [ + { + "severity": "info", + "message": "Invalid qualifiers found: arch, os. Allowed qualifiers are: repository_url" + } + ] }, { "description": "Valid Bitbucket package with qualifiers", "test_group": "advanced", "test_type": "validation", "input": "pkg:bitbucket/company/service@release-2024?arch=x86_64&os=linux", - "expected_messages": null + "expected_output": [] } ] } From 4970e5af446e8337b0dbeaf444eca596e7afc6fb Mon Sep 17 00:00:00 2001 From: Tushar Goel Date: Wed, 3 Sep 2025 18:29:12 +0530 Subject: [PATCH 06/11] Fix tests according to new schema Signed-off-by: Tushar Goel --- tests/types/alpm-test.json | 22 ++++++++++++++-------- tests/types/apk-test.json | 27 ++++++++++++++++++--------- tests/types/bitnami-test.json | 8 ++++---- tests/types/cargo-test.json | 13 ++++++++----- tests/types/cocoapods-test.json | 13 ++++++++----- tests/types/composer-test.json | 27 ++++++++++++++++++--------- tests/types/conan-test.json | 15 ++++++++++----- tests/types/deb-test.json | 20 ++++++++++++++------ tests/types/docker-test.json | 15 ++++++++++----- 9 files changed, 104 insertions(+), 56 deletions(-) diff --git a/tests/types/alpm-test.json b/tests/types/alpm-test.json index e6dbd17b..71767a73 100644 --- a/tests/types/alpm-test.json +++ b/tests/types/alpm-test.json @@ -141,15 +141,18 @@ "test_group": "base", "test_type": "validation", "input": "pkg:alpm/arch/pacman@6.0.1-1?arch=x86_64", - "expected_messages": null + "expected_output": [] }, { "description": "alpm package with uppercase nmamespace", "test_group": "base", "test_type": "validation", "input": "pkg:alpm/Arch/pacman@6.0.1-1?arch=x86_64", - "expected_messages": [ - "Namespace is not lowercased for purl type: 'alpm'" + "expected_output": [ + { + "severity": "warning", + "message": "Namespace is not lowercased for purl type: 'alpm'" + } ] }, { @@ -157,29 +160,32 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:alpm/Arch/pacman@6.0.1-1?arch=x86_64", - "expected_messages": null + "expected_output": [] }, { "description": "Valid alpm package with 'any' arch", "test_group": "base", "test_type": "validation", "input": "pkg:alpm/arch/python-pip@21.0-1?arch=any", - "expected_messages": null + "expected_output": [] }, { "description": "Valid alpm package with epoch in version", "test_group": "advanced", "test_type": "validation", "input": "pkg:alpm/arch/containers-common@1:0.47.4-4?arch=x86_64", - "expected_messages": null + "expected_output": [] }, { "description": "alpm package missing namespace", "test_group": "base", "test_type": "validation", "input": "pkg:alpm/pacman@6.0.1-1?arch=x86_64", - "expected_messages": [ - "Namespace is required for purl type: 'alpm'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is required for purl type: 'alpm'" + } ] } ] diff --git a/tests/types/apk-test.json b/tests/types/apk-test.json index 132973a0..ba0cd3d1 100644 --- a/tests/types/apk-test.json +++ b/tests/types/apk-test.json @@ -96,29 +96,32 @@ "test_group": "base", "test_type": "validation", "input": "pkg:apk/alpine/curl@7.83.0-r0?arch=x86", - "expected_messages": null + "expected_output": [] }, { "description": "Valid apk package with higher version and arch qualifier", "test_group": "base", "test_type": "validation", "input": "pkg:apk/alpine/apk@2.12.9-r3?arch=x86", - "expected_messages": null + "expected_output": [] }, { "description": "Valid apk package with openwrt vendor", "test_group": "advanced", "test_type": "validation", "input": "pkg:apk/openwrt/busybox@1.35.0-r5?arch=mips", - "expected_messages": null + "expected_output": [] }, { "description": "apk package missing namespace", "test_group": "base", "test_type": "validation", "input": "pkg:apk/curl@7.83.0-r0?arch=x86", - "expected_messages": [ - "Namespace is required for purl type: 'apk'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is required for purl type: 'apk'" + } ] }, { @@ -126,9 +129,15 @@ "test_group": "base", "test_type": "validation", "input": "pkg:apk/FOO/BAR@7.83.0-r0?arch=x86", - "expected_messages": [ - "Namespace is not lowercased for purl type: 'apk'", - "Name is not lowercased for purl type: 'apk'" + "expected_output": [ + { + "severity": "warning", + "message": "Namespace is not lowercased for purl type: 'apk'" + }, + { + "severity": "warning", + "message": "Name is not lowercased for purl type: 'apk'" + } ] }, { @@ -136,7 +145,7 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:apk/FOO/BAR@7.83.0-r0?arch=x86", - "expected_messages": null + "expected_output": [] } ] } diff --git a/tests/types/bitnami-test.json b/tests/types/bitnami-test.json index a866d36e..ef1001d6 100644 --- a/tests/types/bitnami-test.json +++ b/tests/types/bitnami-test.json @@ -190,28 +190,28 @@ "test_group": "base", "test_type": "validation", "input": "pkg:bitnami/wordpress?distro=debian-12", - "expected_messages": null + "expected_output": [] }, { "description": "Valid Bitnami package with version and distro", "test_group": "base", "test_type": "validation", "input": "pkg:bitnami/wordpress@6.2.0?distro=debian-12", - "expected_messages": null + "expected_output": [] }, { "description": "Valid Bitnami package with arch and distro", "test_group": "advanced", "test_type": "validation", "input": "pkg:bitnami/wordpress@6.2.0?arch=arm64&distro=debian-12", - "expected_messages": null + "expected_output": [] }, { "description": "Valid Bitnami package with another distro", "test_group": "advanced", "test_type": "validation", "input": "pkg:bitnami/wordpress@6.2.0?arch=arm64&distro=photon-4", - "expected_messages": null + "expected_output": [] } ] } diff --git a/tests/types/cargo-test.json b/tests/types/cargo-test.json index 9c148c8f..82fb15e1 100644 --- a/tests/types/cargo-test.json +++ b/tests/types/cargo-test.json @@ -129,29 +129,32 @@ "test_group": "base", "test_type": "validation", "input": "pkg:cargo/rand@0.7.2", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid Cargo package with another example", "test_group": "base", "test_type": "validation", "input": "pkg:cargo/clap@2.33.0", - "expected_messages": null + "expected_output": [] }, { "description": "Cargo package without version", "test_group": "advanced", "test_type": "validation", "input": "pkg:cargo/structopt", - "expected_messages": null + "expected_output": [] }, { "description": "Cargo package with namespace (not allowed)", "test_group": "advanced", "test_type": "validation", "input": "pkg:cargo/rustlang/serde@1.0.0", - "expected_messages": [ - "Namespace is prohibited for purl type: 'cargo'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is prohibited for purl type: 'cargo'" + } ] } ] diff --git a/tests/types/cocoapods-test.json b/tests/types/cocoapods-test.json index 4010b2b1..87b980a4 100644 --- a/tests/types/cocoapods-test.json +++ b/tests/types/cocoapods-test.json @@ -170,29 +170,32 @@ "test_group": "base", "test_type": "validation", "input": "pkg:cocoapods/AFNetworking@4.0.1", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid CocoaPods package with subspec in subpath", "test_group": "base", "test_type": "validation", "input": "pkg:cocoapods/GoogleUtilities@7.5.2#NSData+zlib", - "expected_messages": [] + "expected_output": [] }, { "description": "CocoaPods package without version", "test_group": "advanced", "test_type": "validation", "input": "pkg:cocoapods/MapsIndoors", - "expected_messages": [] + "expected_output": [] }, { "description": "CocoaPods package with namespace (not allowed)", "test_group": "advanced", "test_type": "validation", "input": "pkg:cocoapods/apple/ShareKit@2.0#Twitter", - "expected_messages": [ - "Namespace is prohibited for purl type: 'cocoapods'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is prohibited for purl type: 'cocoapods'" + } ] } ] diff --git a/tests/types/composer-test.json b/tests/types/composer-test.json index 4ba5e7e9..e0f3780c 100644 --- a/tests/types/composer-test.json +++ b/tests/types/composer-test.json @@ -122,23 +122,29 @@ "test_group": "base", "test_type": "validation", "input": "pkg:composer/laravel/laravel@5.5.0", - "expected_messages": null + "expected_output": [] }, { "description": "Composer package without version", "test_group": "base", "test_type": "validation", "input": "pkg:composer/symfony/console", - "expected_messages": null + "expected_output": [] }, { "description": "Composer package with uppercase namespace (should normalize to lowercase)", "test_group": "base", "test_type": "validation", "input": "pkg:composer/Laravel/Framework@10.0.0", - "expected_messages": [ - "Namespace is not lowercased for purl type: 'composer'", - "Name is not lowercased for purl type: 'composer'" + "expected_output": [ + { + "severity": "warning", + "message": "Namespace is not lowercased for purl type: 'composer'" + }, + { + "severity": "warning", + "message": "Name is not lowercased for purl type: 'composer'" + } ] }, { @@ -146,15 +152,18 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:composer/Laravel/Framework@10.0.0", - "expected_messages": null + "expected_output": [] }, { "description": "Composer package missing namespace", "test_group": "base", "test_type": "validation", "input": "pkg:composer/console@5.0.0", - "expected_messages": [ - "Namespace is required for purl type: 'composer'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is required for purl type: 'composer'" + } ] }, { @@ -162,7 +171,7 @@ "test_group": "base", "test_type": "validation", "input": "pkg:composer/laravel/laravel@5.5.0?repository_url=https://packagist.org", - "expected_messages": null + "expected_output": [] } ] } diff --git a/tests/types/conan-test.json b/tests/types/conan-test.json index b78dba31..f9bda8f5 100644 --- a/tests/types/conan-test.json +++ b/tests/types/conan-test.json @@ -329,35 +329,40 @@ "test_group": "base", "test_type": "validation", "input": "pkg:conan/openssl@3.0.3", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid Conan package with namespace (vendor) and qualifiers user+channel", "test_group": "base", "test_type": "validation", "input": "pkg:conan/openssl.org/openssl@3.0.3?channel=stable&user=bincrafters", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid Conan package with namespace, complex qualifiers including rrev and prev", "test_group": "base", "test_type": "validation", "input": "pkg:conan/openssl.org/openssl@3.0.3?arch=x86_64&build_type=Debug&compiler=Visual Studio&compiler.runtime=MDd&compiler.version=16&os=Windows&prev=b429db8a0e324114c25ec387bfd8281f330d7c5c&rrev=93a82349c31917d2d674d22065c7a9ef9f380c8e&shared=True", - "expected_messages": null + "expected_output": null }, { "description": "Valid Conan package with only namespace and no qualifiers", "test_group": "base", "test_type": "validation", "input": "pkg:conan/openssl.org/openssl@3.0.3", - "expected_messages": [] + "expected_output": [] }, { "description": "Conan package with unsupported qualifier key", "test_group": "advanced", "test_type": "validation", "input": "pkg:conan/openssl@3.0.3?foo=bar", - "expected_messages": null + "expected_output": [ + { + "severity": "info", + "message": "Invalid qualifiers found: arch, build_type, compiler, compiler.runtime, compiler.version, os, shared. Allowed qualifiers are: channel, prev, repository_url, rrev, user" + } + ] } ] } diff --git a/tests/types/deb-test.json b/tests/types/deb-test.json index a3e2fadb..9556a8f3 100644 --- a/tests/types/deb-test.json +++ b/tests/types/deb-test.json @@ -291,29 +291,32 @@ "test_group": "base", "test_type": "validation", "input": "pkg:deb/debian/curl@7.50.3-1?arch=i386&distro=jessie", - "expected_messages": null + "expected_output": null }, { "description": "Valid deb package with vendor, name, version, without distro", "test_group": "base", "test_type": "validation", "input": "pkg:deb/ubuntu/dpkg@1.19.0.4?arch=amd64", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid deb source package", "test_group": "base", "test_type": "validation", "input": "pkg:deb/debian/attr@1:2.4.47-2?arch=source", - "expected_messages": [] + "expected_output": [] }, { "description": "Deb package missing vendor", "test_group": "advanced", "test_type": "validation", "input": "pkg:deb/curl@7.50.3-1?arch=amd64", - "expected_messages": [ - "Namespace is required for purl type: 'deb'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is required for purl type: 'deb'" + } ] }, { @@ -321,7 +324,12 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:deb/debian/curl@7.50.3-1?foo=bar", - "expected_messages": null + "expected_output": [ + { + "severity": "info", + "message": "Invalid qualifiers found: distro. Allowed qualifiers are: arch, repository_url" + } + ] } ] } diff --git a/tests/types/docker-test.json b/tests/types/docker-test.json index ce0572b8..770cf958 100644 --- a/tests/types/docker-test.json +++ b/tests/types/docker-test.json @@ -187,35 +187,40 @@ "test_group": "base", "test_type": "validation", "input": "pkg:docker/cassandra@latest", - "expected_messages": null + "expected_output": [] }, { "description": "Valid Docker image with namespace and sha256 digest", "test_group": "base", "test_type": "validation", "input": "pkg:docker/smartentry/debian@dc437cc87d10", - "expected_messages": null + "expected_output": [] }, { "description": "Valid Docker image with repository_url qualifier", "test_group": "advanced", "test_type": "validation", "input": "pkg:docker/customer/dockerimage@sha256:244fd47e07d10?repository_url=gcr.io", - "expected_messages": null + "expected_output": [] }, { "description": "Docker image with unsupported qualifier", "test_group": "advanced", "test_type": "validation", "input": "pkg:docker/ubuntu@20.04?bad=value", - "expected_messages": null + "expected_output": [] }, { "description": "Docker image with unsupported qualifier", "test_group": "base", "test_type": "validation", "input": "pkg:docker/ubuntu@20.04?bad=value", - "expected_messages": null + "expected_output": [ + { + "severity": "info", + "message": "Invalid qualifiers found: bad. Allowed qualifiers are: repository_url" + } + ] } ] } From f3cc7ae80197457b1c3de2daeb7f526ed4cc69d9 Mon Sep 17 00:00:00 2001 From: Tushar Goel Date: Wed, 3 Sep 2025 18:45:12 +0530 Subject: [PATCH 07/11] Update tests Signed-off-by: Tushar Goel --- tests/types/conan-test.json | 2 +- tests/types/conda-test.json | 13 +++++++----- tests/types/cpan-test.json | 33 ++++++++++++++++++++----------- tests/types/cran-test.json | 13 +++++++----- tests/types/deb-test.json | 2 +- tests/types/gem-test.json | 10 +++++----- tests/types/generic-test.json | 12 +++++------ tests/types/github-test.json | 11 +++++++---- tests/types/golang-test.json | 20 ++++++++++++------- tests/types/hackage-test.json | 22 +++++++++++++-------- tests/types/hex-test.json | 26 ++++++++++++++---------- tests/types/huggingface-test.json | 13 +++++++----- tests/types/luarocks-test.json | 10 +++++----- tests/types/maven-test.json | 17 +++++++++------- tests/types/mlflow-test.json | 17 +++++++++------- tests/types/npm-test.json | 15 ++++++++------ tests/types/nuget-test.json | 17 +++++++++------- tests/types/oci-test.json | 24 +++++++++++++--------- tests/types/pub-test.json | 21 ++++++++++++-------- tests/types/pypi-test.json | 17 +++++++++------- tests/types/qpkg-test.json | 15 ++++++++------ tests/types/rpm-test.json | 15 ++++++++------ tests/types/swid-test.json | 12 +++++------ tests/types/swift-test.json | 13 +++++++----- 24 files changed, 222 insertions(+), 148 deletions(-) diff --git a/tests/types/conan-test.json b/tests/types/conan-test.json index f9bda8f5..f06d4ce8 100644 --- a/tests/types/conan-test.json +++ b/tests/types/conan-test.json @@ -343,7 +343,7 @@ "test_group": "base", "test_type": "validation", "input": "pkg:conan/openssl.org/openssl@3.0.3?arch=x86_64&build_type=Debug&compiler=Visual Studio&compiler.runtime=MDd&compiler.version=16&os=Windows&prev=b429db8a0e324114c25ec387bfd8281f330d7c5c&rrev=93a82349c31917d2d674d22065c7a9ef9f380c8e&shared=True", - "expected_output": null + "expected_output": [] }, { "description": "Valid Conan package with only namespace and no qualifiers", diff --git a/tests/types/conda-test.json b/tests/types/conda-test.json index 8b01105e..6b2ef77f 100644 --- a/tests/types/conda-test.json +++ b/tests/types/conda-test.json @@ -117,22 +117,25 @@ "test_group": "base", "test_type": "validation", "input": "pkg:conda/absl-py@0.4.1", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid Conda package with full qualifiers (build, channel, subdir, type)", "test_group": "base", "test_type": "validation", "input": "pkg:conda/absl-py@0.4.1?build=py36h06a4308_0&channel=main&subdir=linux-64&type=tar.bz2", - "expected_messages": [] + "expected_output": [] }, { "description": "Conda package with namespace (not allowed)", "test_group": "advanced", "test_type": "validation", "input": "pkg:conda/anaconda/absl-py@0.4.1", - "expected_messages": [ - "Namespace is prohibited for purl type: 'conda'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is prohibited for purl type: 'conda'" + } ] }, { @@ -140,7 +143,7 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:conda/absl-py@0.4.1?foo=bar", - "expected_messages": null + "expected_output": [] } ] } diff --git a/tests/types/cpan-test.json b/tests/types/cpan-test.json index 143c3e87..d0817eb1 100644 --- a/tests/types/cpan-test.json +++ b/tests/types/cpan-test.json @@ -561,36 +561,39 @@ "test_group": "base", "test_type": "validation", "input": "pkg:cpan/Perl::Version@1.013", - "expected_messages": null + "expected_output": [] }, { "description": "Valid CPAN distribution with uppercase namespace (author ID)", "test_group": "base", "test_type": "validation", "input": "pkg:cpan/DROLSKY/DateTime@1.55", - "expected_messages": null + "expected_output": [] }, { "description": "Valid CPAN distribution without version", "test_group": "base", "test_type": "validation", "input": "pkg:cpan/GDT/URI-PackageURL", - "expected_messages": null + "expected_output": [] }, { "description": "Valid CPAN module with :: in name and no namespace", "test_group": "base", "test_type": "validation", "input": "pkg:cpan/LWP::UserAgent", - "expected_messages": [] + "expected_output": [] }, { "description": "CPAN distribution with lowercase namespace (must be uppercase)", "test_group": "base", "test_type": "validation", "input": "pkg:cpan/oalders/libwww-perl@6.76", - "expected_messages": [ - "Namespace must be uppercase for purl type: 'cpan'" + "expected_output": [ + { + "severity": "warning", + "message": "Namespace must be uppercase for purl type: 'cpan'" + } ] }, { @@ -598,15 +601,18 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:cpan/oalders/libwww-perl@6.76", - "expected_messages": null + "expected_output": [] }, { "description": "CPAN module with '-' in name (not allowed without namespace)", "test_group": "base", "test_type": "validation", "input": "pkg:cpan/libwww-perl@6.76", - "expected_messages": [ - "Name must not contain '-' when Namespace is absent for purl type: 'cpan'" + "expected_output": [ + { + "severity": "error", + "message": "Name must not contain '-' when Namespace is absent for purl type: 'cpan'" + } ] }, { @@ -614,8 +620,11 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:cpan/TESTUSER/Bad::Dist@1.0", - "expected_messages": [ - "Name must not contain '::' when Namespace is absent for purl type: 'cpan'" + "expected_output": [ + { + "severity": "error", + "message": "Name must not contain '::' when Namespace is present for purl type: 'cpan'" + } ] }, { @@ -623,7 +632,7 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:cpan/OALDERS/libwww-perl@6.76?download_url=https://cpan.metacpan.org/authors/id/O/OA/OALDERS/libwww-perl-6.76.tar.gz&ext=tar.gz&repository_url=https://cpan.metacpan.org&vcs_url=https://github.com/libwww-perl", - "expected_messages": [] + "expected_output": [] } ] } diff --git a/tests/types/cran-test.json b/tests/types/cran-test.json index b7c08630..1624f53d 100644 --- a/tests/types/cran-test.json +++ b/tests/types/cran-test.json @@ -247,29 +247,32 @@ "test_group": "base", "test_type": "validation", "input": "pkg:cran/A3@1.0.0", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid CRAN package with hyphen in version", "test_group": "base", "test_type": "validation", "input": "pkg:cran/rJava@1.0-4", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid CRAN package with complex version", "test_group": "base", "test_type": "validation", "input": "pkg:cran/caret@6.0-88", - "expected_messages": [] + "expected_output": [] }, { "description": "CRAN package with namespace (not allowed)", "test_group": "base", "test_type": "validation", "input": "pkg:cran/ml/caret@6.0-88", - "expected_messages": [ - "Namespace is prohibited for purl type: 'cran'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is prohibited for purl type: 'cran'" + } ] } ] diff --git a/tests/types/deb-test.json b/tests/types/deb-test.json index 9556a8f3..7fce3656 100644 --- a/tests/types/deb-test.json +++ b/tests/types/deb-test.json @@ -291,7 +291,7 @@ "test_group": "base", "test_type": "validation", "input": "pkg:deb/debian/curl@7.50.3-1?arch=i386&distro=jessie", - "expected_output": null + "expected_output": [] }, { "description": "Valid deb package with vendor, name, version, without distro", diff --git a/tests/types/gem-test.json b/tests/types/gem-test.json index 2144c2d8..14afecea 100644 --- a/tests/types/gem-test.json +++ b/tests/types/gem-test.json @@ -146,35 +146,35 @@ "test_group": "base", "test_type": "validation", "input": "pkg:gem/ruby-advisory-db-check@0.12.4", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid RubyGem with java platform", "test_group": "base", "test_type": "validation", "input": "pkg:gem/jruby-launcher@1.1.2?platform=java", - "expected_messages": [] + "expected_output": [] }, { "description": "Subpath included", "test_group": "base", "test_type": "validation", "input": "pkg:gem/nokogiri@1.14.3#lib/nokogiri.rb", - "expected_messages": [] + "expected_output": [] }, { "description": "Extra unknown qualifier", "test_group": "base", "test_type": "validation", "input": "pkg:gem/sinatra@3.1.2?unknown=value", - "expected_messages": null + "expected_output": [] }, { "description": "Extra unknown qualifier", "test_group": "advanced", "test_type": "validation", "input": "pkg:gem/sinatra@3.1.2?unknown=value", - "expected_messages": null + "expected_output": [] } ] } diff --git a/tests/types/generic-test.json b/tests/types/generic-test.json index 75b8dc2d..7cfb8357 100644 --- a/tests/types/generic-test.json +++ b/tests/types/generic-test.json @@ -139,42 +139,42 @@ "test_group": "base", "test_type": "validation", "input": "pkg:generic/openssl@1.1.10g", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid generic package with download_url and checksum", "test_group": "base", "test_type": "validation", "input": "pkg:generic/openssl@1.1.10g?checksum=sha256:de4d501267da&download_url=https://openssl.org/source/openssl-1.1.0g.tar.gz", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid generic package with vcs_url", "test_group": "base", "test_type": "validation", "input": "pkg:generic/bitwarderl?vcs_url=git+https://git.fsfe.org/dxtr/bitwarderl@cc55108da32", - "expected_messages": null + "expected_output": [] }, { "description": "Extra unknown qualifier", "test_group": "advanced", "test_type": "validation", "input": "pkg:generic/mypkg@3.0.0?foo=bar", - "expected_messages": null + "expected_output": [] }, { "description": "Subpath included", "test_group": "base", "test_type": "validation", "input": "pkg:generic/libexample@0.5.2#src/libexample.c", - "expected_messages": [] + "expected_output": [] }, { "description": "Missing version and no qualifiers", "test_group": "advanced", "test_type": "validation", "input": "pkg:generic/noversionpkg", - "expected_messages": [] + "expected_output": [] } ] } diff --git a/tests/types/github-test.json b/tests/types/github-test.json index 333a2fd8..68fa2982 100644 --- a/tests/types/github-test.json +++ b/tests/types/github-test.json @@ -138,22 +138,25 @@ "test_group": "base", "test_type": "validation", "input": "pkg:github/package-url/purl-spec@244fd47e07d1004", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid GitHub package with subpath", "test_group": "base", "test_type": "validation", "input": "pkg:github/package-url/purl-spec@244fd47e07d1004#everybody/loves/dogs", - "expected_messages": [] + "expected_output": [] }, { "description": "GitHub package missing namespace", "test_group": "advanced", "test_type": "validation", "input": "pkg:github/purl-spec@244fd47e07d1004", - "expected_messages": [ - "Namespace is required for purl type: 'github'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is required for purl type: 'github'" + } ] } ] diff --git a/tests/types/golang-test.json b/tests/types/golang-test.json index 12d7a1e6..69fb2efe 100644 --- a/tests/types/golang-test.json +++ b/tests/types/golang-test.json @@ -229,29 +229,32 @@ "test_group": "base", "test_type": "validation", "input": "pkg:golang/github.com/gorilla/context@234fd47e07d1004f0aed9c", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid golang package with namespace and name only (no version)", "test_group": "base", "test_type": "validation", "input": "pkg:golang/golang.org/x/crypto", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid golang package with subpath", "test_group": "advanced", "test_type": "validation", "input": "pkg:golang/google.golang.org/genproto#googleapis/api/annotations", - "expected_messages": [] + "expected_output": [] }, { "description": "Golang package with uppercase namespace", "test_group": "base", "test_type": "validation", "input": "pkg:golang/GitHub.com/Gorilla/context@234fd47e07d1004f0aed9c", - "expected_messages": [ - "Namespace is not lowercased for purl type: 'golang'" + "expected_output": [ + { + "severity": "warning", + "message": "Namespace is not lowercased for purl type: 'golang'" + } ] }, { @@ -259,8 +262,11 @@ "test_group": "base", "test_type": "validation", "input": "pkg:golang/context@234fd47e07d1004f0aed9c", - "expected_messages": [ - "Namespace is required for purl type: 'golang'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is required for purl type: 'golang'" + } ] } ] diff --git a/tests/types/hackage-test.json b/tests/types/hackage-test.json index a0bc8c76..ce1ff95e 100644 --- a/tests/types/hackage-test.json +++ b/tests/types/hackage-test.json @@ -213,29 +213,32 @@ "test_group": "base", "test_type": "validation", "input": "pkg:hackage/lens@5.0.1", - "expected_messages": null + "expected_output": [] }, { "description": "Valid Hackage package with uppercase letters", "test_group": "base", "test_type": "validation", "input": "pkg:hackage/AC-HalfInteger@1.2.1", - "expected_messages": null + "expected_output": [] }, { "description": "Valid Hackage package with numbers and dots in version", "test_group": "base", "test_type": "validation", "input": "pkg:hackage/3d-graphics-examples@0.0.0.2", - "expected_messages": null + "expected_output": [] }, { "description": "Hackage package with namespace included", "test_group": "base", "test_type": "validation", "input": "pkg:hackage/haskell/text@1.2.4", - "expected_messages": [ - "Namespace is prohibited for purl type: 'hackage'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is prohibited for purl type: 'hackage'" + } ] }, { @@ -243,8 +246,11 @@ "test_group": "base", "test_type": "validation", "input": "pkg:hackage/My_Package@0.1", - "expected_messages": [ - "Name contains underscores but should be kebab-case for purl type: 'hackage'" + "expected_output": [ + { + "severity": "error", + "message": "Name contains underscores but should be kebab-case for purl type: 'hackage'" + } ] }, { @@ -252,7 +258,7 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:hackage/My_Package@0.1", - "expected_messages": null + "expected_output": [] } ] } diff --git a/tests/types/hex-test.json b/tests/types/hex-test.json index 5fcb50c3..30cc5e11 100644 --- a/tests/types/hex-test.json +++ b/tests/types/hex-test.json @@ -174,36 +174,39 @@ "test_group": "base", "test_type": "validation", "input": "pkg:hex/jason@1.1.2", - "expected_messages": null + "expected_output": [] }, { "description": "Valid Hex package with optional namespace", "test_group": "base", "test_type": "validation", "input": "pkg:hex/acme/foo@2.3.0", - "expected_messages": null + "expected_output": [] }, { "description": "Valid Hex package with subpath", "test_group": "base", "test_type": "validation", "input": "pkg:hex/phoenix_html@2.13.3#priv/static/phoenix_html.js", - "expected_messages": null + "expected_output": [] }, { "description": "Valid Hex package with repository_url qualifier", "test_group": "base", "test_type": "validation", "input": "pkg:hex/bar@1.2.3?repository_url=https://myrepo.example.com", - "expected_messages": null + "expected_output": [] }, { "description": "Hex package with uppercase name", "test_group": "base", "test_type": "validation", "input": "pkg:hex/Phoenix_HTML@1.0.0", - "expected_messages": [ - "Name is not lowercased for purl type: 'hex'" + "expected_output": [ + { + "severity": "warning", + "message": "Name is not lowercased for purl type: 'hex'" + } ] }, { @@ -211,15 +214,18 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:hex/Phoenix_HTML@1.0.0", - "expected_messages": null + "expected_output": [] }, { "description": "Hex package with uppercase namespace", "test_group": "base", "test_type": "validation", "input": "pkg:hex/ACME/foo@1.0.0", - "expected_messages": [ - "Namespace is not lowercased for purl type: 'hex'" + "expected_output": [ + { + "severity": "warning", + "message": "Namespace is not lowercased for purl type: 'hex'" + } ] }, { @@ -227,7 +233,7 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:hex/ACME/foo@1.0.0", - "expected_messages": null + "expected_output": [] } ] } diff --git a/tests/types/huggingface-test.json b/tests/types/huggingface-test.json index e47c9622..b15eba31 100644 --- a/tests/types/huggingface-test.json +++ b/tests/types/huggingface-test.json @@ -246,8 +246,11 @@ "test_group": "base", "test_type": "validation", "input": "pkg:huggingface/distilbert-base-uncased@043235d6088ecd3dd5fb5ca3592b6913fd516027", - "expected_messages": [ - "Namespace is required for purl type: 'huggingface'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is required for purl type: 'huggingface'" + } ] }, { @@ -255,21 +258,21 @@ "test_group": "base", "test_type": "validation", "input": "pkg:huggingface/microsoft/deberta-v3-base@559062ad13d311b87b2c455e67dcd5f1c8f65111", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid Hugging Face model with subpath", "test_group": "base", "test_type": "validation", "input": "pkg:huggingface/EleutherAI/gpt-neo-1.3B@797174552ae47f449ab70b684cabcb6603e5e85e#tokenizer/config.json", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid Hugging Face model with repository_url qualifier", "test_group": "base", "test_type": "validation", "input": "pkg:huggingface/EleutherAI/gpt-neo-1.3B@797174552ae47f449ab70b684cabcb6603e5e85e?repository_url=https://hub-ci.huggingface.co", - "expected_messages": [] + "expected_output": [] } ] } diff --git a/tests/types/luarocks-test.json b/tests/types/luarocks-test.json index 9f1ea900..80e72cdc 100644 --- a/tests/types/luarocks-test.json +++ b/tests/types/luarocks-test.json @@ -133,35 +133,35 @@ "test_group": "base", "test_type": "validation", "input": "pkg:luarocks/luasocket@3.1.0-1", - "expected_messages": null + "expected_output": [] }, { "description": "Valid LuaRocks package with namespace and version", "test_group": "base", "test_type": "validation", "input": "pkg:luarocks/hisham/luafilesystem@1.8.0-1", - "expected_messages": null + "expected_output": [] }, { "description": "Valid LuaRocks package with private repository_url qualifier", "test_group": "base", "test_type": "validation", "input": "pkg:luarocks/username/packagename@0.1.0-1?repository_url=https://example.com/private_rocks_server/", - "expected_messages": null + "expected_output": [] }, { "description": "Unsupported qualifier is provided", "test_group": "base", "test_type": "validation", "input": "pkg:luarocks/username/packagename@0.1.0-1?channel=beta", - "expected_messages": null + "expected_output": [] }, { "description": "Advanced validation for name with uppercase letters", "test_group": "advanced", "test_type": "validation", "input": "pkg:luarocks/LuaSocket@3.1.0-1?private_url=https://example.com/private_rocks_server/", - "expected_messages": null + "expected_output": [] } ] } diff --git a/tests/types/maven-test.json b/tests/types/maven-test.json index 72782bd1..f688d812 100644 --- a/tests/types/maven-test.json +++ b/tests/types/maven-test.json @@ -904,43 +904,46 @@ "test_group": "base", "test_type": "validation", "input": "pkg:maven/org.apache.xmlgraphics/batik-anim@1.9.1", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid Maven package with type qualifier (pom)", "test_group": "base", "test_type": "validation", "input": "pkg:maven/org.apache.xmlgraphics/batik-anim@1.9.1?type=pom", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid Maven package with classifier qualifier (sources)", "test_group": "base", "test_type": "validation", "input": "pkg:maven/org.apache.xmlgraphics/batik-anim@1.9.1?classifier=sources", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid Maven package with both type and classifier qualifiers", "test_group": "base", "test_type": "validation", "input": "pkg:maven/org.apache.xmlgraphics/batik-anim@1.9.1?classifier=dist&type=zip", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid Maven package with repository_url qualifier", "test_group": "base", "test_type": "validation", "input": "pkg:maven/groovy/groovy@1.0?repository_url=https://maven.google.com", - "expected_messages": [] + "expected_output": [] }, { "description": "Maven package missing namespace (groupId required)", "test_group": "advanced", "test_type": "validation", "input": "pkg:maven/batik-anim@1.9.1", - "expected_messages": [ - "Namespace is required for purl type: 'maven'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is required for purl type: 'maven'" + } ] } ] diff --git a/tests/types/mlflow-test.json b/tests/types/mlflow-test.json index a4e358c2..9724d81d 100644 --- a/tests/types/mlflow-test.json +++ b/tests/types/mlflow-test.json @@ -266,29 +266,32 @@ "test_group": "base", "test_type": "validation", "input": "pkg:mlflow/creditfraud@3", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid MLflow package with repository_url qualifier", "test_group": "base", "test_type": "validation", "input": "pkg:mlflow/creditfraud@3?repository_url=https://westus2.api.azureml.ms/mlflow/v1.0/subscriptions/a50f2011-fab8-4164-af23-c62881ef8c95/resourceGroups/TestResourceGroup/providers/Microsoft.MachineLearningServices/workspaces/TestWorkspace", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid MLflow package with model_uuid and run_id qualifiers", "test_group": "base", "test_type": "validation", "input": "pkg:mlflow/trafficsigns@10?model_uuid=36233173b22f4c89b451f1228d700d49&repository_url=https://adb-5245952564735461.0.azuredatabricks.net/api/2.0/mlflow&run_id=410a3121-2709-4f88-98dd-dba0ef056b0a", - "expected_messages": [] + "expected_output": [] }, { "description": "MLflow package with namespace (not allowed)", "test_group": "advanced", "test_type": "validation", "input": "pkg:mlflow/azure/creditfraud@3", - "expected_messages": [ - "Namespace is prohibited for purl type: 'mlflow'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is prohibited for purl type: 'mlflow'" + } ] }, { @@ -296,14 +299,14 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:mlflow/creditfraud@3?foo=bar", - "expected_messages": null + "expected_output": [] }, { "description": "MLflow package with unsupported qualifier", "test_group": "base", "test_type": "validation", "input": "pkg:mlflow/creditfraud@3?foo=bar", - "expected_messages": null + "expected_output": [] } ] } diff --git a/tests/types/npm-test.json b/tests/types/npm-test.json index f9a244ff..4c768d10 100644 --- a/tests/types/npm-test.json +++ b/tests/types/npm-test.json @@ -260,29 +260,32 @@ "test_group": "base", "test_type": "validation", "input": "pkg:npm/foobar@12.3.1", - "expected_messages": null + "expected_output": [] }, { "description": "Valid npm package with scope", "test_group": "base", "test_type": "validation", "input": "pkg:npm/%40angular/animation@12.3.1", - "expected_messages": null + "expected_output": [] }, { "description": "Valid npm package with qualifier vcs_url", "test_group": "advanced", "test_type": "validation", "input": "pkg:npm/mypackage@12.4.5?vcs_url=git://host.com/path/to/repo.git%404345abcd34343", - "expected_messages": null + "expected_output": [] }, { "description": "npm package with uppercase name", "test_group": "base", "test_type": "validation", "input": "pkg:npm/MyPackage@1.0.0", - "expected_messages": [ - "Name is not lowercased for purl type: 'npm'" + "expected_output": [ + { + "severity": "warning", + "message": "Name is not lowercased for purl type: 'npm'" + } ] }, { @@ -290,7 +293,7 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:npm/MyPackage@1.0.0", - "expected_messages": null + "expected_output": [] } ] } diff --git a/tests/types/nuget-test.json b/tests/types/nuget-test.json index f58094b8..e8bf6d09 100644 --- a/tests/types/nuget-test.json +++ b/tests/types/nuget-test.json @@ -97,29 +97,32 @@ "test_group": "base", "test_type": "validation", "input": "pkg:nuget/EnterpriseLibrary.Common@6.0.1304", - "expected_messages": null + "expected_output": [] }, { "description": "Valid NuGet package with lowercase name", "test_group": "base", "test_type": "validation", "input": "pkg:nuget/newtonsoft.json@13.0.3", - "expected_messages": null + "expected_output": [] }, { "description": "NuGet package without version", "test_group": "base", "test_type": "validation", "input": "pkg:nuget/NUnit", - "expected_messages": null + "expected_output": [] }, { "description": "NuGet package with namespace (should be prohibited)", "test_group": "base", "test_type": "validation", "input": "pkg:nuget/microsoft/aspnetcore.mvc@2.2.0", - "expected_messages": [ - "Namespace is prohibited for purl type: 'nuget'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is prohibited for purl type: 'nuget'" + } ] }, { @@ -127,14 +130,14 @@ "test_group": "base", "test_type": "validation", "input": "pkg:nuget/EntityFramework@7.0.0-preview.2", - "expected_messages": null + "expected_output": [] }, { "description": "NuGet package with 4-part version", "test_group": "base", "test_type": "validation", "input": "pkg:nuget/System.Data.SqlClient@4.8.5.1234", - "expected_messages": null + "expected_output": [] } ] } diff --git a/tests/types/oci-test.json b/tests/types/oci-test.json index 41a118fa..ce18883d 100644 --- a/tests/types/oci-test.json +++ b/tests/types/oci-test.json @@ -194,29 +194,32 @@ "test_group": "base", "test_type": "validation", "input": "pkg:oci/debian@sha256:244fd47e07d10?arch=amd64&repository_url=docker.io/library/debian&tag=latest", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid OCI package with repository_url and tag only", "test_group": "base", "test_type": "validation", "input": "pkg:oci/debian@sha256:244fd47e07d10?repository_url=ghcr.io/debian&tag=bullseye", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid OCI package without repository_url (allowed, registry agnostic)", "test_group": "advanced", "test_type": "validation", "input": "pkg:oci/hello-wasm@sha256:244fd47e07d10?tag=v1", - "expected_messages": [] + "expected_output": [] }, { "description": "OCI package with namespace provided (prohibited)", "test_group": "base", "test_type": "validation", "input": "pkg:oci/library/debian@sha256:244fd47e07d10?repository_url=docker.io/library/debian", - "expected_messages": [ - "Namespace is prohibited for purl type: 'oci'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is prohibited for purl type: 'oci'" + } ] }, { @@ -224,15 +227,18 @@ "test_group": "base", "test_type": "validation", "input": "pkg:oci/debian?repository_url=docker.io/library/debian&tag=latest", - "expected_messages": null + "expected_output": [] }, { "description": "OCI package with uppercase name", "test_group": "base", "test_type": "validation", "input": "pkg:oci/Debian@sha256:244fd47e07d10?repository_url=docker.io/library/debian", - "expected_messages": [ - "Name is not lowercased for purl type: 'oci'" + "expected_output": [ + { + "severity": "warning", + "message": "Name is not lowercased for purl type: 'oci'" + } ] }, { @@ -240,7 +246,7 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:oci/Debian@sha256:244fd47e07d10?repository_url=docker.io/library/debian", - "expected_messages": null + "expected_output": [] } ] } diff --git a/tests/types/pub-test.json b/tests/types/pub-test.json index 20be3882..126e71e8 100644 --- a/tests/types/pub-test.json +++ b/tests/types/pub-test.json @@ -88,23 +88,25 @@ "test_group": "base", "test_type": "validation", "input": "pkg:pub/characters@1.2.0", - "expected_messages": null + "expected_output": [] }, { "description": "Valid pub package without version", "test_group": "base", "test_type": "validation", "input": "pkg:pub/flutter", - "expected_messages": null + "expected_output": [] }, { "description": "Pub package with uppercase letters", "test_group": "base", "test_type": "validation", "input": "pkg:pub/Flutter@1.0.0", - "expected_messages": [ - "Name is not lowercased for purl type: 'pub'", - "Name contains invalid characters but should only contain lowercase letters, digits, or underscores for purl type: 'pub'" + "expected_output": [ + { + "severity": "warning", + "message": "Name is not lowercased for purl type: 'pub'" + } ] }, { @@ -112,8 +114,11 @@ "test_group": "base", "test_type": "validation", "input": "pkg:pub/http-client@0.13.6", - "expected_messages": [ - "Name contains invalid characters but should only contain lowercase letters, digits, or underscores for purl type: 'pub'" + "expected_output": [ + { + "severity": "error", + "message": "Name contains invalid characters but should only contain lowercase letters, digits, or underscores for purl type: 'pub'" + } ] }, { @@ -121,7 +126,7 @@ "test_group": "base", "test_type": "validation", "input": "pkg:pub/characters@1.2.0?repository_url=https://pub.dev", - "expected_messages": null + "expected_output": [] } ] } diff --git a/tests/types/pypi-test.json b/tests/types/pypi-test.json index ee1f7ff5..37fd047d 100644 --- a/tests/types/pypi-test.json +++ b/tests/types/pypi-test.json @@ -228,29 +228,32 @@ "test_group": "base", "test_type": "validation", "input": "pkg:pypi/django@1.11.1", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid PyPI package with file_name qualifier", "test_group": "base", "test_type": "validation", "input": "pkg:pypi/django@1.11.1?file_name=Django-1.11.1.tar.gz", - "expected_messages": [] + "expected_output": [] }, { "description": "Valid PyPI package with wheel file_name", "test_group": "base", "test_type": "validation", "input": "pkg:pypi/django@1.11.1?file_name=Django-1.11.1-py2.py3-none-any.whl", - "expected_messages": [] + "expected_output": [] }, { "description": "PyPI package with name containing underscores and dots", "test_group": "base", "test_type": "validation", "input": "pkg:pypi/django_allauth@12.23", - "expected_messages": [ - "Name cannot contain `_` for purl type:'pypi'" + "expected_output": [ + { + "severity": "warning", + "message": "Name cannot contain `_` for purl type:'pypi'" + } ] }, { @@ -258,14 +261,14 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:pypi/django_allauth@12.23", - "expected_messages": null + "expected_output": [] }, { "description": "Name with uppercase letters", "test_group": "advanced", "test_type": "validation", "input": "pkg:pypi/Django-AllAuth@12.23", - "expected_messages": null + "expected_output": [] } ] } diff --git a/tests/types/qpkg-test.json b/tests/types/qpkg-test.json index 337fcef8..aac8d3d8 100644 --- a/tests/types/qpkg-test.json +++ b/tests/types/qpkg-test.json @@ -88,29 +88,32 @@ "test_group": "base", "test_type": "validation", "input": "pkg:qpkg/blackberry/com.qnx.sdp@7.0.0.SGA201702151847", - "expected_messages": null + "expected_output": [] }, { "description": "Valid QPKG with complex name and version", "test_group": "base", "test_type": "validation", "input": "pkg:qpkg/blackberry/com.qnx.qnx710.foo.bar.qux@0.0.4.01449T202205040833L", - "expected_messages": null + "expected_output": [] }, { "description": "Valid QPKG with repository_url qualifier", "test_group": "advanced", "test_type": "validation", "input": "pkg:qpkg/blackberry/com.qnx.sdp@7.0.0?repository_url=https://example.com/qpkg", - "expected_messages": null + "expected_output": [] }, { "description": "QPKG missing vendor (namespace)", "test_group": "base", "test_type": "validation", "input": "pkg:qpkg/com.qnx.sdp@7.0.0", - "expected_messages": [ - "Namespace is required for purl type: 'qpkg'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is required for purl type: 'qpkg'" + } ] }, { @@ -118,7 +121,7 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:qpkg/BlackBerry/com.qnx.sdp@7.0.0", - "expected_messages": null + "expected_output": [] } ] } diff --git a/tests/types/rpm-test.json b/tests/types/rpm-test.json index 8d475810..49cbbeb3 100644 --- a/tests/types/rpm-test.json +++ b/tests/types/rpm-test.json @@ -158,22 +158,25 @@ "test_group": "base", "test_type": "validation", "input": "pkg:rpm/fedora/curl@7.50.3-1.fc25?arch=i386", - "expected_messages": null + "expected_output": [] }, { "description": "Valid RPM with epoch qualifier", "test_group": "advanced", "test_type": "validation", "input": "pkg:rpm/fedora/centerim@4.22.10-1.el6?arch=i686&distro=fedora-25&epoch=1", - "expected_messages": null + "expected_output": [] }, { "description": "RPM missing vendor (namespace)", "test_group": "base", "test_type": "validation", "input": "pkg:rpm/curl@7.50.3-1.fc25?arch=i386&distro=fedora-25", - "expected_messages": [ - "Namespace is required for purl type: 'rpm'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is required for purl type: 'rpm'" + } ] }, { @@ -181,14 +184,14 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:rpm/opensuse/zsh?arch=x86_64&distro=opensuse-15.3", - "expected_messages": null + "expected_output": [] }, { "description": "Valid RPM with repository_url instead of distro", "test_group": "advanced", "test_type": "validation", "input": "pkg:rpm/centos/vim@8.0-1.el7?arch=x86_64&repository_url=https://mirror.centos.org/centos/7/os/x86_64", - "expected_messages": null + "expected_output": [] } ] } diff --git a/tests/types/swid-test.json b/tests/types/swid-test.json index 5fbef419..d42dfd83 100644 --- a/tests/types/swid-test.json +++ b/tests/types/swid-test.json @@ -141,42 +141,42 @@ "test_group": "base", "test_type": "validation", "input": "pkg:swid/Acme/example.com/Enterprise+Server@1.0.0?tag_id=75b8c285-fa7b-485b-b199-4745e3004d0d", - "expected_messages": null + "expected_output": [] }, { "description": "Valid SWID with only name and tag_id (no namespace)", "test_group": "base", "test_type": "validation", "input": "pkg:swid/Fedora@29?tag_id=org.fedoraproject.Fedora-29", - "expected_messages": null + "expected_output": [] }, { "description": "Valid SWID with tag_creator_name and tag_creator_regid qualifiers", "test_group": "advanced", "test_type": "validation", "input": "pkg:swid/Adobe Systems Incorporated/Adobe InDesign@CC?tag_creator_name=AdobeCorp&tag_creator_regid=com.adobe&tag_id=CreativeCloud-CS6-Win-GM-MUL", - "expected_messages": null + "expected_output": [] }, { "description": "SWID missing required tag_id qualifier", "test_group": "base", "test_type": "validation", "input": "pkg:swid/Acme/example.com/Enterprise+Server@1.0.0", - "expected_messages": null + "expected_output": [] }, { "description": "SWID with empty tag_id", "test_group": "advanced", "test_type": "validation", "input": "pkg:swid/Acme/example.com/Enterprise+Server@1.0.0?tag_id=", - "expected_messages": null + "expected_output": [] }, { "description": "Valid SWID with optional patch and tag_version", "test_group": "advanced", "test_type": "validation", "input": "pkg:swid/Acme/example.com/Enterprise+Server@1.0.0?patch=true&tag_id=75b8c285-fa7b-485b-b199-4745e3004d0d&tag_version=3", - "expected_messages": null + "expected_output": [] } ] } diff --git a/tests/types/swift-test.json b/tests/types/swift-test.json index 1a922afd..c120cdc6 100644 --- a/tests/types/swift-test.json +++ b/tests/types/swift-test.json @@ -240,15 +240,18 @@ "test_group": "base", "test_type": "validation", "input": "pkg:swift/github.com/Alamofire/Alamofire@5.4.3", - "expected_messages": null + "expected_output": [] }, { "description": "namespace is missing", "test_group": "base", "test_type": "validation", "input": "pkg:swift/Alamofire@5.4.3", - "expected_messages": [ - "Namespace is required for purl type: 'swift'" + "expected_output": [ + { + "severity": "error", + "message": "Namespace is required for purl type: 'swift'" + } ] }, { @@ -256,14 +259,14 @@ "test_group": "base", "test_type": "validation", "input": "pkg:swift/github.com/Alamofire/Alamofire@5.4.3?repository_url=https://swiftpm.example.com/", - "expected_messages": null + "expected_output": [] }, { "description": "Valid Swift package with case-sensitive namespace and name", "test_group": "advanced", "test_type": "validation", "input": "pkg:swift/GitHub.com/SomeOrg/MyLibrary@1.0.0", - "expected_messages": null + "expected_output": [] } ] } From 9edac14a9d0f689889a7cfc4086e057924ba4812 Mon Sep 17 00:00:00 2001 From: Tushar Goel Date: Wed, 3 Sep 2025 18:58:29 +0530 Subject: [PATCH 08/11] Update tests Signed-off-by: Tushar Goel --- tests/types/gem-test.json | 7 ++++++- tests/types/generic-test.json | 9 +++++++-- tests/types/luarocks-test.json | 7 ++++++- tests/types/mlflow-test.json | 7 ++++++- tests/types/rpm-test.json | 4 ++++ 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/tests/types/gem-test.json b/tests/types/gem-test.json index 14afecea..0eaeb405 100644 --- a/tests/types/gem-test.json +++ b/tests/types/gem-test.json @@ -167,7 +167,12 @@ "test_group": "base", "test_type": "validation", "input": "pkg:gem/sinatra@3.1.2?unknown=value", - "expected_output": [] + "expected_output": [ + { + "severity": "info", + "message": "Invalid qualifiers found: unknown. Allowed qualifiers are: platform, repository_url" + } + ] }, { "description": "Extra unknown qualifier", diff --git a/tests/types/generic-test.json b/tests/types/generic-test.json index 7cfb8357..3f8a4002 100644 --- a/tests/types/generic-test.json +++ b/tests/types/generic-test.json @@ -149,11 +149,16 @@ "expected_output": [] }, { - "description": "Valid generic package with vcs_url", + "description": "generic package with vcs_url", "test_group": "base", "test_type": "validation", "input": "pkg:generic/bitwarderl?vcs_url=git+https://git.fsfe.org/dxtr/bitwarderl@cc55108da32", - "expected_output": [] + "expected_output": [ + { + "level": "info", + "message": "Invalid qualifiers found: vcs_url. Allowed qualifiers are: checksum, download_url" + } + ] }, { "description": "Extra unknown qualifier", diff --git a/tests/types/luarocks-test.json b/tests/types/luarocks-test.json index 80e72cdc..b3aea0a8 100644 --- a/tests/types/luarocks-test.json +++ b/tests/types/luarocks-test.json @@ -154,7 +154,12 @@ "test_group": "base", "test_type": "validation", "input": "pkg:luarocks/username/packagename@0.1.0-1?channel=beta", - "expected_output": [] + "expected_output": [ + { + "level": "info", + "message": "Invalid qualifiers found: channel. Allowed qualifiers are: repository_url" + } + ] }, { "description": "Advanced validation for name with uppercase letters", diff --git a/tests/types/mlflow-test.json b/tests/types/mlflow-test.json index 9724d81d..fdb96045 100644 --- a/tests/types/mlflow-test.json +++ b/tests/types/mlflow-test.json @@ -306,7 +306,12 @@ "test_group": "base", "test_type": "validation", "input": "pkg:mlflow/creditfraud@3?foo=bar", - "expected_output": [] + "expected_output": [ + { + "severity": "info", + "message": "Invalid qualifiers found: foo. Allowed qualifiers are: model_uuid, repository_url, run_id" + } + ] } ] } diff --git a/tests/types/rpm-test.json b/tests/types/rpm-test.json index 49cbbeb3..79631ce3 100644 --- a/tests/types/rpm-test.json +++ b/tests/types/rpm-test.json @@ -176,6 +176,10 @@ { "severity": "error", "message": "Namespace is required for purl type: 'rpm'" + }, + { + "severity": "info", + "message": "Invalid qualifiers found: distro. Allowed qualifiers are: arch, epoch, repository_url" } ] }, From 5aee9f69f85da8f2e7fce07cbe0a467dae8d5380 Mon Sep 17 00:00:00 2001 From: Tushar Goel Date: Wed, 3 Sep 2025 19:00:30 +0530 Subject: [PATCH 09/11] Update tests Signed-off-by: Tushar Goel --- tests/types/generic-test.json | 2 +- tests/types/luarocks-test.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/types/generic-test.json b/tests/types/generic-test.json index 3f8a4002..ec9f3adc 100644 --- a/tests/types/generic-test.json +++ b/tests/types/generic-test.json @@ -155,7 +155,7 @@ "input": "pkg:generic/bitwarderl?vcs_url=git+https://git.fsfe.org/dxtr/bitwarderl@cc55108da32", "expected_output": [ { - "level": "info", + "severity": "info", "message": "Invalid qualifiers found: vcs_url. Allowed qualifiers are: checksum, download_url" } ] diff --git a/tests/types/luarocks-test.json b/tests/types/luarocks-test.json index b3aea0a8..213ff95b 100644 --- a/tests/types/luarocks-test.json +++ b/tests/types/luarocks-test.json @@ -156,7 +156,7 @@ "input": "pkg:luarocks/username/packagename@0.1.0-1?channel=beta", "expected_output": [ { - "level": "info", + "severity": "info", "message": "Invalid qualifiers found: channel. Allowed qualifiers are: repository_url" } ] From d474c724fa5115a8487f6e709e5527546b37da11 Mon Sep 17 00:00:00 2001 From: Tushar Goel Date: Fri, 5 Sep 2025 14:06:32 +0530 Subject: [PATCH 10/11] Change test structure Signed-off-by: Tushar Goel --- tests/types/conan-test.json | 14 +++++++------- tests/types/deb-test.json | 14 +++++++------- tests/types/hackage-test.json | 4 ++-- tests/types/pub-test.json | 2 +- tests/types/pypi-test.json | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/types/conan-test.json b/tests/types/conan-test.json index f06d4ce8..42a8bc97 100644 --- a/tests/types/conan-test.json +++ b/tests/types/conan-test.json @@ -343,7 +343,12 @@ "test_group": "base", "test_type": "validation", "input": "pkg:conan/openssl.org/openssl@3.0.3?arch=x86_64&build_type=Debug&compiler=Visual Studio&compiler.runtime=MDd&compiler.version=16&os=Windows&prev=b429db8a0e324114c25ec387bfd8281f330d7c5c&rrev=93a82349c31917d2d674d22065c7a9ef9f380c8e&shared=True", - "expected_output": [] + "expected_output": [ + { + "severity": "info", + "message": "Invalid qualifiers found: arch, build_type, compiler, compiler.runtime, compiler.version, os, shared. Allowed qualifiers are: channel, prev, repository_url, rrev, user" + } + ] }, { "description": "Valid Conan package with only namespace and no qualifiers", @@ -357,12 +362,7 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:conan/openssl@3.0.3?foo=bar", - "expected_output": [ - { - "severity": "info", - "message": "Invalid qualifiers found: arch, build_type, compiler, compiler.runtime, compiler.version, os, shared. Allowed qualifiers are: channel, prev, repository_url, rrev, user" - } - ] + "expected_output": [] } ] } diff --git a/tests/types/deb-test.json b/tests/types/deb-test.json index 7fce3656..7c4d28fa 100644 --- a/tests/types/deb-test.json +++ b/tests/types/deb-test.json @@ -291,7 +291,12 @@ "test_group": "base", "test_type": "validation", "input": "pkg:deb/debian/curl@7.50.3-1?arch=i386&distro=jessie", - "expected_output": [] + "expected_output": [ + { + "severity": "info", + "message": "Invalid qualifiers found: distro. Allowed qualifiers are: arch, repository_url" + } + ] }, { "description": "Valid deb package with vendor, name, version, without distro", @@ -324,12 +329,7 @@ "test_group": "advanced", "test_type": "validation", "input": "pkg:deb/debian/curl@7.50.3-1?foo=bar", - "expected_output": [ - { - "severity": "info", - "message": "Invalid qualifiers found: distro. Allowed qualifiers are: arch, repository_url" - } - ] + "expected_output": [] } ] } diff --git a/tests/types/hackage-test.json b/tests/types/hackage-test.json index ce1ff95e..1b1ae555 100644 --- a/tests/types/hackage-test.json +++ b/tests/types/hackage-test.json @@ -248,8 +248,8 @@ "input": "pkg:hackage/My_Package@0.1", "expected_output": [ { - "severity": "error", - "message": "Name contains underscores but should be kebab-case for purl type: 'hackage'" + "severity": "warning", + "message": "Name cannot contain underscores for purl type:'hackage'" } ] }, diff --git a/tests/types/pub-test.json b/tests/types/pub-test.json index 126e71e8..b87b3b1a 100644 --- a/tests/types/pub-test.json +++ b/tests/types/pub-test.json @@ -117,7 +117,7 @@ "expected_output": [ { "severity": "error", - "message": "Name contains invalid characters but should only contain lowercase letters, digits, or underscores for purl type: 'pub'" + "message": "Name contains invalid characters but should only contain letters, digits, or underscores for purl type: 'pub'" } ] }, diff --git a/tests/types/pypi-test.json b/tests/types/pypi-test.json index 37fd047d..aaa4a63b 100644 --- a/tests/types/pypi-test.json +++ b/tests/types/pypi-test.json @@ -252,7 +252,7 @@ "expected_output": [ { "severity": "warning", - "message": "Name cannot contain `_` for purl type:'pypi'" + "message": "Name cannot contain underscores for purl type:'pypi'" } ] }, From c398646bb2d642ccdd43bfbf5923cf650d69dc6a Mon Sep 17 00:00:00 2001 From: Tushar Goel Date: Fri, 5 Sep 2025 14:17:06 +0530 Subject: [PATCH 11/11] Change error to warning Signed-off-by: Tushar Goel --- tests/types/pub-test.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/types/pub-test.json b/tests/types/pub-test.json index b87b3b1a..428aebc1 100644 --- a/tests/types/pub-test.json +++ b/tests/types/pub-test.json @@ -116,7 +116,7 @@ "input": "pkg:pub/http-client@0.13.6", "expected_output": [ { - "severity": "error", + "severity": "warning", "message": "Name contains invalid characters but should only contain letters, digits, or underscores for purl type: 'pub'" } ]