cyclonedx.validation
Submodules
Classes
Validation failed with this specific error. |
|
Schema-based Validator protocol |
|
Base Schema-based Validator |
Functions
Get the default Schema-based Validator for a certain |
Package Contents
- class cyclonedx.validation.ValidationError(data: Any)
Validation failed with this specific error.
Use
datato access the content.- data: Any
Raw error data from one of the underlying validation methods.
- class cyclonedx.validation.SchemabasedValidator
Bases:
ProtocolSchema-based Validator protocol
- validate_str(data: str, *, all_errors: Literal[False] = ...) ValidationError | None
- validate_str(data: str, *, all_errors: Literal[True]) collections.abc.Iterable[ValidationError] | None
Validate a string
- Parameters:
data – the data string to validate
all_errors – whether to return all errors or only (any)one - if any
- Returns:
validation error
- Retval None:
if
datais valid- Retval ValidationError:
if
datais invalid andall_errorsisFalse- Retval Iterable[ValidationError]:
if
datais invalid andall_errorsisTrue
- class cyclonedx.validation.BaseSchemabasedValidator(schema_version: cyclonedx.schema.SchemaVersion)
Bases:
abc.ABC,SchemabasedValidatorBase Schema-based Validator
- property schema_version: cyclonedx.schema.SchemaVersion
Get the schema version.
- property output_format: cyclonedx.schema.OutputFormat
- Abstractmethod:
Get the format.
- validate_str(data: str, *, all_errors: Literal[False] = ...) ValidationError | None
- validate_str(data: str, *, all_errors: Literal[True]) collections.abc.Iterable[ValidationError] | None
Validate a string
- Parameters:
data – the data string to validate
all_errors – whether to return all errors or only (any)one - if any
- Returns:
validation error
- Retval None:
if
datais valid- Retval ValidationError:
if
datais invalid andall_errorsisFalse- Retval Iterable[ValidationError]:
if
datais invalid andall_errorsisTrue
- cyclonedx.validation.make_schemabased_validator(output_format: Literal[cyclonedx.schema.OutputFormat.JSON], schema_version: cyclonedx.schema.SchemaVersion) json.JsonValidator
- cyclonedx.validation.make_schemabased_validator(output_format: Literal[cyclonedx.schema.OutputFormat.XML], schema_version: cyclonedx.schema.SchemaVersion) xml.XmlValidator
- cyclonedx.validation.make_schemabased_validator(output_format: cyclonedx.schema.OutputFormat, schema_version: cyclonedx.schema.SchemaVersion) json.JsonValidator | xml.XmlValidator
Get the default Schema-based Validator for a certain
OutputFormat.Raises error when no instance could be made.