Skip to content

Add PURL_TYPES and enforce validation of PURL types#188

Open
kdeldycke wants to merge 1 commit intopackage-url:mainfrom
kdeldycke:purl-types-inventory
Open

Add PURL_TYPES and enforce validation of PURL types#188
kdeldycke wants to merge 1 commit intopackage-url:mainfrom
kdeldycke:purl-types-inventory

Conversation

@kdeldycke
Copy link
Copy Markdown

@kdeldycke kdeldycke commented May 31, 2025

This PR adds a comprehensive list of all pURL types that are referenced in https://github.com/package-url/purl-spec/blob/main/types

It also enforces the validation of a pURL type.

This PR use the current spec submodule pinned to c398646 as the source of truth (see #209 for other concerns about that submodule). And adds a unit-tests to enforce the cohesion between these pinned specs and the pURL types supported by this library.

For context, I made this list for my Meta Package Manager project, which is mapping pURL types to package managers.

Closes: #155 #181

@kdeldycke kdeldycke changed the title Add PURL_TYPES and enforce validation of PackageURL types Add PURL_TYPES and enforce validation of pURL types May 31, 2025
@kdeldycke
Copy link
Copy Markdown
Author

An improvement of this PR would be to use a enum.StrEnum class to reference all these types, so they can be used as constants.

enum.StrEnum being available starting with Python v3.11, we can add the optional StrEnum dependency for python_version < 3.11.

kdeldycke added a commit to kdeldycke/meta-package-manager that referenced this pull request May 31, 2025
@mjherzog mjherzog changed the title Add PURL_TYPES and enforce validation of pURL types Add PURL_TYPES and enforce validation of PURL types Oct 7, 2025
@mjherzog
Copy link
Copy Markdown
Member

mjherzog commented Oct 7, 2025

This PR needs to be reset to reflect the deprecation of https://github.com/package-url/purl-spec/blob/main/PURL-TYPES.rst
in favor of registered PURL types at: https://github.com/package-url/purl-spec/blob/main/types.
The file : https://github.com/package-url/purl-spec/blob/main/purl-types-index.json provides the current list of registered PURL types and is automatically regenerated whenever a new PURL type is added

@kdeldycke kdeldycke force-pushed the purl-types-inventory branch from d2b0d79 to 476f26b Compare April 23, 2026 08:48
@kdeldycke
Copy link
Copy Markdown
Author

This PR needs to be reset to reflect the deprecation of https://github.com/package-url/purl-spec/blob/main/PURL-TYPES.rst in favor of registered PURL types at: https://github.com/package-url/purl-spec/blob/main/types. The file : https://github.com/package-url/purl-spec/blob/main/purl-types-index.json provides the current list of registered PURL types and is automatically regenerated whenever a new PURL type is added

Thanks @mjherzog for the feedback and sorry for the delay.

Just updated and synced the inventory of recognized types with the content of https://github.com/package-url/purl-spec/tree/main/types . Used that opportunity to cleanup and fix the now-failing tests.

This PR is ready to be reviewed and the workflow run to demonstrate the test results.

@kdeldycke kdeldycke force-pushed the purl-types-inventory branch 2 times, most recently from b681875 to f655de8 Compare April 23, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PackageURL type not being validated

2 participants