Patchable

Bases: Protocol[DomainModelCovariant]

Protocol for patchable domain models.

Source code in src/alpha/interfaces/patchable.py
class Patchable(Protocol[DomainModelCovariant]):
    """Protocol for patchable domain models."""

    def patch(self, patches: JsonPatch) -> DomainModelCovariant:
        """Patch the domain model instance with the given JSON Patch.

        Parameters
        ----------
        patches
            A JsonPatch object containing the patches to be applied to the
            domain model instance.

        Returns
        -------
        DomainModelCovariant
            The updated domain model instance after applying the patches.
        """
        ...

Methods:

patch

patch(patches)

Patch the domain model instance with the given JSON Patch.

Parameters:
  • patches (JsonPatch) –

    A JsonPatch object containing the patches to be applied to the domain model instance.

Returns:
  • DomainModelCovariant

    The updated domain model instance after applying the patches.

Source code in src/alpha/interfaces/patchable.py
def patch(self, patches: JsonPatch) -> DomainModelCovariant:
    """Patch the domain model instance with the given JSON Patch.

    Parameters
    ----------
    patches
        A JsonPatch object containing the patches to be applied to the
        domain model instance.

    Returns
    -------
    DomainModelCovariant
        The updated domain model instance after applying the patches.
    """
    ...