Skip to content

Conversation

@armintaenzertng
Copy link
Collaborator

fixes #593

validation_messages: List[ValidationMessage] = validate_full_spdx_document(document)

# If the document is valid, validation_messages will be empty.
assert validation_messages == []

Choose a reason for hiding this comment

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

I think that this should go after logging the validation messages to actually see what has to be fixed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You are right, that makes more sense

# Finally, we can serialize the document to any of the five supported formats.
# Using the write_file() method from the write_anything module,
# the format will be determined by the file ending: .spdx (tag-value), .json, .xml, .yaml. or .rdf (or .rdf.xml)
write_file(document, "my_spdx_document.json")

Choose a reason for hiding this comment

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

According to the specification, JSON serializations should use *.spdx.json (see https://spdx.github.io/spdx-spec/v2.3/conformance/#44-standard-data-format-requirements), so I would probably stick with the recommendation here as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure thing!

@armintaenzertng armintaenzertng force-pushed the exampleDocumentFromScratch branch from 16247a9 to d34454e Compare April 19, 2023 14:31
README.md Outdated
## Library usage
1. **DATA MODEL**
* The `spdx_tools.spdx.model` package constitutes the internal SPDX v2.3 data model (v2.2 is a simply a subset of this). All relevant classes for SPDX document creation are exposed in the [__init__.py](src%2Fspdx_tools%2Fspdx%2Fmodel%2F__init__.py).
* The `spdx_tools.spdx.model` package constitutes the internal SPDX v2.3 data model (v2.2 is a simply a subset of this). All relevant classes for SPDX document creation are exposed in the `__init__.py` found [here](src%2Fspdx_tools%2Fspdx%2Fmodel%2F__init__.py).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* The `spdx_tools.spdx.model` package constitutes the internal SPDX v2.3 data model (v2.2 is a simply a subset of this). All relevant classes for SPDX document creation are exposed in the `__init__.py` found [here](src%2Fspdx_tools%2Fspdx%2Fmodel%2F__init__.py).
* The `spdx_tools.spdx.model` package constitutes the internal SPDX v2.3 data model (v2.2 is simply a subset of this). All relevant classes for SPDX document creation are exposed in the `__init__.py` found [here](src%2Fspdx_tools%2Fspdx%2Fmodel%2F__init__.py).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@armintaenzertng armintaenzertng force-pushed the exampleDocumentFromScratch branch from d34454e to 3a4f8a4 Compare April 19, 2023 14:36
Copy link
Collaborator

@meretp meretp left a comment

Choose a reason for hiding this comment

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

LGTM

@armintaenzertng armintaenzertng merged commit c1f0b1f into spdx:main Apr 19, 2023
@armintaenzertng armintaenzertng deleted the exampleDocumentFromScratch branch April 19, 2023 14:48
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.

Example missing imports

3 participants