8000 [issue-402] add validation option to tag-value writer by meretp · Pull Request #536 · spdx/tools-python · GitHub
[go: up one dir, main page]

Skip to content

[issue-402] add validation option to tag-value writer #536

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

Merged

Conversation

meretp
Copy link
Collaborator
@meretp meretp commented Mar 28, 2023

Reading through the migration guideline I came across the line

Now, when calling write_file(), by default a Document will be validated against the specification before it can be written to a file.

which lead me to this addition.

part of #402

Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
def write_document_to_file(document: Document, file_name: str, validate: bool = True):
if validate:
validation_messages: List[ValidationMessage] = validate_full_spdx_document(document,
document.creation_info.spdx_version)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't need to specify the version, it will be automatically inferred from the creation_info

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Alright, I deleted the argument in the other writer functions as well.

…y inferred from the creation_info

Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
Copy link
Collaborator
@armintaenzertng armintaenzertng left a comment

Choose a reason for hiding this comment

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

Thanks, looks good :)

@meretp meretp merged commit d1c01f8 into spdx:refactor-python-tools Mar 28, 2023
@meretp meretp deleted the issue-402-validation-tag-value-writer branch March 28, 2023 09:42
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.

2 participants
0