You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Validation error messages could be instances of a class that tracks their context like this:
class ErrorMessage:
element_type: SpdxElementType # an enum with values document, package, file, snippet, relationship, annotation, ...
id: Optional[str] # not every type has an id or it might be missing
validation_messages: List[str]
Validation can be performed by calling validation methods that return List[ErrorMessage]. Keeping them in separate classes allows for better unit testing by using mocks. The spdx version will be passed to validators that differ for different versions.
class CreationInfoValidator()
def validate_creation_info(self, document: Document) -> List[ErrorMessage]:
error_messages = []
spdx_id: Optional[str]
... # check and set the spdx_id
if document.namespace is None:
error_messages.append(ErrorMessage(SpdxElementType.Document, spdx_id, 'Missing required field "namespace."'))
The text was updated successfully, but these errors were encountered:
We want a refactored validation using the new data model (available on https://github.com/spdx/tools-python/tree/refactor-python-tools). The main goal is to keep it completely separated from the parsing/writing layers.
Validation error messages could be instances of a class that tracks their context like this:
Validation can be performed by calling validation methods that return
List[ErrorMessage]
. Keeping them in separate classes allows for better unit testing by using mocks. The spdx version will be passed to validators that differ for different versions.The text was updated successfully, but these errors were encountered: