cyclonedx.validation.json
Classes
Validation failed with this specific error. |
|
Validator for CycloneDX documents in JSON format. |
|
Strict validator for CycloneDX documents in JSON format. |
Module Contents
- class cyclonedx.validation.json.JsonValidationError(data: Any)
Bases:
cyclonedx.validation.ValidationErrorValidation 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.json.JsonValidator(schema_version: cyclonedx.schema.SchemaVersion)
Bases:
_BaseJsonValidator,cyclonedx.validation.BaseSchemabasedValidator,cyclonedx.validation.SchemabasedValidatorValidator for CycloneDX documents in JSON format.
- property output_format: Literal[cyclonedx.schema.OutputFormat.JSON]
Get the format.
- validate_str(data: str, *, all_errors: Literal[False] = ...) JsonValidationError | None
- validate_str(data: str, *, all_errors: Literal[True]) collections.abc.Iterable[JsonValidationError] | 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
- property schema_version: cyclonedx.schema.SchemaVersion
Get the schema version.
- class cyclonedx.validation.json.JsonStrictValidator(schema_version: cyclonedx.schema.SchemaVersion)
Bases:
_BaseJsonValidator,cyclonedx.validation.BaseSchemabasedValidator,cyclonedx.validation.SchemabasedValidatorStrict validator for CycloneDX documents in JSON format.
In contrast to
JsonValidator, the document must not have additional or unknown JSON properties.- property output_format: Literal[cyclonedx.schema.OutputFormat.JSON]
Get the format.
- validate_str(data: str, *, all_errors: Literal[False] = ...) JsonValidationError | None
- validate_str(data: str, *, all_errors: Literal[True]) collections.abc.Iterable[JsonValidationError] | 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
- property schema_version: cyclonedx.schema.SchemaVersion
Get the schema version.