Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add helper method to generateBomLink #726

Closed
saquibsaifee opened this issue Oct 26, 2024 · 4 comments · Fixed by #728
Closed

feat: add helper method to generateBomLink #726

saquibsaifee opened this issue Oct 26, 2024 · 4 comments · Fixed by #728
Labels
enhancement New feature or request

Comments

@saquibsaifee
Copy link
Contributor

saquibsaifee commented Oct 26, 2024

Improve the process of creating and validating BOM-Link URIs within XsUri.
This enhancement would standardize BOM-Link creation within XsUri, reduce potential errors in URI formation, and simplify BOM-Link validation.

from @jkowalleck

A possible solution could be something like a classmethod
XsUri.make_BomLink(cls, serialnumber: Union[UUID, string], version: int = 1, bom_ref: Optional[Union[string, BomRef]] = None) -> XsUri

And we would, of course, add a method XsUri.is_BomLink(self) -> bool

@jkowalleck jkowalleck added the enhancement New feature or request label Oct 26, 2024
@jkowalleck
Copy link
Member

@saquibsaifee , is this feature something you would contribute?

@saquibsaifee
Copy link
Contributor Author

Yes, I am giving it a try as we speak

@jkowalleck
Copy link
Member

jkowalleck commented Oct 26, 2024

we already have parts ofg the bom-link patetrn here:

def urn(self) -> str:
return f'urn:cdx:{self.serial_number}/{self.version}'

maybe you could refactor that to urn:cdx:%s/%u and reuse it then?
or maybe not, ... whatever suites you.

@saquibsaifee
Copy link
Contributor Author

saquibsaifee commented Oct 26, 2024

Not able to link the PR, so mentioning it here. #728

@jkowalleck what are your thoughts on the PR?

@saquibsaifee saquibsaifee changed the title feat: add make_BomLink and is_BomLink method to XsUri class feat: add helper method to generateBomLink Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants