Skip to content

model/vulnerability: fix optional type - #61

Merged
madpah merged 1 commit into
CycloneDX:mainfrom
trail-of-forks:ww/vuln-model-type-error
Nov 10, 2021
Merged

madpah merged 1 commit into
CycloneDX:mainfrom
trail-of-forks:ww/vuln-model-type-error

Conversation

@woodruffw

Copy link
Copy Markdown
Contributor

This fixes a small bug when constructing a Vulnerability model that eventually gets serialized to XML: get_ratings expects self._ratings to be a List[VulnerabilityRating] instead of an Optional[...], so we default-initialize it if the constructor is passed None.

There are other type errors in the same constructor; I'll update this PR as I continue to try to get XML serialization working in pip-audit.

Downstream: pypa/pip-audit#109

@woodruffw
woodruffw requested a review from a team as a code owner November 9, 2021 18:15
@woodruffw
woodruffw force-pushed the ww/vuln-model-type-error branch from 2dae7b4 to 7d57dcc Compare November 9, 2021 18:16
@jkowalleck
jkowalleck requested a review from a team November 10, 2021 11:50

@madpah madpah left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good!

@jkowalleck jkowalleck added the bug Something isn't working label Nov 10, 2021

@jkowalleck jkowalleck left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@woodruffw could you rebase your changes?

@jkowalleck jkowalleck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rebase required, still

@woodruffw
woodruffw force-pushed the ww/vuln-model-type-error branch from aa1e9aa to 636b368 Compare November 10, 2021 15:12
@woodruffw
woodruffw force-pushed the ww/vuln-model-type-error branch from 636b368 to 792d3c7 Compare November 10, 2021 15:13
@woodruffw

Copy link
Copy Markdown
Contributor Author

Okay, I've rebased. The typechecking for #52 covered most of the changes here, but I re-added the default parameter values that were removed as part of that PR -- those defaults made constructing a Vulnerability model in a custom parser much simpler.

@woodruffw woodruffw mentioned this pull request Nov 10, 2021
@madpah
madpah dismissed jkowalleck’s stale review November 10, 2021 15:38

@woodruffw has rebased as requested.

@madpah
madpah merged commit 395a0ec into CycloneDX:main Nov 10, 2021
@woodruffw
woodruffw deleted the ww/vuln-model-type-error branch November 10, 2021 15:41
@woodruffw

Copy link
Copy Markdown
Contributor Author

Thanks! Would it be possible to get a release cut for this?

@madpah

madpah commented Nov 10, 2021

Copy link
Copy Markdown
Collaborator

It's happening as I write this :-) Should be out shortly.

@madpah

madpah commented Nov 10, 2021

Copy link
Copy Markdown
Collaborator

@woodruffw

Copy link
Copy Markdown
Contributor Author

Wonderful, thanks a ton!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants