:py:mod:`cyclonedx.validation.json`
===================================

.. py:module:: cyclonedx.validation.json


Module Contents
---------------

Classes
~~~~~~~

.. autoapisummary::

   cyclonedx.validation.json.JsonValidationError
   cyclonedx.validation.json.JsonValidator
   cyclonedx.validation.json.JsonStrictValidator




.. py:class:: JsonValidationError(data: Any)


   Bases: :py:obj:`cyclonedx.validation.ValidationError`

   Validation failed with this specific error.

   Use :attr:`~data` to access the content.

   .. py:attribute:: data
      :type: Any

      Raw error data from one of the underlying validation methods.



.. py:class:: JsonValidator(schema_version: cyclonedx.schema.SchemaVersion)


   Bases: :py:obj:`_BaseJsonValidator`, :py:obj:`cyclonedx.validation.BaseSchemabasedValidator`, :py:obj:`cyclonedx.validation.SchemabasedValidator`

   Validator for CycloneDX documents in JSON format.

   .. py:property:: output_format
      :type: Literal[cyclonedx.schema.OutputFormat.JSON]

      Get the format.


   .. py:property:: schema_version
      :type: cyclonedx.schema.SchemaVersion

      Get the schema version.


   .. py:method:: validate_str(data: str, *, all_errors: Literal[False] = ...) -> Optional[JsonValidationError]
                  validate_str(data: str, *, all_errors: Literal[True]) -> Optional[collections.abc.Iterable[JsonValidationError]]

      Validate a string

      :param data: the data string to validate
      :param all_errors: whether to return all errors or only (any)one - if any
      :return: validation error
      :retval None: if ``data`` is valid
      :retval ValidationError:  if ``data`` is invalid



.. py:class:: JsonStrictValidator(schema_version: cyclonedx.schema.SchemaVersion)


   Bases: :py:obj:`_BaseJsonValidator`, :py:obj:`cyclonedx.validation.BaseSchemabasedValidator`, :py:obj:`cyclonedx.validation.SchemabasedValidator`

   Strict validator for CycloneDX documents in JSON format.

   In contrast to :class:`~JsonValidator`,
   the document must not have additional or unknown JSON properties.

   .. py:property:: output_format
      :type: Literal[cyclonedx.schema.OutputFormat.JSON]

      Get the format.


   .. py:property:: schema_version
      :type: cyclonedx.schema.SchemaVersion

      Get the schema version.


   .. py:method:: validate_str(data: str, *, all_errors: Literal[False] = ...) -> Optional[JsonValidationError]
                  validate_str(data: str, *, all_errors: Literal[True]) -> Optional[collections.abc.Iterable[JsonValidationError]]

      Validate a string

      :param data: the data string to validate
      :param all_errors: whether to return all errors or only (any)one - if any
      :return: validation error
      :retval None: if ``data`` is valid
      :retval ValidationError:  if ``data`` is invalid



