:py:mod:`cyclonedx.serialization`
=================================

.. py:module:: cyclonedx.serialization

.. autoapi-nested-parse::

   Set of helper classes for use with ``serializable`` when conducting (de-)serialization.



Package Contents
----------------

Classes
~~~~~~~

.. autoapisummary::

   cyclonedx.serialization.BomRefHelper
   cyclonedx.serialization.PackageUrl
   cyclonedx.serialization.UrnUuidHelper
   cyclonedx.serialization.LicenseRepositoryHelper




.. py:class:: BomRefHelper


   Bases: :py:obj:`py_serializable.helpers.BaseHelper`

   **DEPRECATED** in favour of :class:`BomRef`.

   .. deprecated:: 8.6
      Use :class:`BomRef` instead.

   .. py:method:: serialize(o: Any) -> Optional[str]
      :classmethod:

      general purpose serializer


   .. py:method:: deserialize(o: Any) -> cyclonedx.model.bom_ref.BomRef
      :classmethod:

      general purpose deserializer


   .. py:method:: json_normalize(o: Any, *, view: Optional[Type[py_serializable.ViewType]], prop_info: py_serializable.ObjectMetadataLibrary.SerializableProperty, ctx: Type[Any], **kwargs: Any) -> Optional[Any]
      :classmethod:

      json specific normalizer


   .. py:method:: json_serialize(o: Any) -> Union[str, Any]
      :classmethod:

      json specific serializer


   .. py:method:: json_denormalize(o: Any, *, prop_info: py_serializable.ObjectMetadataLibrary.SerializableProperty, ctx: Type[Any], **kwargs: Any) -> Any
      :classmethod:

      json specific denormalizer

      :param tCls: the class that was desired to denormalize to
      :param pCls: tha prent class - as context


   .. py:method:: json_deserialize(o: Any) -> Any
      :classmethod:

      json specific deserializer


   .. py:method:: xml_normalize(o: Any, *, element_name: str, view: Optional[Type[py_serializable.ViewType]], xmlns: Optional[str], prop_info: py_serializable.ObjectMetadataLibrary.SerializableProperty, ctx: Type[Any], **kwargs: Any) -> Optional[Union[xml.etree.ElementTree.Element, Any]]
      :classmethod:

      xml specific normalizer


   .. py:method:: xml_serialize(o: Any) -> Union[str, Any]
      :classmethod:

      xml specific serializer


   .. py:method:: xml_denormalize(o: xml.etree.ElementTree.Element, *, default_ns: Optional[str], prop_info: py_serializable.ObjectMetadataLibrary.SerializableProperty, ctx: Type[Any], **kwargs: Any) -> Any
      :classmethod:

      xml specific denormalizer


   .. py:method:: xml_deserialize(o: Union[str, Any]) -> Any
      :classmethod:

      xml specific deserializer



.. py:class:: PackageUrl


   Bases: :py:obj:`py_serializable.helpers.BaseHelper`

   Base Helper.

   Inherit from this class and implement/override the needed functions!

   This class does not provide any functionality,
   it is more like a Protocol with some fallback implementations.

   .. py:method:: serialize(o: Any) -> str
      :classmethod:

      general purpose serializer


   .. py:method:: deserialize(o: Any) -> packageurl.PackageURL
      :classmethod:

      general purpose deserializer


   .. py:method:: json_normalize(o: Any, *, view: Optional[Type[py_serializable.ViewType]], prop_info: py_serializable.ObjectMetadataLibrary.SerializableProperty, ctx: Type[Any], **kwargs: Any) -> Optional[Any]
      :classmethod:

      json specific normalizer


   .. py:method:: json_serialize(o: Any) -> Union[str, Any]
      :classmethod:

      json specific serializer


   .. py:method:: json_denormalize(o: Any, *, prop_info: py_serializable.ObjectMetadataLibrary.SerializableProperty, ctx: Type[Any], **kwargs: Any) -> Any
      :classmethod:

      json specific denormalizer

      :param tCls: the class that was desired to denormalize to
      :param pCls: tha prent class - as context


   .. py:method:: json_deserialize(o: Any) -> Any
      :classmethod:

      json specific deserializer


   .. py:method:: xml_normalize(o: Any, *, element_name: str, view: Optional[Type[py_serializable.ViewType]], xmlns: Optional[str], prop_info: py_serializable.ObjectMetadataLibrary.SerializableProperty, ctx: Type[Any], **kwargs: Any) -> Optional[Union[xml.etree.ElementTree.Element, Any]]
      :classmethod:

      xml specific normalizer


   .. py:method:: xml_serialize(o: Any) -> Union[str, Any]
      :classmethod:

      xml specific serializer


   .. py:method:: xml_denormalize(o: xml.etree.ElementTree.Element, *, default_ns: Optional[str], prop_info: py_serializable.ObjectMetadataLibrary.SerializableProperty, ctx: Type[Any], **kwargs: Any) -> Any
      :classmethod:

      xml specific denormalizer


   .. py:method:: xml_deserialize(o: Union[str, Any]) -> Any
      :classmethod:

      xml specific deserializer



.. py:class:: UrnUuidHelper


   Bases: :py:obj:`py_serializable.helpers.BaseHelper`

   Base Helper.

   Inherit from this class and implement/override the needed functions!

   This class does not provide any functionality,
   it is more like a Protocol with some fallback implementations.

   .. py:method:: serialize(o: Any) -> str
      :classmethod:

      general purpose serializer


   .. py:method:: deserialize(o: Any) -> uuid.UUID
      :classmethod:

      general purpose deserializer


   .. py:method:: json_normalize(o: Any, *, view: Optional[Type[py_serializable.ViewType]], prop_info: py_serializable.ObjectMetadataLibrary.SerializableProperty, ctx: Type[Any], **kwargs: Any) -> Optional[Any]
      :classmethod:

      json specific normalizer


   .. py:method:: json_serialize(o: Any) -> Union[str, Any]
      :classmethod:

      json specific serializer


   .. py:method:: json_denormalize(o: Any, *, prop_info: py_serializable.ObjectMetadataLibrary.SerializableProperty, ctx: Type[Any], **kwargs: Any) -> Any
      :classmethod:

      json specific denormalizer

      :param tCls: the class that was desired to denormalize to
      :param pCls: tha prent class - as context


   .. py:method:: json_deserialize(o: Any) -> Any
      :classmethod:

      json specific deserializer


   .. py:method:: xml_normalize(o: Any, *, element_name: str, view: Optional[Type[py_serializable.ViewType]], xmlns: Optional[str], prop_info: py_serializable.ObjectMetadataLibrary.SerializableProperty, ctx: Type[Any], **kwargs: Any) -> Optional[Union[xml.etree.ElementTree.Element, Any]]
      :classmethod:

      xml specific normalizer


   .. py:method:: xml_serialize(o: Any) -> Union[str, Any]
      :classmethod:

      xml specific serializer


   .. py:method:: xml_denormalize(o: xml.etree.ElementTree.Element, *, default_ns: Optional[str], prop_info: py_serializable.ObjectMetadataLibrary.SerializableProperty, ctx: Type[Any], **kwargs: Any) -> Any
      :classmethod:

      xml specific denormalizer


   .. py:method:: xml_deserialize(o: Union[str, Any]) -> Any
      :classmethod:

      xml specific deserializer



.. py:class:: LicenseRepositoryHelper


   Bases: :py:obj:`cyclonedx.model.license._LicenseRepositorySerializationHelper`

   **DEPRECATED**

   .. deprecated:: 8.6
      No public API planned for replacing this,

   .. py:method:: json_normalize(o: LicenseRepository, *, view: Optional[type[py_serializable.ViewType]], **__: Any) -> Any
      :classmethod:

      json specific normalizer


   .. py:method:: json_denormalize(o: list[dict[str, Any]], **__: Any) -> LicenseRepository
      :classmethod:

      json specific denormalizer

      :param tCls: the class that was desired to denormalize to
      :param pCls: tha prent class - as context


   .. py:method:: xml_normalize(o: LicenseRepository, *, element_name: str, view: Optional[type[py_serializable.ViewType]], xmlns: Optional[str], **__: Any) -> Optional[xml.etree.ElementTree.Element]
      :classmethod:

      xml specific normalizer


   .. py:method:: xml_denormalize(o: xml.etree.ElementTree.Element, default_ns: Optional[str], **__: Any) -> LicenseRepository
      :classmethod:

      xml specific denormalizer


   .. py:method:: serialize(o: Any) -> Union[Any, str]
      :classmethod:
      :abstractmethod:

      general purpose serializer


   .. py:method:: deserialize(o: Any) -> Any
      :classmethod:
      :abstractmethod:

      general purpose deserializer


   .. py:method:: json_serialize(o: Any) -> Union[str, Any]
      :classmethod:

      json specific serializer


   .. py:method:: json_deserialize(o: Any) -> Any
      :classmethod:

      json specific deserializer


   .. py:method:: xml_serialize(o: Any) -> Union[str, Any]
      :classmethod:

      xml specific serializer


   .. py:method:: xml_deserialize(o: Union[str, Any]) -> Any
      :classmethod:

      xml specific deserializer



